wincanton.service-now.com Open in urlscan Pro
148.139.16.212  Public Scan

URL: https://wincanton.service-now.com/scripts/js_includes_sp.jsx
Submission: On December 02 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

/*! RESOURCE: /scripts/js_includes_sp.js */
/*! RESOURCE: /scripts/js_includes_sp_deps.js */
/*! RESOURCE: /scripts/js_includes_sp_common.js */
/*! RESOURCE: /scripts/sn/common/_module.js */
angular.module('sn.common', [
'ngSanitize',
'ngAnimate',
'sn.common.avatar',
'sn.common.controls',
'sn.common.datetime',
'sn.common.glide',
'sn.common.i18n',
'sn.common.link',
'sn.common.mention',
'sn.common.messaging',
'sn.common.notification',
'sn.common.presence',
'sn.common.stream',
'sn.common.ui',
'sn.common.user_profile',
'sn.common.util',
'sn.common.dynamicTranslation'
]);
angular.module('ng.common', [
'sn.common'
]);
;
/*! RESOURCE: /scripts/sn/common/dist/templates.js */
angular.module('sn.common.dist.templates', []);
;
/*! RESOURCE: /scripts/sn/common/datetime/js_includes_datetime.js */
/*! RESOURCE: /scripts/sn/common/datetime/_module.js */
angular.module('sn.common.datetime', [
'sn.common.i18n'
]);
angular.module('sn.timeAgo', [
'sn.common.datetime'
]);
;
/*! RESOURCE: /scripts/sn/common/datetime/directive.snTimeAgo.js */
angular.module('sn.common.datetime').constant('DATE_GRANULARITY', {
DATETIME: 1,
DATE: 2
});
angular.module('sn.common.datetime').factory('timeAgoTimer', function($interval, $rootScope, DATE_GRANULARITY) {
"use strict";
var digestInterval;
return function(displayGranularityType) {
displayGranularityType = typeof displayGranularityType !== 'undefined' ? displayGranularityType : DATE_GRANULARITY.DATETIME;
if (!digestInterval && displayGranularityType == DATE_GRANULARITY.DATETIME)
digestInterval = $interval(function() {
$rootScope.$broadcast('sn.TimeAgo.tick');
}, 30 * 1000);
return Date.now();
};
});
angular.module('sn.common.datetime').factory('timeAgo', function(timeAgoSettings, DATE_GRANULARITY) {
var service = {
settings: timeAgoSettings.get(),
allowFuture: function allowFuture(bool) {
this.settings.allowFuture = bool;
return this;
},
toWords: function toWords(distanceMillis, messageGranularity, verbose) {
messageGranularity = messageGranularity || DATE_GRANULARITY.DATETIME;
var $l = verbose ? service.settings.strings_verbose : service.settings.strings;
var seconds = Math.abs(distanceMillis) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
var years = days / 365;
var ago = $l.ago;
if ((seconds < 45 && messageGranularity == DATE_GRANULARITY.DATETIME)
|| (hours < 24 && messageGranularity == DATE_GRANULARITY.DATE)
|| (!service.settings.allowFuture && distanceMillis < 0))
ago = '%d';
if (service.settings.allowFuture) {
if (distanceMillis < 0) {
ago = $l.fromNow;
}
}
function substitute(stringOrFunction, number) {
var string = angular.isFunction(stringOrFunction) ?
stringOrFunction(number, distanceMillis) : stringOrFunction;
if (!string)
return "";
var value = ($l.numbers && $l.numbers[number]) || number;
return string.replace(/%d/i, value);
}
var wantDate = messageGranularity == DATE_GRANULARITY.DATE;
var wantDateTime = messageGranularity == DATE_GRANULARITY.DATETIME;
var words = distanceMillis <= 0 && wantDateTime && substitute($l.justNow, 0) ||
distanceMillis <= 0 && wantDate && substitute($l.today, 0) ||
seconds < 45 && (distanceMillis >= 0 || !service.settings.allowFuture) && wantDateTime && substitute($l.justNow, Math.round(seconds)) ||
seconds < 45 && wantDateTime && substitute($l.seconds, Math.round(seconds)) ||
seconds < 90 && wantDateTime && substitute($l.minute, 1) ||
minutes < 45 && wantDateTime && substitute($l.minutes, Math.round(minutes)) ||
minutes < 90 && wantDateTime && substitute($l.hour, 1) ||
hours < 24 && wantDateTime && substitute($l.hours, Math.round(hours)) ||
hours < 24 && wantDate && substitute($l.today, 0) ||
hours < 42 && substitute($l.day, 1) ||
days < 30 && substitute($l.days, Math.ceil(days)) ||
days < 45 && substitute($l.month, 1) ||
days < 365 && substitute($l.months, Math.round(days / 30)) ||
years < 1.5 && substitute($l.year, 1) ||
substitute($l.years, Math.round(years));
return substitute(ago, words);
},
parse: function(iso8601) {
if (angular.isNumber(iso8601))
return new Date(parseInt(iso8601, 10));
var s = iso8601.trim();
s = s.replace(/\.\d+/,"");
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2");
return new Date(s);
}
};
return service;
});
angular.module('sn.common.datetime').directive("snTimeAgo", function(timeAgoSettings, $rootScope, timeAgo, timeAgoTimer, DATE_GRANULARITY, dateUtils) {
"use strict";
return {
restrict: "E",
template: '<time title="{{ ::titleTime }}"><span aria-hidden="true">{{timeAgo}}</span><span class="sr-only">{{timeAgoVerbose}}</span></time>',
scope: {
timestamp: "=",
local: "="
},
link: function(scope) {
timeAgoSettings.ready.then(function() {
timeAgoTimer(DATE_GRANULARITY.DATETIME)
scope.$on('sn.TimeAgo.tick', setTimeAgo);
setTimeAgo();
});
function setTimeAgo() {
scope.timeAgo = timeAgoConverter(scope.timestamp, true, false);
scope.timeAgoVerbose = timeAgoConverter(scope.timestamp, true, true);
}
function timeAgoConverter(input, noFuture, verbose) {
if (!input)
return;
var allowFuture = !noFuture;
var date = timeAgo.parse(input);
if (scope.local) {
scope.titleTime = input;
return timeAgo.allowFuture(allowFuture).toWords(new Date() - date, 1, verbose);
}
if (Object.prototype.toString.call(date) !== "[object Date]" && Object.prototype.toString.call(date) !== "[object Number]")
return input;
else if (Object.prototype.toString.call(date) == "[object Date]" && isNaN(date.getTime()))
return input;
setTitleTime(date);
var currentDate = new Date();
currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate(), currentDate.getUTCHours(), currentDate.getUTCMinutes(), currentDate.getUTCSeconds() );
var diff = currentDate - date;
return timeAgo.allowFuture(allowFuture).toWords(diff, 1, verbose);
}
function setTitleTime(date) {
var t = date.getTime();
var o = date.getTimezoneOffset();
t -= o * 60 * 1000;
if (typeof g_user_date_time_format !== 'undefined' && g_user_date_time_format.indexOf('z') == -1)
scope.titleTime = dateUtils.formatDate(new Date(t), g_user_date_time_format);
else
scope.titleTime = new Date(t).toLocaleString();
}
}
}
});
angular.module('sn.common.datetime').directive("snTimeAgoStatic", function(timeAgoSettings, $rootScope, timeAgo, timeAgoTimer, DATE_GRANULARITY) {
"use strict";
return {
restrict: "E",
template: '<time title="{{ ::titleTime }}">{{timeAgo}}</time>',
scope: {
timestamp: "@",
local: "@"
},
link: function(scope) {
timeAgoSettings.ready.then(function() {
timeAgoTimer(DATE_GRANULARITY.DATETIME)
scope.$on('sn.TimeAgo.tick', setTimeAgo);
setTimeAgo();
});
function setTimeAgo() {
scope.timeAgo = timeAgoConverter(scope.timestamp, true);
}
function timeAgoConverter(input, noFuture) {
if (!input)
return;
var allowFuture = !noFuture;
var date = timeAgo.parse(input);
if (scope.local) {
scope.titleTime = input;
return timeAgo.allowFuture(allowFuture).toWords(new Date() - date);
}
if (Object.prototype.toString.call(date) !== "[object Date]" && Object.prototype.toString.call(date) !== "[object Number]")
return input;
else if (Object.prototype.toString.call(date) == "[object Date]" && isNaN(date.getTime()))
return input;
setTitleTime(date);
var currentDate = new Date();
currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate(), currentDate.getUTCHours(), currentDate.getUTCMinutes(), currentDate.getUTCSeconds() );
var diff = currentDate - date;
return timeAgo.allowFuture(allowFuture).toWords(diff);
}
function setTitleTime(date) {
var t = date.getTime();
var o = date.getTimezoneOffset();
t -= o * 60 * 1000;
scope.titleTime = new Date(t).toLocaleString();
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/datetime/directive.snDayAgo.js */
angular.module('sn.common.datetime').directive("snDayAgo", function(timeAgoSettings, $rootScope, timeAgo, timeAgoTimer, DATE_GRANULARITY) {
"use strict";
return {
restrict: "E",
template: '<time>{{dayAgo}}</time>',
scope: {
date: "="
},
link: function(scope) {
timeAgoSettings.ready.then(function() {
setDayAgo();
});
function setDayAgo() {
scope.dayAgo = dayAgoConverter(scope.date, "noFuture");
}
function dayAgoConverter(input, option) {
if (!input) return;
var allowFuture = !((option === 'noFuture') || (option === 'no_future'));
var date = timeAgo.parse(input);
if ( Object.prototype.toString.call(date) !== "[object Date]" )
return input;
else if ( isNaN(date.getTime()) )
return input;
var diff = timeAgoTimer(DATE_GRANULARITY.DATE) - date;
return timeAgo.allowFuture(allowFuture).toWords(diff, DATE_GRANULARITY.DATE);
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/datetime/snTimeAgoSettings.js */
angular.module('sn.common.datetime').provider('snTimeAgoSettings', function() {
"use strict";
var INIT_NEVER = 'never';
var INIT_AUTO = 'auto';
var INIT_MANUAL = 'manual';
var _initMethod = INIT_AUTO;
this.setInitializationMethod = function(init) {
switch (init) {
default:
init = INIT_AUTO;
case INIT_NEVER:
case INIT_AUTO:
case INIT_MANUAL:
_initMethod = init;
break;
}
};
this.$get = function(i18n, $q) {
var settings = {
allowFuture: true,
dateOnly: false,
strings: {}
};
var _initialized = false;
var ready = $q.defer();
function initialize() {
if (_initMethod === INIT_NEVER) {
return $q.reject();
}
if (!_initialized) {
_initialized = true;
i18n.getMessages(['%d ago', '%d from now', 'just now',
'%d minutes_verbose', 'about %d hours_verbose', '%d days_verbose', '%d months_verbose', '%d years_verbose',
'less than a minute', 'about a minute', '%d minutes', 'about an hour', 'about %d hours', 'today', 'a day', '%d days',
'about a month', '%d months', 'about a year', 'about a year', '%d years'], function (msgs) {
settings.strings = {
ago: msgs['%d ago'],
fromNow: msgs['%d from now'],
justNow: msgs["just now"],
seconds: msgs["less than a minute"],
minute: msgs["about a minute"],
minutes: msgs["%d minutes"],
hour: msgs["about an hour"],
hours: msgs["about %d hours"],
day: msgs["a day"],
days: msgs["%d days"],
month: msgs["about a month"],
months: msgs["%d months"],
year: msgs["about a year"],
years: msgs["%d years"],
today: msgs["today"],
wordSeparator: msgs["timeago_number_separator"],
numbers: []
};
settings.strings_verbose = Object.assign({}, settings.strings, {
minutes: msgs["%d minutes_verbose"],
hours: msgs["about %d hours_verbose"],
days: msgs["%d days_verbose"],
months: msgs["%d months_verbose"],
years: msgs["%d years_verbose"]
});
ready.resolve();
});
}
return ready.promise;
}
if (_initMethod === INIT_AUTO) {
initialize();
}
return {
initialize: initialize,
ready: ready.promise,
get: function get() {
return settings;
},
set: function set(translated) {
settings = angular.extend(settings, translated);
}
};
};
}).factory('timeAgoSettings', function(snTimeAgoSettings) {
return snTimeAgoSettings;
});
;
;
/*! RESOURCE: /scripts/sn/common/glide/js_includes_glide.js */
/*! RESOURCE: /scripts/sn/common/glide/_module.js */
angular.module('sn.common.glide', [
'sn.common.util'
]);
;
/*! RESOURCE: /scripts/sn/common/glide/factory.glideUrlBuilder.js */
angular.module('sn.common.glide').factory('glideUrlBuilder', ['$window', function($window) {
"use strict";
function GlideUrl(contextPath){
var objDef = {
contextPath: '',
params: {},
encodedString: '',
encode: true,
setFromCurrent: function() {
this.setFromString($window.location.href);
},
setFromString:function(href) {
var pos = href.indexOf('?');
if (pos < 0) {
this.contextPath = href;
return;
}
this.contextPath = href.slice(0, pos);
var hashes = href.slice(pos + 1).split('&');
var i = hashes.length;
while (i--) {
var pos = hashes[i].indexOf('=');
this.params[hashes[i].substring(0, pos)] = hashes[i].substring(++pos);
}
},
setContextPath: function(c) {
this.contextPath = c;
},
getParam: function(p) {
return this.params[p];
},
getParams: function() {
return this.params;
},
addParam: function(name, value) {
this.params[name] = value;
return this;
},
addToken: function() {
if (typeof g_ck != 'undefined' && g_ck != "")
this.addParam('sysparm_ck', g_ck);
return this;
},
deleteParam: function(name) {
delete this.params[name];
},
addEncodedString: function(s) {
if (!s)
return;
if (s.substr(0, 1) != "&")
this.encodedString += "&";
this.encodedString += s;
return this;
},
getQueryString: function(additionalParams) {
var qs = this._getParamsForURL(this.params);
qs += this._getParamsForURL(additionalParams);
qs += this.encodedString;
if (qs.length == 0)
return "";
return qs.substring(1);
},
_getParamsForURL: function(params) {
if (!params)
return '';
var url = '';
for (var n in params) {
var p = params[n] || '';
url += '&' + n + '=' + (this.encode ? encodeURIComponent(p + '') : p);
}
return url;
},
getURL: function(additionalParams) {
var url = this.contextPath;
var qs = this.getQueryString(additionalParams);
if (qs)
url += "?" + qs;
return url;
},
setEncode: function(b) {
this.encode = b;
},
toString: function() { return 'GlideURL'; }
}
return objDef;
}
return {
newGlideUrl: function(contextPath) {
var glideUrl = new GlideUrl();
glideUrl.setFromString(contextPath ? contextPath : '');
return glideUrl;
},
refresh: function(){
$window.location.replace( $window.location.href );
},
getCancelableLink: function(link) {
if ($window.NOW && $window.NOW.g_cancelPreviousTransaction) {
var nextChar = link.indexOf('?') > -1 ? '&' : '?';
link += nextChar + "sysparm_cancelable=true";
}
return link;
}
};
}]);
;
/*! RESOURCE: /scripts/sn/common/glide/service.queryFilter.js */
angular.module('sn.common.glide').factory('queryFilter', function() {
"use strict";
return {
create : function() {
var that = {};
that.conditions = [];
function newCondition(field, operator, value, label, displayValue, type){
var condition = {
field: field,
operator: operator,
value: value,
displayValue: displayValue,
label: label,
left: null,
right: null,
type: null,
setValue: function(value, displayValue){
this.value = value;
this.displayValue = displayValue ? displayValue : value;
}
};
if (type)
condition.type = type;
return condition;
}
function addCondition(condition) {
that.conditions.push(condition);
return condition;
}
function removeCondition(condition) {
for (var i = that.conditions.length-1; i >= 0; i--) {
if (that.conditions[i] === condition)
that.conditions.splice(i, 1);
}
}
function getConditionsByField(conditions, field){
var conditionsToReturn = [];
for(var condition in conditions){
if (conditions.hasOwnProperty(condition)){
if (conditions[condition].field == field)
conditionsToReturn.push(conditions[condition]);
}
}
return conditionsToReturn;
}
function encodeCondition(condition){
var output = "";
if (condition.hasOwnProperty("left") && condition.left){
output += encodeCondition(condition.left);
}
if (condition.hasOwnProperty("right") && condition.right){
var right = encodeCondition(condition.right);
if (right.length > 0){
output += "^" + condition.type + right;
}
}
if (condition.field){
output += condition.field;
output += condition.operator;
if (condition.value !== null && typeof condition.value !== "undefined")
output += condition.value;
}
return output;
}
function createEncodedQuery() {
var eq = "";
var ca = that.conditions;
for (var i = 0; i < ca.length; i++) {
var condition = ca[i];
if (eq.length)
eq += '^';
eq += encodeCondition(condition);
}
eq += "^EQ";
return eq;
}
that.addCondition = addCondition;
that.newCondition = newCondition;
that.createEncodedQuery = createEncodedQuery;
that.getConditionsByField = getConditionsByField;
that.removeCondition = removeCondition;
return that;
}
};
});
;
/*! RESOURCE: /scripts/sn/common/glide/service.filterExpressionParser.js */
angular.module('sn.common.glide').factory('filterExpressionParser', function() {
'use strict';
var operatorExpressions = [{
wildcardExp: '(.*)',
operator: 'STARTSWITH',
toExpression: function(filter) {
return filter;
}
},{
wildcardExp: '^\\*(.*)',
operator: 'LIKE',
toExpression: function(filter) {
return (filter === '*' ? filter : '*' + filter);
}
},{
wildcardExp: '^\\.(.*)',
operator: 'LIKE',
toExpression: function(filter) {
return '.' + filter;
}
},{
wildcardExp: '^%(.*)',
operator: 'ENDSWITH',
toExpression: function(filter) {
return (filter === '%' ? filter : '%' + filter);
}
},{
wildcardExp: '(.*)%',
operator: 'LIKE',
toExpression: function(filter) {
return filter + '%';
}
},{
wildcardExp: '^=(.*)',
operator: '=',
toExpression: function(filter) {
return (filter === '=' ? filter : '=' + filter);
}
},{
wildcardExp: '^!\\*(.*)',
operator: 'NOT LIKE',
toExpression: function(filter) {
return (filter === '!*' || filter === '!' ? filter : '!*' + filter);
}
},{
wildcardExp: '^!=(.*)',
operator: '!=',
toExpression: function(filter) {
return (filter === '!=' || filter === '!' ? filter : '!=' + filter);
}
}];
return {
getOperatorExpressionForOperator: function(operator) {
for (var i = 0; i < operatorExpressions.length; i++) {
var item = operatorExpressions[i];
if (item.operator === operator)
return item;
}
throw {
name: 'OperatorNotSupported',
message: 'The operator ' + operator + ' is not in the list of operatorExpressions.'
};
},
parse: function(val, defaultOperator) {
var parsedValue = {
filterText: val,
operator: defaultOperator || 'STARTSWITH'
};
for (var i = 1; i < operatorExpressions.length; i++) {
var operatorItem = operatorExpressions[i];
var match = val.match(operatorItem.wildcardExp);
if (match && match[1] !== '') {
parsedValue.operator = operatorItem.operator;
parsedValue.filterText = match[1];
}
}
return parsedValue;
}
};
});
;
/*! RESOURCE: /scripts/sn/common/glide/service.userPreferences.js */
angular.module('sn.common.glide').factory("userPreferences", function ($http, $q, unwrappedHTTPPromise, urlTools) {
"use strict";
var	preferencesCache = {};
function getPreference(preferenceName) {
if (preferenceName in preferencesCache)
return preferencesCache[preferenceName];
var targetURL = urlTools.getURL('user_preference', {
"sysparm_pref_name": preferenceName,
"sysparm_action": "get"
}),
deferred = $q.defer();
$http.get(targetURL).success(function (response) {
deferred.resolve(response.sysparm_pref_value);
}).error(function (data, status) {
deferred.reject("Error getting preference " + preferenceName + ": " + status);
});
preferencesCache[preferenceName] = deferred.promise;
return deferred.promise;
}
function setPreference(preferenceName, preferenceValue) {
var preferenceValueString = "" + preferenceValue;
var parmsObj = {
"sysparm_pref_name": preferenceName,
"sysparm_action": "set"
};
var useGet = preferenceValueString.length <= 1024;
if (useGet)
parmsObj["sysparm_pref_value"] = preferenceValueString;
var targetURL = urlTools.getURL('user_preference', parmsObj);
var httpPromise = useGet ? $http.get(targetURL) : $http.post(targetURL, {'sysparm_pref_value': preferenceValueString});
addToCache(preferenceName, preferenceValue);
return unwrappedHTTPPromise(httpPromise);
}
function addToCache(preferenceName, preferenceValue){
preferencesCache[preferenceName] = $q.when(preferenceValue);
}
var userPreferences = {
getPreference: getPreference,
setPreference: setPreference,
addToCache: addToCache
};
return userPreferences;
});
;
/*! RESOURCE: /scripts/sn/common/glide/service.nowStream.js */
angular.module('sn.common.glide').constant('nowStreamTimerInterval', 5000);
angular.module('sn.common.glide').factory('nowStream', function($q, amb, $timeout, urlTools, nowStreamTimerInterval, snResource, snCustomEvent, $log) {
'use strict';
var AMB_CHANNEL = '/history/update';
amb.connect();
var Stream = function() {
this.initialize.apply(this, arguments);
};
Stream.prototype = {
initialize: function(table, query, sys_id, processor, interval, source, includeAttachments) {
this.table = table;
this.query = query;
this.sysparmQuery = null;
this.sys_id = sys_id;
this.processor = processor;
this.lastTimestamp = 0;
this.inflightRequest = null;
this.requestImmediateUpdate = false;
this.interval = interval;
this.source = source;
this.includeAttachments = includeAttachments;
this.stopped = true;
var name = AMB_CHANNEL + '/' + table + '/' + sys_id;
this.ambChannel = amb.getChannel(name).subscribe(this.tap.bind(this));
},
setQuery: function(sysparmQuery) {
this.sysparmQuery = sysparmQuery;
},
poll: function(callback, preRequestCallback) {
this.callback = callback;
this.preRequestCallback = preRequestCallback;
this._stopPolling();
this._startPolling();
},
tap: function() {
if (!this.inflightRequest) {
this._stopPolling();
this._startPolling();
}
else
this.requestImmediateUpdate = true;
},
insert: function(field, text) {
this.insertForEntry(field, text, this.table, this.sys_id);
},
insertForEntry: function(field, text, table, sys_id) {
return this.insertEntries([{
field: field,
text: text
}], table, sys_id);
},
expandMentions: function (entryText, mentionIDMap) {
var text = entryText;
Object.getOwnPropertyNames(mentionIDMap).forEach(function(element) {
var atMention = element.replace(/[.*+\-?^()|[\]\\]/g, '\\$&');
var search = new RegExp("@\\[" + atMention + "\\]", "gi");
var sysId = mentionIDMap[element];
text = text.replace(search, "@[" + sysId + ":" + element + "]");
});
return text;
},
addCarriageReturns: function(entryText) {
return entryText.replace(/\r*\n/g, '\r\n');
},
insertEntries: function(entries, table, sys_id, mentionIDMap) {
mentionIDMap = mentionIDMap || {};
var sanitizedEntries = [];
for (var i = 0; i < entries.length; i++) {
var entryText = entries[i].text;
if (entryText && entryText.endsWith('\n'))
entryText = entryText.substring(0, entryText.length - 1);
if (!entryText)
continue;
entries[i].text = this.addCarriageReturns(this.expandMentions(entryText, mentionIDMap));
sanitizedEntries.push(entries[i]);
}
if (sanitizedEntries.length === 0)
return;
this._isInserting = true;
var url = this._getInsertURL(table, sys_id);
var that = this;
return snResource().post(url, {
entries: sanitizedEntries
}).then(this._successCallback.bind(this), function() {
$log.warn('Error submitting entries', sanitizedEntries);
}).then(function() {
that._isInserting = false;
});
},
cancel: function() {
this._stopPolling();
this.ambChannel.unsubscribe();
},
_startPolling : function() {
var interval = this._getInterval();
var that = this;
var successCallback = this._successCallback.bind(this);
that.stopped = false;
function runPoll() {
if (that._isInserting) {
establishNextRequest();
return;
}
if (!that.inflightRequest) {
that.inflightRequest = that._executeRequest();
that.inflightRequest.then(successCallback);
that.inflightRequest.finally(function() {
that.inflightRequest = null;
if (that.requestImmediateUpdate) {
that.requestImmediateUpdate = false;
establishNextRequest(0);
}
else {
establishNextRequest();
}
});
}
}
function establishNextRequest(intervalOverride) {
if (that.stopped)
return;
intervalOverride = (parseFloat(intervalOverride) >= 0) ? intervalOverride : interval;
$timeout.cancel(that.timer);
that.timer = $timeout(runPoll, intervalOverride);
}
runPoll();
},
_stopPolling : function() {
if (this.timer)
$timeout.cancel(this.timer);
this.stopped = true;
},
_executeRequest: function() {
var url = this._getURL();
if (this.preRequestCallback) {
this.preRequestCallback();
}
return snResource().get(url);
},
_getURL: function() {
var params = {
table: this.table,
action: this._getAction(),
sysparm_silent_request: true,
sysparm_auto_request: true,
sysparm_timestamp: this.lastTimestamp,
include_attachments: this.includeAttachments
};
if (this.sys_id) {
params['sys_id'] = this.sys_id;
} else if (this.sysparmQuery) {
params['sysparm_query'] = this.sysparmQuery;
}
var url = urlTools.getURL(this.processor, params);
if (!this.sys_id) {
url += "&p=" + this.query;
}
return url;
},
_getInsertURL: function(table, sys_id) {
return urlTools.getURL(this.processor, {
action: 'insert',
table: table,
sys_id: sys_id,
sysparm_timestamp: this.timestamp || 0,
sysparm_source: this.source
});
},
_successCallback: function(response) {
var response = response.data;
if (response.entries && response.entries.length) {
response.entries = this._filterOld(response.entries);
if (response.entries.length > 0) {
this.lastEntry = angular.copy(response.entries[0]);
this.lastTimestamp = response.sys_timestamp || response.entries[0].sys_timestamp;
}
}
this.callback.call(null, response);
},
_filterOld: function(entries) {
for (var i = 0; i < entries.length; i++) {
if (entries[i].sys_timestamp == this.lastTimestamp) {
if (this.lastEntry) {
if (!angular.equals(this._makeComparable(entries[i]), this._makeComparable(this.lastEntry)))
continue;
if (entries[i].attachment)
snCustomEvent.fire('sn.stream.attachment_state_updated', entries[i]);
}
}
if (entries[i].sys_timestamp <= this.lastTimestamp)
return entries.slice(0, i);
}
return entries;
},
_makeComparable: function(entry) {
var copy = angular.copy(entry);
delete copy.short_description;
delete copy.display_value;
if (copy.attachment)
delete copy.attachment.state;
return copy;
},
_getAction: function() {
return this.sys_id ? 'get_new_entries' : 'get_set_entries';
},
_getInterval: function() {
if (this.interval)
return this.interval;
else if (window.NOW && NOW.stream_poll_interval)
return NOW.stream_poll_interval * 1000;
else
return nowStreamTimerInterval;
}
};
return {
create: function(table, query, sys_id, processor, interval, source) {
return new Stream(table, query, sys_id, processor, interval, source);
}
};
});
;
/*! RESOURCE: /scripts/sn/common/glide/service.nowServer.js */
angular.module('sn.common.glide').factory('nowServer', function($http, $q, userPreferences, angularProcessorUrl, urlTools) {
return {
getBaseURL: function () {
return angularProcessorUrl;
},
getPartial: function(scope, partial, parms, callback) {
var url = this.getPartialURL(partial, parms);
if (url === scope.url) {
callback.call();
return;
}
var fn = scope.$on('$includeContentLoaded', function() {
fn.call();
callback.call();
});
scope.url = url;
},
replaceView: function($location, newView) {
var p = $location.path();
var a = p.split("/");
a[1] = newView;
p = a.join("/");
return p;
},
getPartialURL: urlTools.getPartialURL,
getURL: urlTools.getURL,
urlFor : urlTools.urlFor,
getPropertyURL: urlTools.getPropertyURL,
setPreference: userPreferences.setPreference,
getPreference: userPreferences.getPreference
}
});
;
;
/*! RESOURCE: /scripts/sn/common/avatar/js_includes_avatar.js */
/*! RESOURCE: /scripts/sn/common/presence/js_includes_presence.js */
/*! RESOURCE: /scripts/js_includes_ng_amb.js */
/*! RESOURCE: /scripts/js_includes_amb.js */
/*! RESOURCE: /scripts/glide-amb-client-bundle.min.js */
!function(e){var n={};function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=11)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=t(1))&&i.__esModule?i:{default:i};var o=function(e){function n(n){window.console&&console.log(e+" "+n)}return{debug:function(e){"debug"===r.default.logLevel&&n("[DEBUG] "+e)},addInfoMessage:function(e){n("[INFO] "+e)},addErrorMessage:function(e){n("[ERROR] "+e)},addWarnMessage:function(e){n("[WARN] "+e)}}};n.default=o},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.TOKEN_MANAGEMENT_EXTENSION=n.WEBSOCKET_TYPE_NAME=void 0;n.WEBSOCKET_TYPE_NAME="websocket";n.TOKEN_MANAGEMENT_EXTENSION="tokenManagementExtension";var i={servletPath:"amb",logLevel:"info",loginWindow:"true",wsConnectTimeout:1e4,overlayStyle:"",subscribeCommandsFlow:{enable:!1,maxInflight:1,maxWait:1e4,retries:3,retryDelay:{min:2e3,max:3e5,increaseFactor:2}}};n.default=i},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=t(0))&&i.__esModule?i:{default:i};var o=function(e,n,t){var i,o,s=new r.default("amb.ChannelListener"),a=e;return{getCallback:function(){return o},getSubscriptionCallback:function(){return t},getID:function(){return i},setNewChannel:function(e){a.unsubscribe(this),a=e,this.subscribe(o)},subscribe:function(e){return o=e,i=a.subscribe(this),this},resubscribe:function(){return this.subscribe(o)},unsubscribe:function(){return a.unsubscribe(this),s.debug("Unsubscribed from channel: "+a.getName()),this},publish:function(e){a.publish(e)},getName:function(){return a.getName()}}};n.default=o},function(e,n,t){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.isEmptyObject=n.isObject=n.isNil=n.isNull=n.isUndefined=void 0;var r=function(e){return void 0===e};n.isUndefined=r;var o=function(e){return null===e};n.isNull=o;n.isNil=function(e){return o(e)||r(e)};var s=function(e){return null!=e&&"object"===i(e)};n.isObject=s;n.isEmptyObject=function(e){return s(e)&&0===Object.keys(e).length}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=function(e){var n=[],t=0;return{subscribe:function(e,i){var r=t++;return n.push({event:e,callback:i,id:r}),r},unsubscribe:function(e){for(var t=0;t<n.length;t++)e===n[t].id&&n.splice(t,1)},publish:function(e,n){for(var t=this._getSubscriptions(e),i=0;i<t.length;i++)t[i].callback.apply(null,n)},getEvents:function(){return e},_getSubscriptions:function(e){for(var t=[],i=0;i<n.length;i++)n[i].event===e&&t.push(n[i]);return t}}};n.default=i},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=h(t(4)),r=h(t(0)),o=function(e){if(e&&e.__esModule)return e;var n=d();if(n&&n.has(e))return n.get(e);var t={};if(null!=e){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(t,r,o):t[r]=e[r]}}t.default=e,n&&n.set(e,t);return t}(t(1)),s=h(t(6)),a=h(t(7)),u=h(t(19)),c=t(3),l=h(t(20)),f=h(t(21));function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function h(e){return e&&e.__esModule?e:{default:e}}var g=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new u.default,t=!1,d=!1,h=new i.default({CONNECTION_INITIALIZED:"connection.initialized",CONNECTION_OPENED:"connection.opened",CONNECTION_CLOSED:"connection.closed",CONNECTION_BROKEN:"connection.broken",SESSION_LOGGED_IN:"session.logged.in",SESSION_LOGGED_OUT:"session.logged.out",SESSION_INVALIDATED:"session.invalidated",SESSION_REESTABLISHED:"session.reestablished"}),g={SESSION_LOGGED_IN:"session.logged.in",SESSION_LOGGED_OUT:"session.logged.out",SESSION_INVALIDATED:"session.invalidated"},b="closed",p={},m=new r.default("amb.ServerConnection");!function(){e.addListener("/meta/handshake",this,A),e.addListener("/meta/connect",this,G),e.addListener("/meta/subscribe",this,U),e.addListener("/meta/unsubscribe",this,U)}();var v=g.SESSION_INVALIDATED,y=null,_="true"===o.default.loginWindow,C=null,w={UNKNOWN_CLIENT:"402::Unknown client"},T=!1,S={},E=!1,x=new s.default(e,S),k=!1,O="glide.amb.session.logout.overlay.style",N="glide.session.status",I="session.touch.http",L="amb.ServerConnection.reestablish.session",M=e.getExtension(o.TOKEN_MANAGEMENT_EXTENSION),D=null;function A(e){U(e);var n=R(e,O);n&&(o.default.overlayStyle=n),v=R(e,N),function(e){if(e.ext){var n=e.ext.subscribeCommandsFlow;if(n){var t,i,r,s=o.default.subscribeCommandsFlow;if(o.default.subscribeCommandsFlow.enable=(t=n.enable,i=s.enable,r=i,(0,c.isNil)(t)||(r=!!t),r),o.default.subscribeCommandsFlow.enable){o.default.subscribeCommandsFlow.retries=P(n.retries,s.retries),o.default.subscribeCommandsFlow.maxInflight=P(n.maxInflight,s.maxInflight),o.default.subscribeCommandsFlow.maxWait=P(n.maxWait,s.maxWait);var a=n.retryDelay;if(a){var u=o.default.subscribeCommandsFlow.retryDelay;o.default.subscribeCommandsFlow.retryDelay.min=P(a.min,u.min),o.default.subscribeCommandsFlow.retryDelay.max=P(a.max,u.max),o.default.subscribeCommandsFlow.retryDelay.increaseFactor=P(a.increaseFactor,u.increaseFactor)}}o.default.subscribeCommandsFlow.enable&&(m.addInfoMessage("_initializeSubscriptionCommandSender: SubscriptionCommandSender is enabled"),null!=M&&M.updateTokenCount(o.default.subscribeCommandsFlow.maxInflight),D&&D.stop(),D=new f.default(new l.default(1e4),M))}}}(e),setTimeout(function(){e.successful&&W()},0)}function R(e,n){if((0,c.isObject)(e.ext))return e.ext[n]}function F(n,t){if(n in p)return p[n];var i=new a.default(e,n,k,t);return p[n]=i,i}function B(e){delete p[e]}function U(n){if(n.ext){!1===n.ext["glide.amb.active"]&&S.disconnect();var t=R(n,"glide.amb.client.log.level");t&&(o.default.logLevel=t,e.setLogLevel(o.default.logLevel))}}function P(e,n){var t=Math.floor(parseInt(e));return(isNaN(t)||t<0)&&(t=n),t}function j(){for(var e in m.debug("Resubscribing to all!"),p){var n=p[e];n&&n.resubscribeToCometD()}}function q(){for(var e in m.debug("Unsubscribing from all!"),p){var n=p[e];n&&n.unsubscribeFromCometD()}}function G(n){if(U(n),d)setTimeout(function(){t=!1,m.debug("Connection closed"),b="closed",X(h.getEvents().CONNECTION_CLOSED)},0);else{var i=R(n,I);o.WEBSOCKET_TYPE_NAME===e.getTransport().getType()&&!0===i&&S._touchHttpSession();var r=n.error;r&&(C=r),function(e){var n=R(e,N);n&&n!==v&&(T=!0===R(e,"glide.amb.login.window.override"),Q(n))}(n);var s=t;t=!0===n.successful,!s&&t?H():s&&!t&&(m.addErrorMessage("Connection broken"),b="broken",E=!0,X(h.getEvents().CONNECTION_BROKEN),D&&(D.stop(),D=null))}}function W(){m.debug("Connection initialized"),k=!0,b="initialized",X(h.getEvents().CONNECTION_INITIALIZED)}function H(){m.debug("Connection opened"),E?S.getLastError()===S.getErrorMessages().UNKNOWN_CLIENT&&(S.setLastError(null),S._sendSessionSetupRequest(function(e){var n=e.status;200===n&&(E=!1,x.initialize(z))})):x.initialize(z)}function z(){j(),b="opened",X(h.getEvents().CONNECTION_OPENED)}function Q(e){m.debug("session.status - "+e),function(e){return(v===g.SESSION_LOGGED_IN||v===g.SESSION_LOGGED_OUT)&&e===g.SESSION_INVALIDATED}(e)?(m.debug("INVALIDATED event fire!"),q(),X(h.getEvents().SESSION_INVALIDATED)):function(e){return v===g.SESSION_LOGGED_IN&&e===g.SESSION_LOGGED_OUT}(e)?(m.debug("LOGGED_OUT event fire!"),q(),X(h.getEvents().SESSION_LOGGED_OUT),_&&!T&&S.loginShow()):function(e){return v===g.SESSION_INVALIDATED&&e===g.SESSION_LOGGED_OUT}(e)?(m.debug("REESTABLISHED event fire!"),j(),X(h.getEvents().SESSION_REESTABLISHED)):function(e){return(v===g.SESSION_INVALIDATED||v===g.SESSION_LOGGED_OUT)&&e===g.SESSION_LOGGED_IN}(e)&&(m.debug("LOGGED_IN event fire!"),j(),X(h.getEvents().SESSION_LOGGED_IN),S.loginHide()),v=e}function X(e){try{h.publish(e)}catch(n){m.addErrorMessage("error publishing '"+e+"' - "+n)}}return S.connect=function(){t?m.debug(">>> connection exists, request satisfied"):(m.debug("Connecting to glide amb server -> "+o.default.servletURI),e.configure({url:S.getURL(o.default.servletPath),logLevel:o.default.logLevel,connectTimeout:o.default.wsConnectTimeout}),e.handshake(),n.on(L,function(){S._reestablishSession(!1)}))},S.reload=function(){e.reload()},S.abort=function(){e.getTransport().abort()},S.disconnect=function(){m.debug("Disconnecting from glide amb server.."),d=!0,e.disconnect()},S.getURL=function(e){return window.location.protocol+"//"+window.location.host+"/"+e},S.unsubscribeAll=function(){q()},S.resubscribeAll=function(){j()},S.removeChannel=function(e){B(e)},S.getEvents=function(){return h.getEvents()},S.getConnectionState=function(){return b},S.getLastError=function(){return C},S.setLastError=function(e){C=e},S.getErrorMessages=function(){return w},S.isLoggedIn=function(){return v===g.SESSION_LOGGED_IN},S.isSessionActive=function(){return v!==g.SESSION_INVALIDATED},S.getChannelRedirect=function(){return x},S.getChannel=function(e,n){return F(e,n)},S.getChannels=function(){return p},S.getState=function(){return b},S.getLoginWindowOverlayStyle=function(){return o.default.overlayStyle},S.loginShow=function(){m.debug("Show login window");var e='<iframe src="/amb_login.do" frameborder="0" height="400px" width="405px" scrolling="no"></iframe>',n='<div id="amb_disconnect_modal" tabindex="-1" aria-hidden="true" class="modal" role="dialog" style="'.concat(o.default.overlayStyle,'">\n\t\t\t\t<div class="modal-dialog small-modal" style="width:450px">\n\t\t\t\t   <div class="modal-content">\n\t\t\t\t\t  <header class="modal-header">\n\t\t\t\t\t\t <h4 id="small_modal1_title" class="modal-title">Login</h4>\n\t\t\t\t\t  </header>\n\t\t\t\t\t  <div class="modal-body">\n\t\t\t\t\t  </div>\n\t\t\t\t   </div>\n\t\t\t\t</div>\n\t\t\t</div>');try{var t=new GlideModal("amb_disconnect_modal");t.renderWithContent?(t.template=n,t.renderWithContent(e)):(t.setBody(e),t.render()),y=t}catch(e){m.debug(e)}},S.loginHide=function(){y&&(y.destroy(),y=null)},S.loginComplete=function(){S.reestablishSession()},S.reestablishSession=function(){S._reestablishSession(!0)},S.subscribeToEvent=function(e,n){return h.getEvents().CONNECTION_OPENED===e&&t&&n(),h.subscribe(e,n)},S.unsubscribeFromEvent=function(e){h.unsubscribe(e)},S.isLoginWindowEnabled=function(){return _},S.setLoginWindowEnabled=function(e){_=e},S.isLoginWindowOverride=function(){return T},S.getSubscriptionCommandSender=function(){return D},S._metaConnect=G,S._metaHandshake=A,S._sendSessionSetupRequest=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=function(){m.debug("sending /amb_session_setup.do!");var n=new XMLHttpRequest;return n.open("POST","/amb_session_setup.do",!0),n.setRequestHeader("Content-type","application/json;charset=UTF-8"),n.setRequestHeader("X-UserToken",window.g_ck),n.setRequestHeader("X-CometD_SessionID",e.getClientId()),n}();t.onload=function(){return n(t)},t.send()},S._onChannelRedirectSubscriptionComplete=z,S._getChannel=F,S._removeChannel=B,S._connectionInitialized=W,S._connectionOpened=H,S._reestablishSession=function(e){S._sendSessionSetupRequest(function(e){var n=e.response;n&&Q(JSON.parse(n)["glide.session.status"])}),e&&n.emit(L,L)},S._touchHttpSession=function(){var e=new XMLHttpRequest;e.open("POST","/amb",!0),e.setRequestHeader("Content-type","application/json"),e.send()},S};n.default=g},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=o(t(0)),r=o(t(2));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e,n){var t,o=e,s=new i.default("amb.ChannelRedirect");function a(e){s.debug("_onAdvice:"+e.data.clientId);var t=n.getChannel(e.data.fromChannel),i=n.getChannel(e.data.toChannel);t&&i?(function(e,n){for(var t=e.getChannelListeners(),i=0;i<t.length;i++)t[i].setNewChannel(n)}(t,i),s.debug("published channel switch event, fromChannel:"+t.getName()+", toChannel:"+i.getName())):s.debug("Could not redirect from "+e.data.fromChannel+" to "+e.data.toChannel)}return{initialize:function(e){var i="/sn/meta/channel_redirect/"+o.getClientId(),u=n.getChannel(i);t&&u===t?t.subscribeToCometD():(t&&n.removeChannel(t.getName()),t=u,new r.default(t,n,e).subscribe(a)),s.debug("ChannelRedirect initialized: "+i)},_onAdvice:a}};n.default=s},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=s(t(0)),r=t(3),o=s(t(8));function s(e){return e&&e.__esModule?e:{default:e}}var a=function(e,n,t){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return{}},a=null,u=null,c=[],l=[],f=new i.default("amb.Channel"),d=0,h=t;function g(){return(0,o.default)().getServerConnection().getSubscriptionCommandSender()}return{subscribe:function(e){if(e.getCallback()){for(var t=0;t<c.length;t++)if(c[t]===e)return f.debug("Channel listener already in the list"),e.getID();c.push(e);var i=e.getSubscriptionCallback();if(i&&(u?i(u):l.push(i)),!a&&h)try{this.subscribeToCometD()}catch(e){return void f.addErrorMessage(e)}return++d}f.addErrorMessage("Cannot subscribe to channel: "+n+", callback not provided")},resubscribe:function(){a=null;for(var e=0;e<c.length;e++)c[e].resubscribe()},_handleResponse:function(e){for(var n=0;n<c.length;n++)c[n].getCallback()(e)},unsubscribe:function(t){if(t){for(var i=0;i<c.length;i++)if(c[i].getID()===t.getID()){c.splice(i,1);break}var r;c.length<1&&a&&"disconnecting"!==(r=e.getStatus())&&"disconnected"!==r&&this.unsubscribeFromCometD()}else f.addErrorMessage("Cannot unsubscribe from channel: "+n+", listener argument does not exist")},publish:function(t){e.publish(n,t)},subscribeToCometD:function(){f.debug("subscribeToCometD channelName : "+n+", subscription : "+a),g()?g().subscribeToChannel(this):this._subscribeToCometD(this.subscriptionCallback)},_subscribeToCometD:function(t){f.debug("_subscribeToCometD channelName : "+n);var i=s();if((0,r.isNil)(i)||(0,r.isEmptyObject)(i))a=e.subscribe(n,this._handleResponse.bind(this),t);else{var o={subscribeOptions:i};a=e.subscribe(n,this._handleResponse.bind(this),o,t)}f.debug("Successfully subscribed to channel: "+n+", Subscribe options: "+i)},subscriptionCallback:function(e){f.debug("Cometd subscription callback completed for channel: "+n),f.debug("Listener callback queue size: "+l.length),u=e,l.map(function(e){e(u)}),l=[]},unsubscribeFromCometD:function(){f.debug("unsubscribeFromCometD  from : "+n+", subscription : "+a),null!==a&&(g()?g().unsubscribeToChannel(this):this._unsubscribeFromCometD())},_unsubscribeFromCometD:function(){f.debug("_unsubscribeFromCometD  from : "+n+", subscription : "+a),null!==a&&(e.unsubscribe(a),a=null,u=null,f.debug("Successfully unsubscribed from channel: "+n))},resubscribeToCometD:function(){f.debug("Resubscribe to "+n),g()?g().subscribeToChannel(this):this._subscribeToCometD(this.subscriptionCallback)},getSubscribeOptionsCallback:function(){return s},getName:function(){return n},getChannelListeners:function(){return c},getListenerCallbackQueue:function(){return l},setSubscriptionCallbackResponse:function(e){u=e}}};n.default=a},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=s(t(9)),r=s(t(17)),o=s(t(18));function s(e){return e&&e.__esModule?e:{default:e}}function a(e){return e.MSInputMethodContext&&e.document.documentMode}function u(e,n){if(void 0!==e.getClientWindow&&e.getClientWindow()===n)return e;var t=function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e}({},e);return t.getChannel=function(t,i,r){return e.getChannel(t,i,r||n)},t.getRecordWatcherChannel=function(t,i,r,o,s){return e.getRecordWatcherChannel(t,i,r,o,s||n)},t.subscribeToEvent=function(t,i,r){return e.subscribeToEvent(t,i,r||n)},t.unsubscribeFromEvent=function(t,i){return e.unsubscribeFromEvent(t,i||n)},t.getClientWindow=function(){return n},t}var c=function(){var e=function(e){try{if(!a(e))for(;e!==e.parent&&!e.g_ambClient;)e=e.parent;if(e.g_ambClient)return e.g_ambClient}catch(e){console.log("AMB getClient() tried to access parent from an iFrame. Caught error: "+e)}return null}(window);e||function(e){var n=window.self;n.g_ambClient=e,n.addEventListener("unload",function(){n.g_ambClient.disconnect()});var t,i,r=!(!n.NOW||!n.NOW.hasOwnProperty("deferAmbConnection"))&&n.NOW.deferAmbConnection,o=n.NOW&&n.NOW.hasOwnProperty("deferredAmbConnectionTimeout")&&(t=n.NOW.deferredAmbConnectionTimeout,i=t,parseInt(i,10)===i&&t>0)?n.NOW.deferredAmbConnectionTimeout:1e4;if(r)n.setTimeout(u,o);else{var s=n.document?n.document.readyState:null;"complete"===s?u():n.addEventListener("load",u),n.setTimeout(u,1e4)}var a=!1;function u(){a||(a=!0,n.g_ambClient.connect())}}(e=u(function(e){return n=new i.default,t=function(){var e=[];function n(e,n,i){if(e&&i){var r=t(e);if(r)for(var o=r.subscriptions,s=o.length-1;s>=0;s--)o[s].id===n&&o[s].callback===i&&o.splice(s,1)}}function t(n){for(var t=0,i=e.length;t<i;t++)if(e[t].window===n)return e[t];return null}function i(n){var t={window:n,onUnload:function(){t.unloading=!0;for(var n,i=t.subscriptions;n=i.pop();)n.unsubscribe();!function(n){for(var t=0,i=e.length;t<i;t++)if(e[t].window===n.window){e.splice(t,1);break}n.subscriptions=[],n.window.removeEventListener("unload",n.onUnload),n.onUnload=null,n.window=null}(t)},unloading:!1,subscriptions:[]};return n.addEventListener("unload",t.onUnload),e.push(t),t}return{add:function(e,r,o,s){if(e&&o&&s){n(e,r,o);var a=t(e);a||(a=i(e)),a.unloading||a.subscriptions.push({id:r,callback:o,unsubscribe:s})}},remove:n}}(),s=n.getServerConnection(),e&&s.setLoginWindowEnabled(!1),{getServerConnection:function(){return s},connect:function(){n.connect()},abort:function(){n.abort()},disconnect:function(){n.disconnect()},getConnectionState:function(){return n.getConnectionState()},getState:function(){return n.getConnectionState()},getClientId:function(){return n.getClientId()},getChannel:function(e,i,r){var o=n.getChannel(e,i),a=o.subscribe,u=o.unsubscribe;return r=r||window,o.subscribe=function(e){return t.add(r,o,e,function(){o.unsubscribe(e)}),a.call(o,e),o},o.unsubscribe=function(i){t.remove(r,o,i);var a=u.call(o,i);return 0===s.getChannel(e).getChannelListeners().length&&n.removeChannel(e),a},o},getChannel0:function(e,t){return n.getChannel(e,t)},getRecordWatcherChannel:function(e,n,t,i,s){var a=r.default.stringify(o.default.parse(n)).replace(/=/g,"-");return t=t||"default",this.getChannel("/rw/"+t+"/"+e+"/"+a,i,s)},registerExtension:function(e,t){n.registerExtension(e,t)},unregisterExtension:function(e){n.unregisterExtension(e)},batch:function(e){n.batch(e)},subscribeToEvent:function(e,i,r){r=r||window;var o=n.subscribeToEvent(e,i);return t.add(r,o,!0,function(){n.unsubscribeFromEvent(o)}),o},unsubscribeFromEvent:function(e,i){i=i||window,t.remove(i,e,!0),n.unsubscribeFromEvent(e)},isLoggedIn:function(){return n.isLoggedIn()},getConnectionEvents:function(){return n.getConnectionEvents()},getEvents:function(){return n.getConnectionEvents()},reestablishSession:function(){n.reestablishSession()},loginComplete:function(){n.loginComplete()},getChannels:function(){return n.getChannels()},extendSession:function(){return n.extendSession()},getTokenManagementExtension:function(){return n.getTokenManagementExtension()}};var n,t,s}(a(window)&&null!==window.frameElement),window));return u(e,window)};n.default=c},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=f(t(13)),r=f(t(5)),o=f(t(0)),s=f(t(2)),a=f(t(14)),u=t(1),c=f(t(15)),l=f(t(16));function f(e){return e&&e.__esModule?e:{default:e}}var d=function(){var e=new i.default.CometD;e.registerTransport(u.WEBSOCKET_TYPE_NAME,new i.default.WebSocketTransport,0),e.registerTransport("long-polling",new i.default.LongPollingTransport,1),e.unregisterTransport("callback-polling");var n=new a.default;e.registerExtension("graphQLSubscription",n);var t=new c.default;e.registerExtension("sessionExtension",t);var f=new l.default;e.registerExtension(u.TOKEN_MANAGEMENT_EXTENSION,f);var d=new r.default(e),h=new o.default("amb.MessageClient"),g=!1;return{getServerConnection:function(){return d},isLoggedIn:function(){return d.isLoggedIn()},loginComplete:function(){d.loginComplete()},reestablishSession:function(){d.reestablishSession()},connect:function(){g?h.addInfoMessage(">>> connection exists, request satisfied"):(g=!0,d.connect())},reload:function(){g=!1,d.reload()},abort:function(){g=!1,d.abort()},disconnect:function(){g=!1,d.disconnect()},isConnected:function(){return g},getConnectionEvents:function(){return d.getEvents()},subscribeToEvent:function(e,n){return d.subscribeToEvent(e,n)},unsubscribeFromEvent:function(e){d.unsubscribeFromEvent(e)},getConnectionState:function(){return d.getConnectionState()},getClientId:function(){return e.getClientId()},getChannel:function(e,t){var i=t||{},r=i.subscriptionCallback,o=i.serializedGraphQLSubscription,a=i.subscribeOptionsCallback,u=d.getChannel(e,a);return n.isGraphQLChannel(e)&&(o?n.addGraphQLChannel(e,o):h.addErrorMessage("Serialized subscription not present for GraphQL channel "+e)),new s.default(u,d,r)},removeChannel:function(e){d.removeChannel(e),n.isGraphQLChannel(e)&&n.removeGraphQLChannel(e)},getChannels:function(){return d.getChannels()},extendSession:function(){t.extendSession()},getTokenManagementExtension:function(){return f},registerExtension:function(n,t){e.registerExtension(n,t)},unregisterExtension:function(n){e.unregisterExtension(n)},batch:function(n){e.batch(n)}}};n.default=d},function(e,n,t){var i;i=function(){var e=e||function(e,n){var t=Object.create||function(){function e(){}return function(n){var t;return e.prototype=n,t=new e,e.prototype=null,t}}(),i={},r=i.lib={},o=r.Base={extend:function(e){var n=t(this);return e&&n.mixIn(e),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var n in e)e.hasOwnProperty(n)&&(this[n]=e[n]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=r.WordArray=o.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=void 0!=n?n:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var n=this.words,t=e.words,i=this.sigBytes,r=e.sigBytes;if(this.clamp(),i%4)for(var o=0;o<r;o++){var s=t[o>>>2]>>>24-o%4*8&255;n[i+o>>>2]|=s<<24-(i+o)%4*8}else for(o=0;o<r;o+=4)n[i+o>>>2]=t[o>>>2];return this.sigBytes+=r,this},clamp:function(){var n=this.words,t=this.sigBytes;n[t>>>2]&=4294967295<<32-t%4*8,n.length=e.ceil(t/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(n){for(var t,i=[],r=function(n){n=n;var t=987654321,i=4294967295;return function(){var r=((t=36969*(65535&t)+(t>>16)&i)<<16)+(n=18e3*(65535&n)+(n>>16)&i)&i;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},o=0;o<n;o+=4){var a=r(4294967296*(t||e.random()));t=987654071*a(),i.push(4294967296*a()|0)}return new s.init(i,n)}}),a=i.enc={},u=a.Hex={stringify:function(e){for(var n=e.words,t=e.sigBytes,i=[],r=0;r<t;r++){var o=n[r>>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(e){for(var n=e.length,t=[],i=0;i<n;i+=2)t[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(t,n/2)}},c=a.Latin1={stringify:function(e){for(var n=e.words,t=e.sigBytes,i=[],r=0;r<t;r++){var o=n[r>>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var n=e.length,t=[],i=0;i<n;i++)t[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(t,n)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(n){var t=this._data,i=t.words,r=t.sigBytes,o=this.blockSize,a=r/(4*o),u=(a=n?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*u,r);if(u){for(var l=0;l<u;l+=o)this._doProcessBlock(i,l);var f=i.splice(0,u);t.sigBytes-=c}return new s.init(f,c)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),d=(r.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(n,t){return new e.init(t).finalize(n)}},_createHmacHelper:function(e){return function(n,t){return new d.HMAC.init(e,t).finalize(n)}}}),i.algo={});return i}(Math);return e},e.exports=i()},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=t(12))&&i.__esModule?i:{default:i};window.__TECTONIC__amb_client_js=r.default,window.amb=r.default;var o=r.default;n.default=o},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=d(t(1)),r=d(t(0)),o=d(t(4)),s=d(t(5)),a=d(t(6)),u=d(t(2)),c=d(t(7)),l=d(t(9)),f=d(t(8));function d(e){return e&&e.__esModule?e:{default:e}}var h={properties:i.default,Logger:r.default,EventManager:o.default,ServerConnection:s.default,ChannelRedirect:a.default,ChannelListener:u.default,Channel:c.default,MessageClient:l.default,getClient:f.default};n.default=h},function(e,n,t){var i;i=function(){var e={isString:function(e){return void 0!==e&&null!==e&&("string"==typeof e||e instanceof String)},isArray:function(e){return void 0!==e&&null!==e&&e instanceof Array},inArray:function(e,n){for(var t=0;t<n.length;++t)if(e===n[t])return t;return-1},setTimeout:function(e,n,t){return window.setTimeout(function(){try{e._debug("Invoking timed function",n),n()}catch(t){e._debug("Exception invoking timed function",n,t)}},t)},clearTimeout:function(e){window.clearTimeout(e)}},n=function(){var n,t,i;this.registered=function(e,i){n=e,t=i},this.unregistered=function(){n=null,t=null},this._debug=function(){t._debug.apply(t,arguments)},this._mixin=function(){return t._mixin.apply(t,arguments)},this.getConfiguration=function(){return t.getConfiguration()},this.getAdvice=function(){return t.getAdvice()},this.setTimeout=function(n,i){return e.setTimeout(t,n,i)},this.clearTimeout=function(n){e.clearTimeout(n)},this.convertToMessages=function(n){if(e.isString(n))try{return JSON.parse(n)}catch(e){throw this._debug("Could not convert to JSON the following string",'"'+n+'"'),e}if(e.isArray(n))return n;if(void 0===n||null===n)return[];if(n instanceof Object)return[n];throw"Conversion Error "+n+", typeof "+typeof n},this.accept=function(e,n,t){throw"Abstract"},this.getType=function(){return n},this.getURL=function(){return i},this.setURL=function(e){i=e},this.send=function(e,n){throw"Abstract"},this.reset=function(e){this._debug("Transport",n,"reset",e?"initial":"retry")},this.abort=function(){this._debug("Transport",n,"aborted")},this.toString=function(){return this.getType()}};n.derive=function(e){function n(){}return n.prototype=e,new n};var t=function(){var t=new n,i=n.derive(t),r=0,o=null,s=[],a=[];function u(e,n){if(this.transportSend(e,n),n.expired=!1,!e.sync){var t=this.getConfiguration().maxNetworkDelay,i=t;!0===n.metaConnect&&(i+=this.getAdvice().timeout),this._debug("Transport",this.getType(),"waiting at most",i,"ms for the response, maxNetworkDelay",t);var r=this;n.timeout=this.setTimeout(function(){n.expired=!0;var t="Request "+n.id+" of transport "+r.getType()+" exceeded "+i+" ms max network delay",o={reason:t},s=n.xhr;o.httpCode=r.xhrStatus(s),r.abortXHR(s),r._debug(t),r.complete(n,!1,n.metaConnect),e.onFailure(s,e.messages,o)},i)}}function c(e){var n=++r,t={id:n,metaConnect:!1,envelope:e};s.length<this.getConfiguration().maxConnections-1?(s.push(t),u.call(this,e,t)):(this._debug("Transport",this.getType(),"queueing request",n,"envelope",e),a.push([e,t]))}function l(n,t){var i=e.inArray(n,s);if(i>=0&&s.splice(i,1),a.length>0){var r=a.shift(),o=r[0],u=r[1];if(this._debug("Transport dequeued request",u.id),t)this.getConfiguration().autoBatch&&function(e){for(;a.length>0;){var n=a[0],t=n[0],i=n[1];if(t.url!==e.url||t.sync!==e.sync)break;a.shift(),e.messages=e.messages.concat(t.messages),this._debug("Coalesced",t.messages.length,"messages from request",i.id)}}.call(this,o),c.call(this,o),this._debug("Transport completed request",n.id,o);else{var l=this;this.setTimeout(function(){l.complete(u,!1,u.metaConnect);var e={reason:"Previous request failed"},n=u.xhr;e.httpCode=l.xhrStatus(n),o.onFailure(n,o.messages,e)},0)}}}return i.complete=function(e,n,t){t?function(e){var n=e.id;if(this._debug("Transport",this.getType(),"metaConnect complete, request",n),null!==o&&o.id!==n)throw"Longpoll request mismatch, completing request "+n;o=null}.call(this,e):l.call(this,e,n)},i.transportSend=function(e,n){throw"Abstract"},i.transportSuccess=function(e,n,t){n.expired||(this.clearTimeout(n.timeout),this.complete(n,!0,n.metaConnect),t&&t.length>0?e.onSuccess(t):e.onFailure(n.xhr,e.messages,{httpCode:204}))},i.transportFailure=function(e,n,t){n.expired||(this.clearTimeout(n.timeout),this.complete(n,!1,n.metaConnect),e.onFailure(n.xhr,e.messages,t))},i.send=function(e,n){n?function(e){if(null!==o)throw"Concurrent metaConnect requests not allowed, request id="+o.id+" not yet completed";var n=++r;this._debug("Transport",this.getType(),"metaConnect send, request",n,"envelope",e);var t={id:n,metaConnect:!0,envelope:e};u.call(this,e,t),o=t}.call(this,e):c.call(this,e)},i.abort=function(){t.abort();for(var e=0;e<s.length;++e){var n=s[e];n&&(this._debug("Aborting request",n),this.abortXHR(n.xhr)||this.transportFailure(n.envelope,n,{reason:"abort"}))}var i=o;i&&(this._debug("Aborting metaConnect request",i),this.abortXHR(i.xhr)||this.transportFailure(i.envelope,i,{reason:"abort"})),this.reset(!0)},i.reset=function(e){t.reset(e),o=null,s=[],a=[]},i.abortXHR=function(e){if(e)try{var n=e.readyState;return e.abort(),n!==window.XMLHttpRequest.UNSENT}catch(e){this._debug(e)}return!1},i.xhrStatus=function(e){if(e)try{return e.status}catch(e){this._debug(e)}return-1},i},i=function(){var e=new t,i=n.derive(e),r=!0;return i.accept=function(e,n,t){return r||!n},i.newXMLHttpRequest=function(){return new window.XMLHttpRequest},i.xhrSend=function(e){var n=i.newXMLHttpRequest();n.context=i.context,n.withCredentials=!0,n.open("POST",e.url,!0!==e.sync);var t=e.headers;if(t)for(var r in t)t.hasOwnProperty(r)&&n.setRequestHeader(r,t[r]);return n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.onload=function(){200===n.status?e.onSuccess(n.responseText):e.onError(n.statusText)},n.onerror=function(){e.onError(n.statusText)},n.send(e.body),n},i.transportSend=function(e,n){this._debug("Transport",this.getType(),"sending request",n.id,"envelope",e);var t=this;try{var i=!0;n.xhr=this.xhrSend({transport:this,url:e.url,sync:e.sync,headers:this.getConfiguration().requestHeaders,body:JSON.stringify(e.messages),onSuccess:function(i){t._debug("Transport",t.getType(),"received response",i);var o=!1;try{var s=t.convertToMessages(i);0===s.length?(r=!1,t.transportFailure(e,n,{httpCode:204})):(o=!0,t.transportSuccess(e,n,s))}catch(i){if(t._debug(i),!o){r=!1;var a={exception:i};a.httpCode=t.xhrStatus(n.xhr),t.transportFailure(e,n,a)}}},onError:function(o,s){t._debug("Transport",t.getType(),"received error",o,s),r=!1;var a={reason:o,exception:s};a.httpCode=t.xhrStatus(n.xhr),i?t.setTimeout(function(){t.transportFailure(e,n,a)},0):t.transportFailure(e,n,a)}}),i=!1}catch(i){r=!1,this.setTimeout(function(){t.transportFailure(e,n,{exception:i})},0)}},i.reset=function(n){e.reset(n),r=!0},i},r=function(){var e=new t,i=n.derive(e),r=0;function o(e,n,t){var i=this;return function(){i.transportFailure(e,n,"error",t)}}return i.accept=function(e,n,t){return!0},i.jsonpSend=function(e){var n=document.getElementsByTagName("head")[0],t=document.createElement("script"),i="_cometd_jsonp_"+r++;window[i]=function(r){n.removeChild(t),delete window[i],e.onSuccess(r)};var o=e.url;o+=o.indexOf("?")<0?"?":"&",o+="jsonp="+i,o+="&message="+encodeURIComponent(e.body),t.src=o,t.async=!0!==e.sync,t.type="application/javascript",t.onerror=function(n){e.onError("jsonp "+n.type)},n.appendChild(t)},i.transportSend=function(e,n){for(var t=this,i=0,r=e.messages.length,s=[];r>0;){var a=JSON.stringify(e.messages.slice(i,i+r)),u=e.url.length+encodeURI(a).length,c=this.getConfiguration().maxURILength;if(u>c){if(1===r){var l="Bayeux message too big ("+u+" bytes, max is "+c+") for transport "+this.getType();return void this.setTimeout(o.call(this,e,n,l),0)}--r}else s.push(r),i+=r,r=e.messages.length-i}var f=e;if(s.length>1){var d=0,h=s[0];this._debug("Transport",this.getType(),"split",e.messages.length,"messages into",s.join(" + ")),(f=this._mixin(!1,{},e)).messages=e.messages.slice(d,h),f.onSuccess=e.onSuccess,f.onFailure=e.onFailure;for(var g=1;g<s.length;++g){var b=this._mixin(!1,{},e);d=h,h+=s[g],b.messages=e.messages.slice(d,h),b.onSuccess=e.onSuccess,b.onFailure=e.onFailure,this.send(b,n.metaConnect)}}this._debug("Transport",this.getType(),"sending request",n.id,"envelope",f);try{var p=!0;this.jsonpSend({transport:this,url:f.url,sync:f.sync,headers:this.getConfiguration().requestHeaders,body:JSON.stringify(f.messages),onSuccess:function(e){var i=!1;try{var r=t.convertToMessages(e);0===r.length?t.transportFailure(f,n,{httpCode:204}):(i=!0,t.transportSuccess(f,n,r))}catch(e){t._debug(e),i||t.transportFailure(f,n,{exception:e})}},onError:function(e,i){var r={reason:e,exception:i};p?t.setTimeout(function(){t.transportFailure(f,n,r)},0):t.transportFailure(f,n,r)}}),p=!1}catch(e){this.setTimeout(function(){t.transportFailure(f,n,{exception:e})},0)}},i},o=function(){var t,i=new n,r=n.derive(i),o=!0,s=!1,a=!0,u=null,c=null,l=!1,f=null;function d(e,n){e&&(this.webSocketClose(e,n.code,n.reason),this.onClose(e,n))}function h(e){return e===c||e===u}function g(e,n,t){for(var i=[],r=0;r<n.messages.length;++r){var o=n.messages[r];o.id&&i.push(o.id)}e.envelopes[i.join(",")]=[n,t],this._debug("Transport",this.getType(),"stored envelope, envelopes",e.envelopes)}function b(e,n,i){var r=JSON.stringify(n.messages);e.webSocket.send(r),this._debug("Transport",this.getType(),"sent",n,"metaConnect =",i);var o=this.getConfiguration().maxNetworkDelay,s=o;i&&(s+=this.getAdvice().timeout,l=!0);for(var a=this,u=[],c=0;c<n.messages.length;++c)!function(){var i=n.messages[c];i.id&&(u.push(i.id),e.timeouts[i.id]=a.setTimeout(function(){t._debug("Transport",a.getType(),"timing out message",i.id,"after",s,"on",e),d.call(a,e,{code:1e3,reason:"Message Timeout"})},s))}();this._debug("Transport",this.getType(),"waiting at most",s,"ms for messages",u,"maxNetworkDelay",o,", timeouts:",e.timeouts)}function p(e,n,i){try{null===e?(e=c||{envelopes:{},timeouts:{}},g.call(this,e,n,i),function(e){if(!c){var n=t.getURL().replace(/^http/,"ws");this._debug("Transport",this.getType(),"connecting to URL",n);try{var i=t.getConfiguration().protocol;e.webSocket=i?new window.WebSocket(n,i):new window.WebSocket(n),c=e}catch(e){throw o=!1,this._debug("Exception while creating WebSocket object",e),e}a=!1!==t.getConfiguration().stickyReconnect;var r=this,l=t.getConfiguration().connectTimeout;l>0&&(e.connectTimer=this.setTimeout(function(){t._debug("Transport",r.getType(),"timed out while connecting to URL",n,":",l,"ms"),d.call(r,e,{code:1e3,reason:"Connect Timeout"})},l));var f=function(n){n=n||{code:1e3},t._debug("WebSocket onclose",e,n,"connecting",c,"current",u),e.connectTimer&&r.clearTimeout(e.connectTimer),r.onClose(e,n)};e.webSocket.onopen=function(){t._debug("WebSocket onopen",e),e.connectTimer&&r.clearTimeout(e.connectTimer),h(e)?(c=null,u=e,s=!0,r.onOpen(e)):(t._warn("Closing extra WebSocket connection",this,"active connection",u),d.call(r,e,{code:1e3,reason:"Extra Connection"}))},e.webSocket.onclose=f,e.webSocket.onerror=function(){f({code:1e3,reason:"Error"})},e.webSocket.onmessage=function(n){t._debug("WebSocket onmessage",n,e),r.onMessage(e,n)},this._debug("Transport",this.getType(),"configured callbacks on",e)}}.call(this,e)):(g.call(this,e,n,i),b.call(this,e,n,i))}catch(n){var r=this;this.setTimeout(function(){d.call(r,e,{code:1e3,reason:"Exception",exception:n})},0)}}return r.reset=function(e){i.reset(e),o=!0,e&&(s=!1),a=!0,u=null,c=null,l=!1},r._notifySuccess=function(e,n){e.call(this,n)},r._notifyFailure=function(e,n,t,i){e.call(this,n,t,i)},r.onOpen=function(e){var n=e.envelopes;for(var t in this._debug("Transport",this.getType(),"opened",e,"pending messages",n),n)if(n.hasOwnProperty(t)){var i=n[t],r=i[0],o=i[1];f=r.onSuccess,b.call(this,e,r,o)}},r.onMessage=function(n,t){this._debug("Transport",this.getType(),"received websocket message",t,n);for(var i=!1,r=this.convertToMessages(t.data),o=[],s=0;s<r.length;++s){var a=r[s];if((/^\/meta\//.test(a.channel)||void 0===a.data)&&a.id){o.push(a.id);var u=n.timeouts[a.id];u&&(this.clearTimeout(u),delete n.timeouts[a.id],this._debug("Transport",this.getType(),"removed timeout for message",a.id,", timeouts",n.timeouts))}"/meta/connect"===a.channel&&(l=!1),"/meta/disconnect"!==a.channel||l||(i=!0)}for(var c=!1,d=n.envelopes,h=0;h<o.length;++h){var g=o[h];for(var b in d)if(d.hasOwnProperty(b)){var p=b.split(","),m=e.inArray(g,p);if(m>=0){c=!0,p.splice(m,1);var v=d[b][0],y=d[b][1];delete d[b],p.length>0&&(d[p.join(",")]=[v,y]);break}}}c&&this._debug("Transport",this.getType(),"removed envelope, envelopes",d),this._notifySuccess(f,r),i&&this.webSocketClose(n,1e3,"Disconnect")},r.onClose=function(e,n){this._debug("Transport",this.getType(),"closed",e,n),h(e)&&(o=a&&s,c=null,u=null);var t=e.timeouts;for(var i in e.timeouts={},t)t.hasOwnProperty(i)&&this.clearTimeout(t[i]);var r=e.envelopes;for(var f in e.envelopes={},r)if(r.hasOwnProperty(f)){var d=r[f][0];r[f][1]&&(l=!1);var g={websocketCode:n.code,reason:n.reason};n.exception&&(g.exception=n.exception),this._notifyFailure(d.onFailure,e,d.messages,g)}},r.registered=function(e,n){i.registered(e,n),t=n},r.accept=function(e,n,i){return this._debug("Transport",this.getType(),"accept, supported:",o),o&&!!window.WebSocket&&!1!==t.websocketEnabled},r.send=function(e,n){this._debug("Transport",this.getType(),"sending",e,"metaConnect =",n),p.call(this,u,e,n)},r.webSocketClose=function(e,n,t){try{e.webSocket&&e.webSocket.close(n,t)}catch(e){this._debug(e)}},r.abort=function(){i.abort(),d.call(this,u,{code:1e3,reason:"Abort"}),this.reset(!0)},r},s=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",".","-",":","+","=","^","!","/","*","?","&","<",">","(",")","[","]","{","}","@","%","$","#"],a=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,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,77,0,78,67,0,0,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,79,0,80,0,0];return{CometD:function(n){var t,s,a,u,c,l=this,f=n||"default",d=!1,h=new function(){var e=[],n={};this.getTransportTypes=function(){return e.slice(0)},this.findTransportTypes=function(t,i,r){for(var o=[],s=0;s<e.length;++s){var a=e[s];!0===n[a].accept(t,i,r)&&o.push(a)}return o},this.negotiateTransport=function(t,i,r,o){for(var s=0;s<e.length;++s)for(var a=e[s],u=0;u<t.length;++u)if(a===t[u]){var c=n[a];if(!0===c.accept(i,r,o))return c}return null},this.add=function(t,i,r){for(var o=!1,s=0;s<e.length;++s)if(e[s]===t){o=!0;break}return o||("number"!=typeof r?e.push(t):e.splice(r,0,t),n[t]=i),!o},this.find=function(t){for(var i=0;i<e.length;++i)if(e[i]===t)return n[t];return null},this.remove=function(t){for(var i=0;i<e.length;++i)if(e[i]===t){e.splice(i,1);var r=n[t];return delete n[t],r}return null},this.clear=function(){e=[],n={}},this.reset=function(t){for(var i=0;i<e.length;++i)n[e[i]].reset(t)}},g="disconnected",b=0,p=null,m=0,v=[],y=!1,_=0,C={},w=0,T=null,S=[],E={},x={},k={},O=!1,N=!1,I=0,L=0,M={protocol:null,stickyReconnect:!0,connectTimeout:0,maxConnections:2,backoffIncrement:1e3,maxBackoff:6e4,logLevel:"info",maxNetworkDelay:1e4,requestHeaders:{},appendMessageTypeToURL:!0,autoBatch:!1,urls:{},maxURILength:2e3,advice:{timeout:6e4,interval:0,reconnect:void 0,maxInterval:0}};function D(e,n){try{return e[n]}catch(e){return}}function A(n){return e.isString(n)}function R(e){return void 0!==e&&null!==e&&"function"==typeof e}function F(e,n){for(var t="";--n>0&&!(e>=Math.pow(10,n));)t+="0";return t+=e}function B(e,n){if(window.console){var t=window.console[e];if(R(t)){var i=new Date;[].splice.call(n,0,0,F(i.getHours(),2)+":"+F(i.getMinutes(),2)+":"+F(i.getSeconds(),2)+"."+F(i.getMilliseconds(),3)),t.apply(window.console,n)}}}function U(e){return/(^https?:\/\/)?(((\[[^\]]+\])|([^:\/\?#]+))(:(\d+))?)?([^\?#]*)(.*)?/.exec(e)}function P(e){if(e){var n=C[e.channel];n&&n[e.id]&&(delete n[e.id],l._debug("Removed",e.listener?"listener":"subscription",e))}}function j(e){e&&!e.listener&&P(e)}function q(){for(var e in C)if(C.hasOwnProperty(e)){var n=C[e];if(n)for(var t in n)n.hasOwnProperty(t)&&j(n[t])}}function G(e){g!==e&&(l._debug("Status",g,"->",e),g=e)}function W(){return"disconnecting"===g||"disconnected"===g}function H(){return""+ ++b}function z(e,n,t,i,r){try{return n.call(e,i)}catch(e){var o=l.onExtensionException;if(R(o)){l._debug("Invoking extension exception handler",t,e);try{o.call(l,e,t,r,i)}catch(e){l._info("Exception during execution of extension exception handler",t,e)}}else l._info("Exception during execution of extension",t,e);return i}}function Q(e){for(var n=S.length-1;n>=0&&void 0!==e&&null!==e;--n){var t=S[n],i=t.extension.outgoing;if(R(i)){var r=z(t.extension,i,t.name,e,!0);e=void 0===r?e:r}}return e}function X(e,n){var t=C[e];if(t)for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(r)try{r.callback.call(r.scope,n)}catch(e){var o=l.onListenerException;if(R(o)){l._debug("Invoking listener exception handler",r,e);try{o.call(l,e,r,r.listener,n)}catch(e){l._info("Exception during execution of listener exception handler",r,e)}}else l._info("Exception during execution of listener",r,n,e)}}}function V(e,n){X(e,n);for(var t=e.split("/"),i=t.length-1,r=i;r>0;--r){var o=t.slice(0,r).join("/")+"/*";r===i&&X(o,n),X(o+="*",n)}}function K(){null!==T&&e.clearTimeout(T),T=null}function J(n,t){K();var i=E.interval+t;l._debug("Function scheduled in",i,"ms, interval =",E.interval,"backoff =",w,n),T=e.setTimeout(l,n,i)}function Y(e,n,i,r){for(var o=0;o<n.length;++o){var s=n[o],a=s.id;p&&(s.clientId=p),void 0!==(s=Q(s))&&null!==s?(s.id=a,n[o]=s):(delete x[a],n.splice(o--,1))}if(0!==n.length){var f=l.getURL();M.appendMessageTypeToURL&&(f.match(/\/$/)||(f+="/"),r&&(f+=r));var d={url:f,sync:e,messages:n,onSuccess:function(e){try{u.call(l,e)}catch(e){l._info("Exception during handling of messages",e)}},onFailure:function(e,n,t){try{var i=l.getTransport();t.connectionType=i?i.getType():"unknown",c.call(l,e,n,t)}catch(e){l._info("Exception during handling of failure",e)}}};l._debug("Send",d),t.send(d,i)}}function Z(e){m>0||!0===y?v.push(e):Y(!1,[e],!1)}function $(){w=0}function ee(){var e=v;v=[],e.length>0&&Y(!1,e,!1)}function ne(e){G("connecting"),J(function(){!function(){if(!W()){var e={id:H(),channel:"/meta/connect",connectionType:t.getType()};N||(e.advice={timeout:0}),G("connecting"),l._debug("Connect sent",e),Y(!1,[e],!0,"connect"),G("connected")}}()},e)}function te(e){e&&(E=l._mixin(!1,{},M.advice,e),l._debug("New advice",E))}function ie(e){if(K(),e&&t&&t.abort(),p=null,G("disconnected"),m=0,$(),t=null,O=!1,N=!1,v.length>0){var n=v;v=[],c.call(l,void 0,n,{reason:"Disconnected"})}}function re(e,n,t){var i=l.onTransportException;if(R(i)){l._debug("Invoking transport exception handler",e,n,t);try{i.call(l,t,e,n)}catch(e){l._info("Exception during execution of transport exception handler",e)}}}function oe(e,n){R(e)&&(n=e,e=void 0),p=null,q(),W()&&h.reset(!0),te({}),m=0,y=!0,s=e,a=n;var i=l.getURL(),r=h.findTransportTypes("1.0",d,i),o={id:H(),version:"1.0",minimumVersion:"1.0",channel:"/meta/handshake",supportedConnectionTypes:r,advice:{timeout:E.timeout,interval:E.interval}},u=l._mixin(!1,{},s,o);if(l._putCallback(u.id,n),!t&&!(t=h.negotiateTransport(r,"1.0",d,i))){var c="Could not find initial transport among: "+h.getTransportTypes();throw l._warn(c),c}l._debug("Initial transport is",t.getType()),G("handshaking"),l._debug("Handshake sent",u),Y(!1,[u],!1,"handshake")}function se(e,n){try{e.call(l,n)}catch(e){var t=l.onCallbackException;if(R(t)){l._debug("Invoking callback exception handler",e);try{t.call(l,e,n)}catch(e){l._info("Exception during execution of callback exception handler",e)}}else l._info("Exception during execution of message callback",e)}}function ae(e){var n=l._getCallback([e.id]);R(n)&&(delete x[e.id],se(n,e))}function ue(n){var t=k[n.id];if(delete k[n.id],t){l._debug("Handling remote call response for",n,"with context",t);var i=t.timeout;i&&e.clearTimeout(i);var r=t.callback;if(R(r))return se(r,n),!0}return!1}function ce(e){l._debug("Transport failure handling",e),e.transport&&(t=e.transport),e.url&&t.setURL(e.url);var n=e.action,i=e.delay||0;switch(n){case"handshake":!function(e){G("handshaking"),y=!0,J(function(){oe(s,a)},e)}(i);break;case"retry":ne(i);break;case"none":ie(!0);break;default:throw"Unknown action "+n}}function le(e,n){ae(e),V("/meta/handshake",e),V("/meta/unsuccessful",e),W()&&(n.action="none"),l.onTransportFailure.call(l,e,n,ce)}function fe(e){le(e,{cause:"failure",action:"handshake",transport:null})}function de(e,n){V("/meta/connect",e),V("/meta/unsuccessful",e),W()&&(n.action="none"),l.onTransportFailure.call(l,e,n,ce)}function he(e){N=!1,de(e,{cause:"failure",action:"retry",transport:null})}function ge(e){ie(!0),ae(e),V("/meta/disconnect",e),V("/meta/unsuccessful",e)}function be(e){ge(e)}function pe(e){var n=C[e.subscription];if(n)for(var t in n)if(n.hasOwnProperty(t)){var i=n[t];i&&!i.listener&&(delete n[t],l._debug("Removed failed subscription",i))}ae(e),V("/meta/subscribe",e),V("/meta/unsuccessful",e)}function me(e){pe(e)}function ve(e){ae(e),V("/meta/unsubscribe",e),V("/meta/unsuccessful",e)}function ye(e){ve(e)}function _e(e){ue(e)||(ae(e),V("/meta/publish",e),V("/meta/unsuccessful",e))}function Ce(e){_e(e)}function we(e){if(I=0,void 0!==(e=function(e){for(var n=0;n<S.length&&void 0!==e&&null!==e;++n){var t=S[n],i=t.extension.incoming;if(R(i)){var r=z(t.extension,i,t.name,e,!1);e=void 0===r?e:r}}return e}(e))&&null!==e)switch(te(e.advice),e.channel){case"/meta/handshake":!function(e){var n=l.getURL();if(e.successful){var i=l._isCrossDomain(U(n)[2]),r=h.negotiateTransport(e.supportedConnectionTypes,e.version,i,n);if(null===r)return e.successful=!1,void le(e,{cause:"negotiation",action:"none",transport:null});t!==r&&(l._debug("Transport",t.getType(),"->",r.getType()),t=r),p=e.clientId,y=!1,ee(),e.reestablish=O,O=!0,ae(e),V("/meta/handshake",e),L=e["x-messages"]||0;var o=W()?"none":E.reconnect||"retry";switch(o){case"retry":$(),0===L?ne(0):l._debug("Processing",L,"handshake-delivered messages");break;case"none":ie(!0);break;default:throw"Unrecognized advice action "+o}}else le(e,{cause:"unsuccessful",action:E.reconnect||"handshake",transport:t})}(e);break;case"/meta/connect":!function(e){if(N=e.successful){V("/meta/connect",e);var n=W()?"none":E.reconnect||"retry";switch(n){case"retry":$(),ne(w);break;case"none":ie(!1);break;default:throw"Unrecognized advice action "+n}}else de(e,{cause:"unsuccessful",action:E.reconnect||"retry",transport:t})}(e);break;case"/meta/disconnect":!function(e){e.successful?(ie(!1),ae(e),V("/meta/disconnect",e)):ge(e)}(e);break;case"/meta/subscribe":!function(e){e.successful?(ae(e),V("/meta/subscribe",e)):pe(e)}(e);break;case"/meta/unsubscribe":!function(e){e.successful?(ae(e),V("/meta/unsubscribe",e)):ve(e)}(e);break;default:!function(e){void 0!==e.data?ue(e)||(V(e.channel,e),L>0&&0==--L&&(l._debug("Processed last handshake-delivered message"),ne(0))):void 0===e.successful?l._warn("Unknown Bayeux Message",e):e.successful?(ae(e),V("/meta/publish",e)):_e(e)}(e)}}function Te(e){var n=C[e];if(n)for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!0;return!1}function Se(e,n){var t={scope:e,method:n};if(R(e))t.scope=void 0,t.method=e;else if(A(n)){if(!e)throw"Invalid scope "+e;if(t.method=e[n],!R(t.method))throw"Invalid callback "+n+" for scope "+e}else if(!R(n))throw"Invalid callback "+n;return t}function Ee(e,n,t,i){var r=Se(n,t);l._debug("Adding",i?"listener":"subscription","on",e,"with scope",r.scope,"and callback",r.method);var o=++_,s={id:o,channel:e,scope:r.scope,callback:r.method,listener:i},a=C[e];return a||(a={},C[e]=a),a[o]=s,l._debug("Added",i?"listener":"subscription",s),s}this._mixin=function(e,n,t){for(var i=n||{},r=2;r<arguments.length;++r){var o=arguments[r];if(void 0!==o&&null!==o)for(var s in o)if(o.hasOwnProperty(s)){var a=D(o,s),u=D(i,s);if(a===n)continue;if(void 0===a)continue;if(e&&"object"==typeof a&&null!==a)if(a instanceof Array)i[s]=this._mixin(e,u instanceof Array?u:[],a);else{var c="object"!=typeof u||u instanceof Array?{}:u;i[s]=this._mixin(e,c,a)}else i[s]=a}}return i},this._warn=function(){B("warn",arguments)},this._info=function(){"warn"!==M.logLevel&&B("info",arguments)},this._debug=function(){"debug"===M.logLevel&&B("debug",arguments)},this._isCrossDomain=function(e){return!!(window.location&&window.location.host&&e)&&e!==window.location.host},this.send=Z,this._getCallback=function(e){return x[e]},this._putCallback=function(e,n){var t=this._getCallback(e);return R(n)&&(x[e]=n),t},this.onTransportFailure=function(e,n,i){this._debug("Transport failure",n,"for",e);var r=this.getTransportRegistry(),o=this.getURL(),s=this._isCrossDomain(U(o)[2]),a=r.findTransportTypes("1.0",s,o);if("none"===n.action){if("/meta/handshake"===e.channel&&!n.transport){var u="Could not negotiate transport, client=["+a+"], server=["+e.supportedConnectionTypes+"]";this._warn(u),re(t.getType(),null,{reason:u,connectionType:t.getType(),transport:t})}}else if(n.delay=this.getBackoffPeriod(),"/meta/handshake"===e.channel){if(!n.transport){var c=r.negotiateTransport(a,"1.0",s,o);c?(this._debug("Transport",t.getType(),"->",c.getType()),re(t.getType(),c.getType(),e.failure),n.action="handshake",n.transport=c):(this._warn("Could not negotiate transport, client=["+a+"]"),re(t.getType(),null,e.failure),n.action="none")}"none"!==n.action&&this.increaseBackoffPeriod()}else{var f=(new Date).getTime();if(0===I&&(I=f),"retry"===n.action){n.delay=this.increaseBackoffPeriod();var d=E.maxInterval;if(d>0){var h=E.timeout+E.interval+d;f-I+w>h&&(n.action="handshake")}}"handshake"===n.action&&(n.delay=0,r.reset(!1),this.resetBackoffPeriod())}i.call(l,n)},this.receive=we,u=function(e){l._debug("Received",e);for(var n=0;n<e.length;++n)we(e[n])},c=function(e,n,t){l._debug("handleFailure",e,n,t),t.transport=e;for(var i=0;i<n.length;++i){var r=n[i],o={id:r.id,successful:!1,channel:r.channel,failure:t};switch(t.message=r,r.channel){case"/meta/handshake":fe(o);break;case"/meta/connect":he(o);break;case"/meta/disconnect":be(o);break;case"/meta/subscribe":o.subscription=r.subscription,me(o);break;case"/meta/unsubscribe":o.subscription=r.subscription,ye(o);break;default:Ce(o)}}},this.registerTransport=function(e,n,t){var i=h.add(e,n,t);return i&&(this._debug("Registered transport",e),R(n.registered)&&n.registered(e,this)),i},this.unregisterTransport=function(e){var n=h.remove(e);return null!==n&&(this._debug("Unregistered transport",e),R(n.unregistered)&&n.unregistered()),n},this.unregisterTransports=function(){h.clear()},this.getTransportTypes=function(){return h.getTransportTypes()},this.findTransport=function(e){return h.find(e)},this.getTransportRegistry=function(){return h},this.configure=function(e){(function(e){l._debug("Configuring cometd object with",e),A(e)&&(e={url:e}),e||(e={}),M=l._mixin(!1,M,e);var n=l.getURL();if(!n)throw"Missing required configuration parameter 'url' specifying the Bayeux server URL";var t=U(n),i=t[2],r=t[8],o=t[9];if(d=l._isCrossDomain(i),M.appendMessageTypeToURL)if(void 0!==o&&o.length>0)l._info("Appending message type to URI "+r+o+" is not supported, disabling 'appendMessageTypeToURL' configuration"),M.appendMessageTypeToURL=!1;else{var s=r.split("/"),a=s.length-1;r.match(/\/$/)&&(a-=1),s[a].indexOf(".")>=0&&(l._info("Appending message type to URI "+r+" is not supported, disabling 'appendMessageTypeToURL' configuration"),M.appendMessageTypeToURL=!1)}}).call(this,e)},this.init=function(e,n){this.configure(e),this.handshake(n)},this.handshake=function(e,n){if("disconnected"!==g)throw"Illegal state: handshaken";oe(e,n)},this.disconnect=function(e,n,t){if(!W()){"boolean"!=typeof e&&(t=n,n=e,e=!1),R(n)&&(t=n,n=void 0);var i={id:H(),channel:"/meta/disconnect"},r=this._mixin(!1,{},n,i);l._putCallback(r.id,t),G("disconnecting"),Y(!0===e,[r],!1,"disconnect")}},this.startBatch=function(){++m,l._debug("Starting batch, depth",m)},this.endBatch=function(){!function(){if(--m,l._debug("Ending batch, depth",m),m<0)throw"Calls to startBatch() and endBatch() are not paired";0!==m||W()||y||ee()}()},this.batch=function(e,n){var t=Se(e,n);this.startBatch();try{t.method.call(t.scope),this.endBatch()}catch(e){throw this._info("Exception during execution of batch",e),this.endBatch(),e}},this.addListener=function(e,n,t){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!A(e))throw"Illegal argument type: channel must be a string";return Ee(e,n,t,!0)},this.removeListener=function(e){if(!(e&&e.channel&&"id"in e))throw"Invalid argument: expected subscription, not "+e;P(e)},this.clearListeners=function(){C={}},this.subscribe=function(e,n,t,i,r){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!A(e))throw"Illegal argument type: channel must be a string";if(W())throw"Illegal state: disconnected";R(n)&&(r=i,i=t,t=n,n=void 0),R(i)&&(r=i,i=void 0);var o=!Te(e),s=Ee(e,n,t,!1);if(o){var a={id:H(),channel:"/meta/subscribe",subscription:e},u=this._mixin(!1,{},i,a);l._putCallback(u.id,r),Z(u)}return s},this.unsubscribe=function(e,n,t){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(W())throw"Illegal state: disconnected";R(n)&&(t=n,n=void 0),this.removeListener(e);var i=e.channel;if(!Te(i)){var r={id:H(),channel:"/meta/unsubscribe",subscription:i},o=this._mixin(!1,{},n,r);l._putCallback(o.id,t),Z(o)}},this.resubscribe=function(e,n){if(j(e),e)return this.subscribe(e.channel,e.scope,e.callback,n)},this.clearSubscriptions=function(){q()},this.publish=function(e,n,t,i){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!A(e))throw"Illegal argument type: channel must be a string";if(/^\/meta\//.test(e))throw"Illegal argument: cannot publish to meta channels";if(W())throw"Illegal state: disconnected";R(n)?(i=n,n={},t=void 0):R(t)&&(i=t,t=void 0);var r={id:H(),channel:e,data:n},o=this._mixin(!1,{},t,r);l._putCallback(o.id,i),Z(o)},this.publishBinary=function(e,n,t,i,r){R(n)?(r=n,n=new ArrayBuffer(0),t=!0,i=void 0):R(t)?(r=t,t=!0,i=void 0):R(i)&&(r=i,i=void 0);var o={meta:i,data:n,last:t};this.publish(e,o,{ext:{binary:{}}},r)},this.remoteCall=function(n,t,i,r,o){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!A(n))throw"Illegal argument type: target must be a string";if(W())throw"Illegal state: disconnected";if(R(t)?(o=t,t={},i=M.maxNetworkDelay,r=void 0):R(i)?(o=i,i=M.maxNetworkDelay,r=void 0):R(r)&&(o=r,r=void 0),"number"!=typeof i)throw"Illegal argument type: timeout must be a number";n.match(/^\//)||(n="/"+n);var s="/service"+n,a={id:H(),channel:s,data:t},u=this._mixin(!1,{},r,a),c={callback:o};i>0&&(c.timeout=e.setTimeout(l,function(){l._debug("Timing out remote call",u,"after",i,"ms"),_e({id:u.id,error:"406::timeout",successful:!1,failure:{message:u,reason:"Remote Call Timeout"}})},i),l._debug("Scheduled remote call timeout",u,"in",i,"ms")),k[u.id]=c,Z(u)},this.remoteCallBinary=function(e,n,t,i,r,o){R(n)?(o=n,n=new ArrayBuffer(0),t=!0,i=void 0,r=M.maxNetworkDelay):R(t)?(o=t,t=!0,i=void 0,r=M.maxNetworkDelay):R(i)?(o=i,i=void 0,r=M.maxNetworkDelay):R(r)&&(o=r,r=M.maxNetworkDelay);var s={meta:i,data:n,last:t};this.remoteCall(e,s,r,{ext:{binary:{}}},o)},this.getStatus=function(){return g},this.isDisconnected=W,this.setBackoffIncrement=function(e){M.backoffIncrement=e},this.getBackoffIncrement=function(){return M.backoffIncrement},this.getBackoffPeriod=function(){return w},this.increaseBackoffPeriod=function(){return w<M.maxBackoff&&(w+=M.backoffIncrement),w},this.resetBackoffPeriod=function(){$()},this.setLogLevel=function(e){M.logLevel=e},this.registerExtension=function(e,n){if(arguments.length<2)throw"Illegal arguments number: required 2, got "+arguments.length;if(!A(e))throw"Illegal argument type: extension name must be a string";for(var t=!1,i=0;i<S.length;++i)if(S[i].name===e){t=!0;break}return t?(this._info("Could not register extension with name",e,"since another extension with the same name already exists"),!1):(S.push({name:e,extension:n}),this._debug("Registered extension",e),R(n.registered)&&n.registered(e,this),!0)},this.unregisterExtension=function(e){if(!A(e))throw"Illegal argument type: extension name must be a string";for(var n=!1,t=0;t<S.length;++t){var i=S[t];if(i.name===e){S.splice(t,1),n=!0,this._debug("Unregistered extension",e);var r=i.extension;R(r.unregistered)&&r.unregistered();break}}return n},this.getExtension=function(e){for(var n=0;n<S.length;++n){var t=S[n];if(t.name===e)return t.extension}return null},this.getName=function(){return f},this.getClientId=function(){return p},this.getURL=function(){if(t){var e=t.getURL();if(e)return e;if(e=M.urls[t.getType()])return e}return M.url},this.getTransport=function(){return t},this.getConfiguration=function(){return this._mixin(!0,{},M)},this.getAdvice=function(){return this._mixin(!0,{},E)},window.WebSocket&&this.registerTransport("websocket",new o),this.registerTransport("long-polling",new i),this.registerTransport("callback-polling",new r)},Transport:n,RequestTransport:t,LongPollingTransport:i,CallbackPollingTransport:r,WebSocketTransport:o,Utils:e,Z85:{encode:function(e){var n=null;if(e instanceof ArrayBuffer?n=e:e.buffer instanceof ArrayBuffer?n=e.buffer:Array.isArray(e)&&(n=new Uint8Array(e).buffer),null==n)throw"Cannot Z85 encode "+e;for(var t=n.byteLength,i=t%4,r=4-(0===i?4:i),o=new DataView(n),a="",u=0,c=0;c<t+r;++c){var l=c>=t;if(u=256*u+(l?0:o.getUint8(c)),(c+1)%4==0){for(var f=52200625,d=5;d>0;--d){if(!l||d>r){var h=Math.floor(u/f)%85;a+=s[h]}f/=85}u=0}}return a},decode:function(e){for(var n=e.length%5,t=5-(0===n?5:n),i=0;i<t;++i)e+=s[s.length-1];for(var r=e.length,o=new ArrayBuffer(4*r/5-t),u=new DataView(o),c=0,l=0,f=0,d=0;d<r;++d){var h=e.charCodeAt(l++)-32;if(c=85*c+a[h],l%5==0){for(var g=16777216;g>=1;)f<u.byteLength&&u.setUint8(f++,Math.floor(c/g)%256),g/=256;c=0}}return o}}}},e.exports=i()},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=t(0))&&i.__esModule?i:{default:i};var o=function(){var e=new r.default("amb.GraphQLSubscriptionExtension"),n={};this.isGraphQLChannel=function(e){return e&&e.startsWith("/rw/graphql")},this.addGraphQLChannel=function(e,t){n[e]=t},this.removeGraphQLChannel=function(e){delete n[e]},this.getGraphQLSubscriptions=function(){return n},this.outgoing=function(t){return"/meta/subscribe"===t.channel&&this.isGraphQLChannel(t.subscription)&&(t.ext||(t.ext={}),n[t.subscription]&&(e.debug("Subscribing with GraphQL subscription:"+n[t.subscription]),t.ext.serializedGraphQLSubscription=n[t.subscription])),t}};n.default=o},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=(i=t(0))&&i.__esModule?i:{default:i};var o=function(){var e=new r.default("amb.SessionExtension"),n=!1;this.extendSession=function(){n=!0},this.outgoing=function(t){return"/meta/connect"===t.channel&&n&&(t.ext||(t.ext={}),e.debug("extendSession"),t.ext.extendSession=!0,n=!1),t}};n.default=o},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=o(t(0)),r=o(t(1));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(){var e=new i.default("amb.TokenManagementExtension"),n="/meta/subscribe",t="/meta/unsubscribe",o="/meta/handshake",s=r.default.subscribeCommandsFlow.maxInflight,a=[];function u(e){return e.channel==n||e.channel==t}function c(){e.debug("notifyOnAvailabilityOfToken - current tokenCount: "+s);try{a.forEach(function(e){e()})}catch(n){e.addErrorMessage("notifyOnAvailabilityOfToken - failed to call tokenEventListeners. Error Details : "+n)}}this.updateTokenCount=function(e){s=e},this.refillTokens=function(){s=r.default.subscribeCommandsFlow.maxInflight,c(),e.debug("refillTokens -- tokenCount : "+s)},this.outgoing=function(e){return function(e){return e.channel===o}(e)&&(e.ext||(e.ext={}),e.ext.supportsSubscribeCommandFlow=!0),r.default.subscribeCommandsFlow.enable?(u(e)&&s>0&&s--,e):e},this.incoming=function(e){return r.default.subscribeCommandsFlow.enable?(u(e)?(s<r.default.subscribeCommandsFlow.maxInflight&&s++,c()):function(e){if(!e.ext)return!1;var n=e.ext.received_by_glide;return!!n&&n&&u(n)}(e)&&(e=null),e):e},this.getTokenCount=function(){return s},this.addTokenAvailabilityListener=function(n){n&&(e.debug("addTokenAvailabilityListener - tokenEventListener : "+n),a.push(n))},this.removeTokenAvailabilityListener=function(n){if(n){e.debug("removeTokenAvailabilityListener - tokenEventListener : "+n);var t=a.findIndex(function(e){return n===e});-1!==t&&(e.debug("removeTokenAvailabilityListener - removing listener at index : "+t),a.splice(t,1))}}};n.default=s},function(e,n,t){var i;i=function(e){return function(){var n=e,t=n.lib.WordArray;n.enc.Base64={stringify:function(e){var n=e.words,t=e.sigBytes,i=this._map;e.clamp();for(var r=[],o=0;o<t;o+=3)for(var s=(n[o>>>2]>>>24-o%4*8&255)<<16|(n[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|n[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<t;a++)r.push(i.charAt(s>>>6*(3-a)&63));var u=i.charAt(64);if(u)for(;r.length%4;)r.push(u);return r.join("")},parse:function(e){var n=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<i.length;o++)r[i.charCodeAt(o)]=o}var s=i.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(n=a)}return function(e,n,i){for(var r=[],o=0,s=0;s<n;s++)if(s%4){var a=i[e.charCodeAt(s-1)]<<s%4*2,u=i[e.charCodeAt(s)]>>>6-s%4*2;r[o>>>2]|=(a|u)<<24-o%4*8,o++}return t.create(r,o)}(e,n,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64},e.exports=i(t(10))},function(e,n,t){var i;i=function(e){return e.enc.Utf8},e.exports=i(t(10))},function(e,n,t){"use strict";function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"emit",function(e,n){window.localStorage.setItem(e,JSON.stringify(n)),window.localStorage.removeItem(e)}),i(this,"on",function(e,n){window.addEventListener("storage",function(t){var i=t.key,r=t.newValue;i===e&&r&&n(JSON.parse(r))})})};n.default=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:134217727,n=[],t=Math.max(1,Math.floor(e));return{enqueue:function(e){return this.getAvailableSpace()>0&&(n.push(e),!0)},enqueueMultiple:function(e){return this.getAvailableSpace()>=e.length&&(n=n.concat(e),!0)},dequeue:function(){var e;return n.length>0&&(e=n.shift()),e},dequeueMultiple:function(e){var t;return e>=0&&n.length>=e&&(t=[],e>0&&(t=n.slice(0,e),n=n.slice(e))),t},clear:function(){n=[]},getSize:function(){return n.length},getCapacity:function(){return t},getAvailableSpace:function(){return t-n.length},getQueueBuffer:function(){return n}}};n.default=i},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=s(t(1)),r=t(3),o=s(t(0));function s(e){return e&&e.__esModule?e:{default:e}}var a=function(e,n){var t={SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe"},s=202,a=429,u=3e5,c=new o.default("amb.SubscriptionCommandSender");n.addTokenAvailabilityListener(function(){w()});var l=!i.default.subscribeCommandsFlow.enable,f=null;function d(e,n,t){return Math.min(t,Math.max(n,e))}function h(){return n.getTokenCount()>=i.default.subscribeCommandsFlow.maxInflight}function g(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(e||(0,r.isNil)(f)){var t=d(i.default.subscribeCommandsFlow.maxWait,0,u);c.debug("restartTimer - force: "+e+", timerObject : "+f+", timeInterval : "+t),b(),f=setTimeout(function(){f=null,c.debug("onTimer - stopping : "+l),l||(n.refillTokens(),w())},t)}}function b(){(0,r.isNil)(f)||(c.debug("stopTimer"),clearTimeout(f),f=null)}function p(){var e=parseInt(i.default.subscribeCommandsFlow.retryDelay.min);return e=d(e,0,u)}function m(e,n,o,s){var a;c.debug("scheduleRetry - channel : "+e.getName()+", triesLeft : "+n+", mode : "+o);var u=function(e){return d(i.default.subscribeCommandsFlow.retryDelay.increaseFactor*e,i.default.subscribeCommandsFlow.retryDelay.min,i.default.subscribeCommandsFlow.retryDelay.max)}(s);switch(o){case t.SUBSCRIBE:a=function(){return _(e,n,u)};break;case t.UNSUBSCRIBE:a=function(){return C(e,n,u)}}(0,r.isNil)(a)||setTimeout(a,s)}function v(e,t,i,r,o){c.debug("onResponse - response ".concat(JSON.stringify(e),", channel ").concat(JSON.stringify(t),", mode : ").concat(i,", \n\t\t\ttriesLeft ").concat(r,", stopping : ").concat(l,", tokenCount : ").concat(n.getTokenCount(),", isBucketFull - ").concat(h(),", retryDelay - ").concat(o)),l?t.subscriptionCallback(e):(r-=1,h()&&b(),r>0&&function(e){if(c.debug("isRetriable - response : "+e),e&&e.ext){var n=e.ext.rejected_by_glide;if(n){var t=parseInt(e.ext["glide.amb.reply.status.code"]);if(c.addWarnMessage("isRetriable - rejected_by_glide : "+n+", glide.amb.reply.status.code : "+t),!isNaN(t))return t==a||t==s}}return c.debug("isRetriable -  "+!1),!1}(e)?m(t,r,i,o):t.subscriptionCallback(e),w())}function y(n){return c.debug("addItemToQueue - item : "+n),!!e.enqueue(n)&&(w(),!0)}function _(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p();return c.debug("enqueueSubscribe - channel: "+e.getName()+", triesLeft : "+n+", stopping : "+l+", retryDelay : "+o),!!(!l&&(0,r.isObject)(e)&&((0,r.isNil)(n)&&(n=1+Math.floor(i.default.subscribeCommandsFlow.retries)),n>0))&&y(function(){c.debug("enqueueSubscribe - inside the item execution. Calling channel._subscribeToCometD - channel: "+e.getName()+", triesLeft : "+n),e._subscribeToCometD(function(i){return v(i,e,t.SUBSCRIBE,n,o)})})}function C(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p();return c.debug("enqueueUnsubscribe - channel: "+e.getName()+", triesLeft : "+n+", stopping : "+l+", retryDelay : "+o),!!(!l&&(0,r.isObject)(e)&&((0,r.isNil)(n)&&(n=1+Math.floor(i.default.subscribeCommandsFlow.retries)),n>0))&&y(function(){e._unsubscribeFromCometD(function(i){return v(i,e,t.UNSUBSCRIBE,n,o)})})}function w(){var t=Math.min(e.getSize(),d(n.getTokenCount(),0,i.default.subscribeCommandsFlow.maxInflight));c.debug("processQueue - numberToProcess : "+t),t>0&&(e.dequeueMultiple(t).forEach(function(e){return(0,r.isNil)(e)||e()}),g(!1))}return{subscribeToChannel:function(e){return c.debug("subscribeToChannel - to : "+e.getName()),_(e)},unsubscribeToChannel:function(e){return c.debug("unsubscribeToChannel - from : "+e.getName()),C(e)},stop:function(){c.debug("stop"),c.debug("signalStop - stopping : "+l),l||(l=!0,b(),e.clear())},isStopping:function(){return l},getQueue:function(){return e},isBucketEmpty:function(){return!h()},getTimerObject:function(){return f},getTokenCountFromTokenManager:function(){return n.getTokenCount()}}};n.default=a}]);
amb.getClient();
;
/*! RESOURCE: /scripts/app.ng.amb/app.ng.amb.js */
angular.module("ng.amb", ['sn.common.presence', 'sn.common.util'])
.value("ambLogLevel", 'info')
.value("ambServletURI", '/amb')
.value("cometd", angular.element.cometd)
.value("ambLoginWindow", 'true');
;
/*! RESOURCE: /scripts/app.ng.amb/service.AMB.js */
angular.module("ng.amb").service("amb", function (AMBOverlay, $window, $q, $log, $rootScope, $timeout) {
"use strict";
var ambClient = null;
var _window = $window.self;
var loginWindow = null;
var sameScope = false;
ambClient = amb.getClient();
if (_window.g_ambClient) {
sameScope = true;
}
if (sameScope) {
var serverConnection = ambClient.getServerConnection();
serverConnection.loginShow = function() {
if (!serverConnection.isLoginWindowEnabled())
return;
if (loginWindow && loginWindow.isVisible())
return;
if (serverConnection.isLoginWindowOverride())
return;
var modalConfig = {
onBeforeShow: addOverrideStyles
};
loginWindow = new AMBOverlay(modalConfig);
loginWindow.render();
loginWindow.show();
};
serverConnection.loginHide = function() {
if (!loginWindow)
return;
loginWindow.hide();
loginWindow.destroy();
loginWindow = null;
}
}
function addOverrideStyles(el) {
var parent = angular.element(el.target).parent();
var backdrop = parent.find('.modal-backdrop').get(0);
if (backdrop !== undefined)
backdrop.style.cssText = [backdrop.style.cssText, serverConnection.getLoginWindowOverlayStyle()].join('; ');
}
var AUTO_CONNECT_TIMEOUT = 20 * 1000;
var connected = $q.defer();
var connectionInterrupted = false;
var monitorAMB = false;
$timeout(startMonitoringAMB, AUTO_CONNECT_TIMEOUT);
connected.promise.then(startMonitoringAMB);
function startMonitoringAMB() {
monitorAMB = true;
}
function ambInterrupted() {
var state = ambClient.getState();
return monitorAMB && state !== "opened" && state !== "initialized"
}
var interruptionTimeout;
var extendedInterruption = false;
function setInterrupted(eventName) {
connectionInterrupted = true;
$rootScope.$broadcast(eventName);
if (!interruptionTimeout) {
interruptionTimeout = $timeout(function () {
extendedInterruption = true;
}, 30 * 1000)
}
connected = $q.defer();
}
var connectOpenedEventId = ambClient.subscribeToEvent("connection.opened", function () {
$rootScope.$broadcast("amb.connection.opened");
if (interruptionTimeout) {
$timeout.cancel(interruptionTimeout);
interruptionTimeout = null;
}
extendedInterruption = false;
if(connectionInterrupted) {
connectionInterrupted = false;
$rootScope.$broadcast("amb.connection.recovered");
}
connected.resolve();
});
var connectClosedEventId = ambClient.subscribeToEvent("connection.closed", function () {
setInterrupted("amb.connection.closed");
});
var connectBrokenEventId = ambClient.subscribeToEvent("connection.broken", function () {
setInterrupted("amb.connection.broken");
});
var connectSessionLoggedin = ambClient.subscribeToEvent("session.logged.in", function () {
$rootScope.$broadcast("amb.session.logged.in");
});
var connectSessionReestablished = ambClient.subscribeToEvent("session.reestablished", function () {
$rootScope.$broadcast("amb.session.reestablished");
});
var onUnloadWindow = function() {
ambClient.unsubscribeFromEvent(connectOpenedEventId);
ambClient.unsubscribeFromEvent(connectClosedEventId);
ambClient.unsubscribeFromEvent(connectBrokenEventId);
angular.element($window).off('unload', onUnloadWindow);
};
angular.element($window).on('unload', onUnloadWindow);
var defaultAmbConnectionTimeout = 10000;
var shouldDeferAmbConnection = _window.NOW && _window.NOW.hasOwnProperty('deferAmbConnection') ?
_window.NOW.deferAmbConnection : false;
var deferredAmbConnectionTimeout = _window.NOW && _window.NOW.hasOwnProperty('deferredAmbConnectionTimeout') &&
isValidAmbConnectionTimeout(_window.NOW.deferredAmbConnectionTimeout) ?
_window.NOW.deferredAmbConnectionTimeout :
defaultAmbConnectionTimeout;
if (shouldDeferAmbConnection) {
$timeout(autoConnect, deferredAmbConnectionTimeout);
} else {
var documentReadyState = _window.document ? _window.document.readyState : null;
if (documentReadyState === 'complete')
autoConnect();
else
_window.addEventListener('load', autoConnect);
$timeout(autoConnect, defaultAmbConnectionTimeout);
}
function isInteger(num) {
return parseInt(num, 10) === num;
}
function isValidAmbConnectionTimeout(timeout) {
return isInteger(timeout) && timeout > 0;
}
var initiatedConnection = false;
function autoConnect() {
if (!initiatedConnection) {
initiatedConnection = true;
ambClient.connect();
}
}
return {
getServerConnection: function() {
return ambClient.getServerConnection();
},
connect: function() {
if (initiatedConnection) {
ambClient.connect();
}
return connected.promise;
},
get interrupted() {
return ambInterrupted();
},
get extendedInterruption() {
return extendedInterruption;
},
get connected() {
return connected.promise;
},
abort: function() {
ambClient.abort();
},
disconnect: function() {
ambClient.disconnect();
},
getConnectionState: function () {
return ambClient.getConnectionState();
},
getClientId: function () {
return ambClient.getClientId();
},
getChannel: function(channelName) {
return ambClient.getChannel(channelName);
},
registerExtension: function(extensionName, extension) {
ambClient.registerExtension(extensionName, extension);
},
unregisterExtension: function(extensionName) {
ambClient.unregisterExtension(extensionName);
},
batch: function(batch) {
ambClient.batch(batch);
},
getState: function() {
return ambClient.getState();
},
getFilterString: function(filter) {
filter = filter.
replace(/\^EQ/g, '').
replace(/\^ORDERBY(?:DESC)?[^^]*/g, '').
replace(/^GOTO/, '');
return btoa(unescape(encodeURIComponent(filter))).replace(/=/g, '-');
},
getChannelRW: function(table, filter) {
var t = '/rw/default/' + table + '/' + this.getFilterString(filter);
return this.getChannel(t);
},
isLoggedIn: function() {
return ambClient.isLoggedIn();
},
subscribeToEvent: function(event, callback) {
return ambClient.subscribeToEvent(event, callback);
},
getConnectionEvents: function() {
return ambClient.getConnectionEvents();
},
getEvents: function() {
return ambClient.getConnectionEvents();
},
loginComplete: function() {
ambClient.loginComplete();
}
};
});
;
/*! RESOURCE: /scripts/app.ng.amb/controller.AMBRecordWatcher.js */
angular.module("ng.amb").controller("AMBRecordWatcher", function($scope, $timeout, $window) {
"use strict";
var amb = $window.top.g_ambClient;
$scope.messages = [];
var lastFilter;
var watcherChannel;
var watcher;
function onMessage(message) {
$scope.messages.push(message.data);
}
$scope.getState = function() {
return amb.getState();
};
$scope.initWatcher = function() {
angular.element(":focus").blur();
if(!$scope.filter || $scope.filter === lastFilter)
return;
lastFilter = $scope.filter;
console.log("initiating watcher on " + $scope.filter);
$scope.messages = [];
if(watcher) {
watcher.unsubscribe();
}
var base64EncodeQuery = btoa($scope.filter).replace(/=/g, '-');
var channelId = '/rw/' + base64EncodeQuery;
watcherChannel = amb.getChannel(channelId)
watcher = watcherChannel.subscribe(onMessage);
};
amb.connect();
})
;
/*! RESOURCE: /scripts/app.ng.amb/factory.snRecordWatcher.js */
angular.module("ng.amb").factory('snRecordWatcher', function($rootScope, amb, $timeout, snPresence, $log, urlTools) {
"use strict";
var diagnosticLog = true;
function initWatcher(table, sys_id, query) {
if (!table)
return;
if (sys_id)
var filter = "sys_id=" + sys_id;
else
filter = query;
if (!filter)
return;
return initChannel(table, filter);
}
function initList(table, query) {
if (!table)
return;
query = query || "sys_idISNOTEMPTY";
return initChannel(table, query);
}
function initTaskList(list, prevChannel) {
if (prevChannel)
prevChannel.unsubscribe();
var sys_ids = list.toString();
var filter = "sys_idIN" + sys_ids;
return initChannel("task", filter);
}
function initChannel(table, filter, callbackFn) {
if (isBlockedTable(table)) {
$log.log("Blocked from watching", table);
return null;
}
if (diagnosticLog)
log(">>> init " + table + "?" + filter);
var watcherChannel = amb.getChannelRW(table, filter);
watcherChannel.subscribe(callbackFn || onMessage);
amb.connect();
return watcherChannel;
}
function onMessage(message) {
var r = message.data;
var c = message.channel;
if (diagnosticLog)
log(">>> record " + r.operation + ": " + r.table_name + "." + r.sys_id + " " + r.display_value);
$rootScope.$broadcast('record.updated', r);
$rootScope.$broadcast('list.updated', r, c);
}
function log(message) {
$log.log(message);
}
function isBlockedTable(table) {
return table == 'sys_amb_message' || table.startsWith('sys_rw');
}
return {
initTaskList: initTaskList,
initChannel: initChannel,
init: function () {
var location = urlTools.parseQueryString(window.location.search);
var table = location['table'] || location['sysparm_table'];
var sys_id = location['sys_id'] || location['sysparm_sys_id'];
var query = location['sysparm_query'];
initWatcher(table, sys_id, query);
snPresence.init(table, sys_id, query);
},
initList:  initList,
initRecord: function(table, sysId) {
initWatcher(table, sysId, null);
snPresence.initPresence(table, sysId);
},
_initWatcher: initWatcher
}
});
;
/*! RESOURCE: /scripts/app.ng.amb/factory.AMBOverlay.js */
angular.module("ng.amb").factory("AMBOverlay", function($templateCache, $compile, $rootScope) {
"use strict";
var showCallbacks = [],
beforeShowCallbacks = [],
hideCallbacks = [],
isRendered = false,
modal,
modalScope,
modalOptions;
var defaults = {
backdrop: 'static',
keyboard: false,
show: true
};
function AMBOverlay(config) {
config = config || {};
if(angular.isFunction(config.onBeforeShow))
beforeShowCallbacks.push(config.onBeforeShow);
if(angular.isFunction(config.onShow))
showCallbacks.push(config.onShow);
if(angular.isFunction(config.onHide))
hideCallbacks.push(config.onHide);
function lazyRender() {
if(!angular.element('html')['modal']) {
var bootstrapInclude = "/scripts/bootstrap3/bootstrap.js";
ScriptLoader.getScripts([bootstrapInclude], renderModal);
} else
renderModal();
}
function renderModal() {
if(isRendered)
return;
modalScope = angular.extend($rootScope.$new(), config);
modal = $compile($templateCache.get("amb_disconnect_modal.xml"))(modalScope);
angular.element("body").append(modal);
modal.on("show.bs.modal", function (e) {
for(var i = 0, len = beforeShowCallbacks.length; i < len; i++)
beforeShowCallbacks[i](e);
});
modal.on("shown.bs.modal", function(e) {
for(var i = 0, len = showCallbacks.length; i < len; i++)
showCallbacks[i](e);
});
modal.on("hidden.bs.modal", function(e) {
for(var i = 0, len = hideCallbacks.length; i < len; i++)
hideCallbacks[i](e);
});
modalOptions = angular.extend({}, defaults, config);
modal.modal(modalOptions);
isRendered = true;
}
function showModal() {
if(isRendered)
modal.modal('show');
}
function hideModal() {
if(isRendered)
modal.modal('hide');
}
function destroyModal() {
if(!isRendered)
return;
modal.modal('hide');
modal.remove();
modalScope.$destroy();
modalScope = void(0);
isRendered = false;
var pos = showCallbacks.indexOf(config.onShow);
if(pos >= 0)
showCallbacks.splice(pos, 1);
pos = hideCallbacks.indexOf(config.onShow);
if(pos >= 0)
hideCallbacks.splice(pos, 1);
}
return {
render: lazyRender,
destroy: destroyModal,
show: showModal,
hide: hideModal,
isVisible: function() {
if(!isRendered)
return false;
return modal.visible();
}
}
}
$templateCache.put('amb_disconnect_modal.xml',
'<div id="amb_disconnect_modal" tabindex="-1" aria-hidden="true" class="modal" role="dialog">' +
'	<div class="modal-dialog small-modal" style="width:450px">' +
'		<div class="modal-content">' +
'			<header class="modal-header">' +
'				<h4 id="small_modal1_title" class="modal-title">{{title || "Login"}}</h4>' +
'			</header>' +
'			<div class="modal-body">' +
'			<iframe class="concourse_modal" ng-src=\'{{iframe || "/amb_login.do"}}\' frameborder="0" scrolling="no" height="400px" width="405px"></iframe>' +
'			</div>' +
'		</div>' +
'	</div>' +
'</div>'
);
return AMBOverlay;
});
;
;
/*! RESOURCE: /scripts/sn/common/presence/snPresenceLite.js */
(function(exports, $) {
'use strict';
var PRESENCE_DISABLED = "false" === "true";
if (PRESENCE_DISABLED) {
return;
}
if (typeof $.Deferred === "undefined") {
return;
}
var USER_KEY = '{{SYSID}}';
var REPLACE_REGEX = new RegExp(USER_KEY, 'g');
var COLOR_ONLINE = '#71e279';
var COLOR_AWAY = '#fc8a3d';
var COLOR_OFFLINE = 'transparent';
var BASE_STYLES = [
'.sn-presence-lite { display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; }'
];
var USER_STYLES = [
'.sn-presence-'+ USER_KEY +'-online [data-presence-id="'+ USER_KEY +'"] { background-color: '+ COLOR_ONLINE +'; }',
'.sn-presence-'+ USER_KEY +'-away [data-presence-id="'+ USER_KEY +'"] { background-color: '+ COLOR_AWAY +'; }',
'.sn-presence-'+ USER_KEY +'-offline [data-presence-id="'+ USER_KEY +'"] { background-color: '+ COLOR_OFFLINE +'; }'
];
var $head = $('head');
var stylesheet = $.Deferred();
var registeredUsers = {};
var registeredUsersLength = 0;
$(function() {
updateRegisteredUsers();
});
$head.ready(function() {
var styleElement = document.createElement('style');
$head.append(styleElement);
var $styleElement = $(styleElement);
stylesheet.resolve($styleElement);
});
function updateStyles(styles) {
stylesheet.done(function($styleElement) {
$styleElement.empty();
BASE_STYLES.forEach(function(baseStyle) {
$styleElement.append(baseStyle);
});
$styleElement.append(styles);
});
}
function getUserStyles(sysId) {
var newStyles = '';
for (var i = 0, iM = USER_STYLES.length; i < iM; i++) {
newStyles += USER_STYLES[i].replace(REPLACE_REGEX, sysId);
}
return newStyles;
}
function updateUserStyles() {
var userKeys = Object.keys(registeredUsers);
var userStyles = "";
userKeys.forEach(function(userKey) {
userStyles += getUserStyles(userKey);
});
updateStyles(userStyles);
}
exports.applyPresenceArray = applyPresenceArray;
function applyPresenceArray(presenceArray) {
if (!presenceArray || !presenceArray.length) {
return;
}
var users = presenceArray.filter(function(presence) {
return typeof registeredUsers[presence.user] !== "undefined";
});
updateUserPresenceStatus(users);
}
function updateUserPresenceStatus(users) {
var presenceStatus = getBaseCSSClasses();
for (var i = 0, iM = users.length; i < iM; i++) {
var presence = users[i];
var status = getNormalizedStatus(presence.status);
if (status === 'offline') {
continue;
}
presenceStatus.push('sn-presence-' + presence.user + '-' + status);
}
setCSSClasses(presenceStatus.join(' '));
}
function getNormalizedStatus(status) {
switch (status) {
case 'probably offline':
case 'maybe offline':
return 'away';
default:
return 'offline';
case 'online':
case 'offline':
return status;
}
}
function updateRegisteredUsers() {
var presenceIndicators = document.querySelectorAll('[data-presence-id]');
var obj = {};
for (var i = 0, iM = presenceIndicators.length; i < iM; i++) {
var uid = presenceIndicators[i].getAttribute('data-presence-id');
obj[uid] = true;
}
if (Object.keys(obj).length === registeredUsersLength){
return;
}
registeredUsers = obj;
registeredUsersLength = Object.keys(registeredUsers).length;
updateUserStyles();
}
function setCSSClasses(classes) {
$('html')[0].className = classes;
}
function getBaseCSSClasses() {
return $('html')[0].className.split(' ').filter(function(item){
return item.indexOf('sn-presence-') !== 0;
});
}
})(window, window.jQuery || window.Zepto);
;
/*! RESOURCE: /scripts/sn/common/presence/_module.js */
angular.module('sn.common.presence', ['ng.amb', 'sn.common.glide', 'sn.common.auth']).config(function($provide) {
"use strict";
$provide.constant("PRESENCE_DISABLED", "false" === "true");
});
;
/*! RESOURCE: /scripts/sn/common/presence/factory.snPresence.js */
angular.module("sn.common.presence").factory('snPresence', function($rootScope, $window, $log, amb, $timeout, $http, snRecordPresence, snTabActivity, urlTools, PRESENCE_DISABLED) {
"use strict";
var REST = {
PRESENCE: "/api/now/ui/presence"
};
var RETRY_INTERVAL = ($window.NOW.presence_interval || 60) * 1000;
var MAX_RETRY_DELAY = RETRY_INTERVAL * 10;
var initialized = false;
var primary = false;
var presenceArray = [];
var serverTimeMillis;
var skew = 0;
var st = 0;
function init() {
var location = urlTools.parseQueryString($window.location.search);
var table = location['table'] || location['sysparm_table'];
var sys_id = location['sys_id'] || location['sysparm_sys_id'];
return initPresence(table, sys_id);
}
function initPresence(t, id) {
if(PRESENCE_DISABLED)
return;
if (!initialized) {
initialized = true;
initRootScopes();
if (!primary) {
CustomEvent.observe('sn.presence', onPresenceEvent);
CustomEvent.fireTop('sn.presence.ping');
} else {
presenceArray = getLocalPresence($window.localStorage.getItem('snPresence'));
if (presenceArray)
$timeout(schedulePresence, 100);
else
updatePresence();
}
}
return snRecordPresence.initPresence(t, id);
}
function isTopWindow() {
var topWindow = window.self;
try {
while (topWindow.CustomEvent.fireEvent
&& topWindow !== topWindow.parent
&& !topWindow.parent.NOW.isPolarisWrapper
&& topWindow.parent.CustomEvent.fireEvent) {
topWindow = topWindow.parent;
}
} catch (e) {}
return topWindow == window.self;
}
function onPresenceEvent(parms) {
presenceArray = parms;
$timeout(broadcastPresence);
}
function initRootScopes() {
if ($window.NOW.presence_scopes) {
var ps = $window.NOW.presence_scopes;
if (ps.indexOf($rootScope) == -1)
ps.push($rootScope);
} else {
$window.NOW.presence_scopes = [$rootScope];
primary = isTopWindow();
}
}
function setPresence(data, st) {
var rt = new Date().getTime() - st;
if (rt > 500)
console.log("snPresence response time " + rt + "ms");
if (data.result && data.result.presenceArray) {
presenceArray = data.result.presenceArray;
setLocalPresence(presenceArray);
serverTimeMillis = data.result.serverTimeMillis;
skew = new Date().getTime() - serverTimeMillis;
var t  = Math.floor(skew / 1000);
if (t < -15 )
console.log(">>>>> server ahead " + Math.abs(t) + " seconds");
else if (t > 15)
console.log(">>>>> browser time ahead " + t + " seconds");
}
schedulePresence();
}
function updatePresence(numAttempts) {
presenceArray = getLocalPresence($window.localStorage.getItem('snPresence'));
if (presenceArray) {
determineStatus(presenceArray);
$timeout(schedulePresence);
return;
}
if (!amb.isLoggedIn() || !snTabActivity.isPrimary) {
$timeout(schedulePresence);
return;
}
var p = {
user_agent: navigator.userAgent,
ua_time: new Date().toISOString(),
href: window.location.href,
pathname: window.location.pathname,
search: window.location.search,
path: window.location.pathname + window.location.search
};
st = new Date().getTime();
$http.post(REST.PRESENCE + '?sysparm_auto_request=true&cd=' + st, p).success(function(data) {
setPresence(data, st);
}).error(function(response, status) {
console.log("snPresence " + status);
schedulePresence(numAttempts);
})
}
function schedulePresence(numAttempts) {
numAttempts = isFinite(numAttempts) ? numAttempts + 1 : 0;
var interval = getDecayingRetryInterval(numAttempts);
$timeout(function() {
updatePresence(numAttempts)
}, interval);
determineStatus(presenceArray);
broadcastPresence();
}
function broadcastPresence() {
if (angular.isDefined($window.applyPresenceArray)) {
$window.applyPresenceArray(presenceArray);
}
$rootScope.$emit("sn.presence", presenceArray);
if (!primary)
return;
CustomEvent.fireAll('sn.presence', presenceArray);
}
function determineStatus(presenceArray) {
if (!presenceArray || !presenceArray.forEach)
return;
var t = new Date().getTime();
t -= skew;
presenceArray.forEach(function (p) {
var x = 0 + p.last_on;
var y = t - x;
p.status = "online";
if (y > (5 * RETRY_INTERVAL))
p.status = "offline";
else if (y > (3 * RETRY_INTERVAL))
p.status = "probably offline";
else if (y > (2.5 * RETRY_INTERVAL))
p.status = "maybe offline";
})
}
function setLocalPresence(value) {
var p = {
saved: new $window.Date().getTime(),
presenceArray: value
};
$window.localStorage.setItem('snPresence', angular.toJson(p));
}
function getLocalPresence(p) {
if (!p)
return null;
try {
p = angular.fromJson(p);
} catch (e) {
p = {};
}
if (!p.presenceArray)
return null;
var now = new Date().getTime();
if (now - p.saved >= RETRY_INTERVAL)
return null;
return p.presenceArray;
}
function getDecayingRetryInterval(numAttempts) {
return Math.min(RETRY_INTERVAL * Math.pow(2, numAttempts), MAX_RETRY_DELAY);
}
return {
init: init,
initPresence: initPresence,
_getLocalPresence: getLocalPresence,
_setLocalPresence: setLocalPresence,
_determineStatus: determineStatus
}
});
;
/*! RESOURCE: /scripts/sn/common/presence/factory.snRecordPresence.js */
angular.module("sn.common.presence").factory('snRecordPresence', function($rootScope, $location, amb, $timeout, $window, PRESENCE_DISABLED, snTabActivity) {
"use strict";
var statChannel;
var interval = ($window.NOW.record_presence_interval || 20) * 1000;
var sessions = {};
var primary = false;
var currentJournalFieldName = "";
var prevJournalFieldName = "";
var table;
var sys_id;
function initPresence(t, id) {
if(PRESENCE_DISABLED)
return;
if (!t || !id)
return;
if (t == table && id == sys_id)
return;
initRootScopes();
if (!primary)
return;
termPresence();
table = t;
sys_id = id;
var recordPresence = "/sn/rp/" + table + "/" + sys_id;
$rootScope.me = NOW.session_id;
statChannel = amb.getChannel(recordPresence);
statChannel.subscribe(onStatus);
amb.connected.then(function() {
setStatus("entered");
$rootScope.status = "viewing";
});
return statChannel;
}
function initRootScopes() {
if ($window.NOW.record_presence_scopes) {
var ps = $window.NOW.record_presence_scopes;
if (ps.indexOf($rootScope) == -1) {
ps.push($rootScope);
CustomEvent.observe('sn.sessions', onPresenceEvent);
}
} else {
$window.NOW.record_presence_scopes = [$rootScope];
primary = true;
}
}
function onPresenceEvent(sessionsToSend) {
$rootScope.$emit("sn.sessions", sessionsToSend);
$rootScope.$emit("sp.sessions", sessionsToSend);
}
function termPresence() {
if (!statChannel)
return;
statChannel.unsubscribe();
statChannel = table = sys_id = null;
}
function setStatus(status) {
if (status == $rootScope.status && prevJournalFieldName === currentJournalFieldName)
return;
prevJournalFieldName = currentJournalFieldName;
$rootScope.status = status;
if (Object.keys(sessions).length == 0)
return;
if (getStatusPrecedence(status) > 1)
return;
publish($rootScope.status);
}
function publish(status) {
if (!statChannel)
return;
if (amb.getState() !== "opened")
return;
statChannel.publish({ presences: [{
status : status,
session_id : NOW.session_id,
user_name : NOW.user_name,
user_id: NOW.user_id,
user_display_name : NOW.user_display_name,
user_initials : NOW.user_initials,
user_avatar: NOW.user_avatar,
ua : navigator.userAgent,
table: table,
sys_id: sys_id,
field_type: currentJournalFieldName,
time: new Date().toString().substring(0,24)
}]});
}
function onStatus(message) {
message.data.presences.forEach(function(d){
if (!d.session_id || d.session_id == NOW.session_id)
return;
var s = sessions[d.session_id];
if (s)
angular.extend(s, d);
else
s = sessions[d.session_id] = d;
s.lastUpdated = new Date();
if (s.status == 'exited')
delete sessions[d.session_id];
});
broadcastSessions();
}
function broadcastSessions() {
var sessionsToSend = getUniqueSessions();
$rootScope.$emit("sn.sessions", sessionsToSend);
$rootScope.$emit("sp.sessions", sessionsToSend);
if (primary)
$timeout(function() {CustomEvent.fire('sn.sessions', sessionsToSend);})
}
function getUniqueSessions() {
var uniqueSessionsByUser = {};
var sessionKeys = Object.keys(sessions);
sessionKeys.forEach(function(key) {
var session = sessions[key];
if (session.user_id == NOW.user_id)
return;
if (session.user_id in uniqueSessionsByUser) {
var otherSession = uniqueSessionsByUser[session.user_id];
var thisPrecedence = getStatusPrecedence(session.status);
var otherPrecedence = getStatusPrecedence(otherSession.status);
uniqueSessionsByUser[session.user_id] = thisPrecedence < otherPrecedence ? session : otherSession;
return
}
uniqueSessionsByUser[session.user_id] = session;
});
var uniqueSessions = {};
angular.forEach(uniqueSessionsByUser, function(item) {
uniqueSessions[item.session_id] = item;
});
return uniqueSessions;
}
function getStatusPrecedence(status) {
switch (status) {
case 'typing':
return 0;
case 'viewing':
return 1;
case 'entered':
return 2;
case 'exited':
case 'probably left':
return 4;
case 'offline':
return 5;
default:
return 3;
}
}
$rootScope.$on("record.typing", function(evt, data) {
currentJournalFieldName = data.field_type;
setStatus(data.status);
});
var idleTable, idleSysID;
snTabActivity.onIdle({
onIdle: function RecordPresenceTabIdle() {
idleTable = table;
idleSysID = sys_id;
sessions = {};
termPresence();
broadcastSessions();
},
onReturn: function RecordPresenceTabActive() {
initPresence(idleTable, idleSysID, true);
idleTable = idleSysID = void(0);
},
delay: interval * 4
});
return {
initPresence: initPresence,
termPresence: termPresence
}
});
;
/*! RESOURCE: /scripts/sn/common/presence/directive.snPresence.js */
angular.module('sn.common.presence').directive('snPresence', function(snPresence, $rootScope, $timeout, i18n) {
'use strict';
$timeout(snPresence.init, 100);
var presenceStatus = {};
i18n.getMessages(['maybe offline', 'probably offline', 'offline', 'online', 'entered', 'viewing'], function (results) {
presenceStatus.maybe_offline = results['maybe offline'];
presenceStatus.probably_offline = results['probably offline'];
presenceStatus.offline = results['offline'];
presenceStatus.online = results['online'];
presenceStatus.entered = results['entered'];
presenceStatus.viewing = results['viewing'];
});
var presences = {};
$rootScope.$on('sn.presence', function (event, presenceArray) {
angular.forEach(presences, function (p) {
p.status = "offline";
});
if (!presenceArray) {
return;
}
presenceArray.forEach(function (presence) {
presences[presence.user] = presence;
});
});
return {
restrict: 'EA',
replace: false,
scope: {
userId: '@?',
snPresence: '=?',
user: '=?',
profile: '=?',
displayName: '=?'
},
link: function (scope, element) {
if (scope.profile) {
scope.user = scope.profile.userID;
scope.profile.tabIndex = -1;
if (scope.profile.isAccessible)
scope.profile.tabIndex = 0;
}
if (!element.hasClass('presence'))
element.addClass('presence');
function updatePresence () {
var id = scope.snPresence || scope.user;
if (!angular.isDefined(id) && angular.isDefined(scope.userId)) {
id = scope.userId;
}
if (presences[id]) {
var status = presences[id].status;
if (status === 'maybe offline' || status === 'probably offline') {
element.removeClass('presence-online presence-offline presence-away');
element.addClass('presence-away');
} else if (status == "offline" && !element.hasClass('presence-offline')) {
element.removeClass('presence-online presence-away');
element.addClass('presence-offline');
} else if ( (status == "online" || status == "entered" || status == "viewing") && !element.hasClass('presence-online')) {
element.removeClass('presence-offline presence-away');
element.addClass('presence-online');
}
status = status.replace(/ /g,"_");
if (scope.profile)
angular.element('div[user-avatar-id="' + id + '"]').attr("aria-label", scope.profile.userName + ' ' + presenceStatus[status]);
else
angular.element('div[user-avatar-id="' + id + '"]').attr("aria-label", scope.displayName + ' ' + presenceStatus[status]);
} else {
if (!element.hasClass('presence-offline'))
element.addClass('presence-offline');
}
}
var unbind = $rootScope.$on('sn.presence', updatePresence);
scope.$on('$destroy', unbind);
updatePresence();
}
};
});
;
/*! RESOURCE: /scripts/sn/common/presence/directive.snComposing.js */
angular.module('sn.common.presence').directive('snComposing', function(getTemplateUrl, snComposingPresence) {
"use strict";
return {
restrict: 'E',
templateUrl: getTemplateUrl("snComposing.xml"),
replace: true,
scope: {
conversation: "="
},
controller: function($scope, $element) {
var child = $element.children();
if (child && child.tooltip)
child.tooltip({
'template':	'<div class="tooltip" style="white-space: pre-wrap" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
'placement': 'top',
'container': 'body'
});
$scope.snComposingPresence = snComposingPresence;
}
}
});
;
/*! RESOURCE: /scripts/sn/common/presence/service.snComposingPresence.js */
angular.module('sn.common.presence').service('snComposingPresence', function(i18n) {
"use strict";
var viewing = {};
var typing = {};
var allStrings = {};
var shortStrings = {};
var typing1="{0} is typing", typing2="{0} and {1} are typing", typingMore="{0}, {1}, and {2} more are typing", viewing1="{0} is viewing",viewing2="{0} and {1} are viewing",viewingMore="{0}, {1}, and {2} more are viewing";
i18n.getMessages(
[
typing1,
typing2,
typingMore,
viewing1,
viewing2,
viewingMore
],
function (results) {
typing1=results[typing1];
typing2=results[typing2];
typingMore=results[typingMore];
viewing1=results[viewing1];
viewing2=results[viewing2];
viewingMore=results[viewingMore];
});
function set(conversationID, newPresenceValues) {
if (newPresenceValues.viewing)
viewing[conversationID] = newPresenceValues.viewing;
if (newPresenceValues.typing)
typing[conversationID] = newPresenceValues.typing;
generateAllString(conversationID, {viewing: viewing[conversationID],typing: typing[conversationID]});
generateShortString(conversationID, {viewing: viewing[conversationID],typing: typing[conversationID]});
return {
viewing: viewing[conversationID],
typing: typing[conversationID]
}
}
function get(conversationID) {
return {
viewing: viewing[conversationID] || [],
typing: typing[conversationID] || []
}
}
function generateAllString(conversationID, members) {
var result = "";
var typingLength = members.typing.length;
var viewingLength = members.viewing.length;
if (typingLength < 4 && viewingLength < 4)
return "";
switch (typingLength) {
case 0:
break;
case 1:
result += i18n.format(typing1, members.typing[0].name); break;
case 2:
result += i18n.format(typing2, members.typing[0].name, members.typing[1].name); break;
default:
var allButLastTyper = "";
for (var i = 0; i < typingLength; i++) {
if (i < typingLength -2)
allButLastTyper += members.typing[i].name + ", ";
else if (i === typingLength-2)
allButLastTyper += members.typing[i].name + ",";
else
result += i18n.format(typing2, allButLastTyper, members.typing[i].name);
}
}
if (viewingLength > 0 && typingLength > 0)
result += "\n\n";
switch (viewingLength) {
case 0:
break;
case 1:
result += i18n.format(viewing1, members.viewing[0].name); break;
case 2:
result += i18n.format(viewing2, members.viewing[0].name, members.viewing[1].name); break;
default:
var allButLastViewer = "";
for (var i = 0; i < viewingLength; i++) {
if (i < viewingLength -2)
allButLastViewer += members.viewing[i].name + ", ";
else if (i === viewingLength - 2)
allButLastViewer += members.viewing[i].name + ",";
else
result += i18n.format(viewing2, allButLastViewer, members.viewing[i].name);
}
}
allStrings[conversationID] = result;
}
function generateShortString(conversationID, members) {
var typingLength = members.typing.length;
var viewingLength = members.viewing.length;
var typingString = "", viewingString = "";
var inBetween = " ";
switch (typingLength ) {
case 0:
break;
case 1:
typingString = i18n.format(typing1, members.typing[0].name); break;
case 2:
typingString = i18n.format(typing2, members.typing[0].name, members.typing[1].name); break;
case 3:
typingString = i18n.format(typing2, members.typing[0].name + ", " + members.typing[1].name + ",",members.typing[2].name); break;
default:
typingString = i18n.format(typingMore, members.typing[0].name, members.typing[1].name, (typingLength - 2));
}
if (viewingLength > 0 && typingLength > 0)
inBetween = ". ";
switch (viewingLength) {
case 0:
break;
case 1:
viewingString = i18n.format(viewing1,  members.viewing[0].name); break;
case 2:
viewingString = i18n.format(viewing2, members.viewing[0].name, members.viewing[1].name); break;
case 3:
viewingString = i18n.format(viewing2, members.viewing[0].name + ", " + members.viewing[1].name + ",", members.viewing[2].name); break;
default:
viewingString = i18n.format(viewingMore, members.viewing[0].name, members.viewing[1].name, (viewingLength - 2));
}
shortStrings[conversationID] = typingString + inBetween + viewingString;
}
function getAllString(conversationID) {
if ((viewing[conversationID] && viewing[conversationID].length > 3)
|| (typing[conversationID] && typing[conversationID].length > 3))
return allStrings[conversationID];
return "";
}
function getShortString(conversationID) {
return shortStrings[conversationID];
}
function remove(conversationID) {
delete viewing[conversationID];
}
return {
set: set,
get: get,
generateAllString: generateAllString,
getAllString: getAllString,
generateShortString: generateShortString,
getShortString: getShortString,
remove: remove
}
});
;
;
/*! RESOURCE: /scripts/sn/common/user_profile/js_includes_user_profile.js */
/*! RESOURCE: /scripts/sn/common/user_profile/_module.js */
angular.module("sn.common.user_profile", ['sn.common.ui']);
;
/*! RESOURCE: /scripts/sn/common/user_profile/directive.snUserProfile.js */
angular.module('sn.common.user_profile').directive('snUserProfile', function(getTemplateUrl, snCustomEvent, $window, avatarProfilePersister, $timeout, $http, $injector) {
"use strict";
return {
replace: true,
restrict: 'E',
templateUrl: getTemplateUrl('snUserProfile.xml'),
scope: {
profile: "=",
showDirectMessagePrompt: "="
},
link: function(scope, element) {
scope.showDirectMessagePromptFn = function() {
if ($injector.has('inSupportClient') && $injector.get('inSupportClient'))
return false;
if (scope.showDirectMessagePrompt) {
var activeUserID = $window.NOW.user_id || "";
return !(!scope.profile
|| activeUserID === scope.profile.sysID
|| !scope.profile.hasConnectRoles
|| (scope.profile.document && activeUserID === scope.profile.document));
} else {
return false;
}
};
},
controller: function($scope, snConnectService) {
if ($scope.profile && $scope.profile.userID && avatarProfilePersister.getAvatar($scope.profile.userID)) {
$scope.profile = avatarProfilePersister.getAvatar($scope.profile.userID);
$scope.$emit("sn-user-profile.ready");
} else {
$http.get('/api/now/live/profiles/sys_user.' + $scope.profile.userID).then(function (response) {
angular.merge($scope.profile, response.data.result);
avatarProfilePersister.setAvatar($scope.profile.userID, $scope.profile);
$scope.$emit("sn-user-profile.ready");
})
}
$http.get('/api/now/live/profiles/' + $scope.profile.userID + '/has_connect_roles').then(function(response) {
$scope.profile.hasConnectRoles = response.data.result.hasConnectRoles;
});
$scope.openDirectMessageConversation = function(evt) {
if (evt && evt.keyCode === 9)
return;
$timeout(function () {
snConnectService.openWithProfile($scope.profile);
}, 0, false);
angular.element('.popover').each(function() {
angular.element('body').off('click.snUserAvatarPopoverClose');
angular.element(this).popover('hide');
});
};
}
};
});
;
;
/*! RESOURCE: /scripts/sn/common/avatar/_module.js */
angular.module('sn.common.avatar', ['sn.common.presence', 'sn.common.messaging', 'sn.common.user_profile']).config(function($provide) {
$provide.value("liveProfileID", '');
});
;
/*! RESOURCE: /scripts/sn/common/avatar/directive.snAvatarPopover.js */
angular.module('sn.common.avatar').directive('snAvatarPopover', function($http, $compile, getTemplateUrl, avatarProfilePersister, $injector) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sn_avatar_popover.xml'),
replace: true,
transclude: true,
scope : {
members: '=',
primary: '=?',
showPresence: '=?',
enableContextMenu: '=?',
enableTooltip: '=?',
enableBindOnce: '@',
displayMemberCount: "=?",
groupAvatar: "@",
nopopover: "=",
directconversation: '@',
conversation: '=',
primaryNonAssign: '=?'
},
compile: function(tElement) {
var template = tElement.html();
return function (scope, element, attrs, controller, transcludeFn) {
if (scope.directconversation) {
if (scope.directconversation === "true")
scope.directconversation = true;
else
scope.directconversation = false;
scope.showdirectconversation = !scope.directconversation;
} else {
scope.showdirectconversation = true;
}
if ($injector.has('inSupportClient') && $injector.get('inSupportClient'))
scope.showdirectconversation = false;
if (scope.primaryNonAssign) {
scope.primary = angular.extend({}, scope.primary, scope.primaryNonAssign);
if (scope.users && scope.users[0])
scope.users[0] = scope.primary;
}
function recompile () {
if (scope.primaryNonAssign) {
scope.primary = angular.extend({}, scope.primary, scope.primaryNonAssign);
if (scope.users && scope.users[0])
scope.users[0] = scope.primary;
}
var newElement = $compile(template, transcludeFn)(scope);
element.html(newElement);
if (scope.enableTooltip) {
element.tooltip({
placement: 'auto top',
container: 'body'
}).attr('data-original-title', scope.users[0].name).tooltip('fixTitle');
if (element.hideFix)
element.hideFix();
}
}
if (attrs.enableBindOnce === 'false') {
scope.$watch('primary', recompile);
scope.$watch('primaryNonAssign', recompile);
scope.$watch('members', recompile);
}
if (scope.enableTooltip && scope.nopopover) {
var usersWatch = scope.$watch('users', function () {
if (scope.users && scope.users.length === 1 && scope.users[0] && scope.users[0].name) {
element.tooltip({
placement: 'auto top',
container: 'body'
}).attr('data-original-title', scope.users[0].name).tooltip('fixTitle');
if (element.hideFix)
element.hideFix();
usersWatch();
}
});
}
};
},
controller: function($scope, liveProfileID, $timeout, $element, $document, snCustomEvent) {
$scope.randId = Math.random();
$scope.loadEvent = 'sn-user-profile.ready';
$scope.closeEvent = ['chat:open_conversation', 'snAvatar.closePopover', 'body_clicked'];
$scope.popoverConfig = {
template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>'
};
$scope.displayMemberCount = $scope.displayMemberCount || false;
$scope.liveProfileID = liveProfileID;
if ($scope.primaryNonAssign) {
$scope.primary =  angular.extend({}, $scope.primary, $scope.primaryNonAssign);
if ($scope.users && $scope.users[0])
$scope.users[0] = $scope.primary;
}
$scope.$watch('members', function(newVal, oldVal) {
if(newVal === oldVal)
return;
if ($scope.members)
buildAvatar();
});
$scope.noPopover = function () {
$scope.popoverCursor = ($scope.nopopover || ($scope.members && $scope.members.length > 2) ) ? "default" : "pointer";
return ($scope.nopopover || ($scope.members && $scope.members.length > 2));
}
$scope.avatarType = function() {
var result = [];
if($scope.groupAvatar || !$scope.users)
return result;
if ($scope.users.length > 1)
result.push("group")
if ($scope.users.length === 2)
result.push("avatar-duo")
if ($scope.users.length === 3)
result.push("avatar-trio")
if ($scope.users.length >= 4)
result.push("avatar-quad")
if ($scope.users.length === 1 && !$scope.users[0].avatar)
result.push("initials");
return result;
}
$scope.getBackgroundStyle = function(user) {
var avatar = (user ? user.avatar  : '');
if ($scope.groupAvatar)
avatar = $scope.groupAvatar;
if (avatar && avatar !== '')
return { 'background-image' : 'url(' + avatar + ')' };
if (user && user.name)
return '';
return void(0);
};
$scope.stopPropCheck = function (evt) {
$scope.$broadcast("snAvatar.closeOtherPopovers", $scope.randId);
if (!$scope.nopopover) {
evt.stopPropagation();
}
};
$scope.$on("snAvatar.closeOtherPopovers", function (id) {
if (id !== $scope.randId)
snCustomEvent.fireTop('snAvatar.closePopover');
});
$scope.maxStringWidth = function() {
var paddedWidth = parseInt($scope.avatarWidth * 0.8, 10);
return $scope.users.length === 1 ? paddedWidth : paddedWidth / 2;
};
function buildInitials(name) {
if (!name)
return "--";
var initials = name.split(" ").map(function(word) {
return word.toUpperCase();
}).filter(function(word) {
return word.match(/^[A-Z]/);
}).map(function(word) {
return word.substring(0,1);
}).join("");
return (initials.length > 3)
? initials.substr(0, 3)
: initials;
}
$scope.avatartooltip = function() {
if (!$scope.enableTooltip) {
return '';
}
if (!$scope.users) {
return '';
}
var names = [];
$scope.users.forEach(function(user) {
if(!user) { return; }
names.push(user.name);
});
return names.join(', ');
};
function buildAvatar() {
if (typeof $scope.primary === 'string') {
$http.get('/api/now/live/profiles/sys_user.' + $scope.primary).then(function (response) {
$scope.users = [{
userID: $scope.primary,
name: response.data.result.name,
initials: buildInitials(response.data.result.name),
avatar: response.data.result.avatar
}];
});
return;
}
if ($scope.primary) {
if ($scope.primary.userImage)
$scope.primary.avatar = $scope.primary.userImage;
if (!$scope.primary.userID && $scope.primary.sys_id)
$scope.primary.userID = $scope.primary.sys_id;
}
$scope.isGroup = $scope.conversation && $scope.conversation.isGroup;
$scope.users = [$scope.primary];
if ($scope.primary && (!$scope.members || $scope.members.length <= 0) && ($scope.primary.avatar || $scope.primary.initials) && $scope.isDocument) {
$scope.users = [$scope.primary];
} else if ($scope.members && $scope.members.length > 0) {
$scope.users = buildCompositeAvatar($scope.members);
}
$scope.presenceEnabled = $scope.showPresence && !$scope.isGroup && $scope.users.length === 1;
}
function buildCompositeAvatar(members) {
var currentUser = window.NOW.user ? window.NOW.user.userID : window.NOW.user_id;
var users = angular.isArray(members) ? members.slice() : [members];
users = users.sort(function(a, b) {
var aID = a.userID || a.document;
var bID = b.userID || b.document;
if (a.table === "chat_queue_entry")
return 1;
if (aID === currentUser)
return 1;
else if (bID === currentUser)
return -1;
return 0;
});
if (users.length === 2)
users = [users[0]];
if (users.length > 2 && $scope.primary && $scope.primary.name && $scope.primary.table === "sys_user") {
var index = -1;
angular.forEach(users, function(user, i) {
if (user.sys_id === $scope.primary.sys_id) {
index = i;
}
});
if (index > -1) {
users.splice(index, 1);
}
users.splice(1, 0, $scope.primary);
}
return users;
}
buildAvatar();
$scope.loadFullProfile = function () {
if ($scope.primary && !$scope.primary.sys_id && !avatarProfilePersister.getAvatar($scope.primary.userID)) {
$http.get('/api/now/live/profiles/' + $scope.primary.userID).then(
function (response) {
try{
angular.extend($scope.primary, response.data.result);
avatarProfilePersister.setAvatar($scope.primary.userID, $scope.primary);
}catch(e){}
});
}
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/avatar/directive.snAvatar.js */
angular.module('sn.common.avatar')
.factory('snAvatarFactory', function($http, $compile, $templateCache, $q, snCustomEvent, snConnectService) {
'use strict';
return function() {
return {
restrict : 'E',
replace: true,
transclude: true,
scope : {
members: '=',
primary: '=',
showPresence: '=?',
enableContextMenu: '=?',
enableTooltip: '=?',
enableBindOnce: '@',
displayMemberCount: "=?",
groupAvatar: "@"
},
compile: function(tElement) {
var template = tElement.html();
return function (scope, element, attrs, controller, transcludeFn) {
var newElement = $compile(template, transcludeFn)(scope);
element.html(newElement);
if (scope.enableTooltip) {
element.tooltip({
placement: 'auto top',
container: 'body'
}).attr('data-original-title', scope.users[0].name).tooltip('fixTitle');
if (element.hideFix)
element.hideFix();
}
if (attrs.enableBindOnce === 'false') {
scope.$watch('primary', recompile);
scope.$watch('members', recompile);
}
if (scope.enableTooltip) {
var usersWatch = scope.$watch('users', function () {
if (scope.users && scope.users.length === 1 && scope.users[0] && scope.users[0].name) {
element.tooltip({
placement: 'auto top',
container: 'body'
}).attr('data-original-title', scope.users[0].name).tooltip('fixTitle');
if (element.hideFix)
element.hideFix();
usersWatch();
}
});
}
if (scope.enableContextMenu !== false) {
scope.contextOptions = [];
var gUser = null;
try { gUser = g_user; } catch (err) {}
if (scope.users && scope.users.length === 1 && scope.users[0] && (scope.users[0].userID || scope.users[0].sys_id)) {
scope.contextOptions = [
["Open user's profile", function () {
if (scope.users && scope.users.length > 0) {
window.open('/nav_to.do?uri=' + encodeURIComponent('sys_user.do?sys_id=' + scope.users[0].userID), '_blank');
}
}]];
if ((gUser && scope.users[0].userID && scope.users[0].userID !== gUser.userID) ||
(scope.liveProfileID && scope.users[0] && scope.users[0].sysID !== scope.liveProfileID)) {
scope.contextOptions.push(["Open a new chat", function () {
snConnectService.openWithProfile(scope.users[0]);
}]);
}
}
} else {
scope.contextOptions = [];
}
};
},
controller: function($scope, liveProfileID) {
var firstBuildAvatar = true;
$scope.displayMemberCount = $scope.displayMemberCount || false;
$scope.liveProfileID = liveProfileID;
$scope.$watch('primary', function(newValue, oldValue) {
if ($scope.primary && newValue !== oldValue) {
if(!firstBuildAvatar)
buildAvatar();
if ($scope.contextOptions.length > 0) {
$scope.contextOptions = [
["Open user's profile", function () {
if ($scope.users && $scope.users.length > 0) {
window.location.href = 'sys_user.do?sys_id=' + $scope.users[0].userID || $scope.users[0].userID;
}
}]];
var gUser = null;
try {
gUser = g_user;
} catch (err) {
}
if ((!gUser && !liveProfileID) || ($scope.users && $scope.users.length === 1 && $scope.users[0])) {
if ((gUser && $scope.users[0].userID && $scope.users[0].userID !== gUser.userID) ||
($scope.liveProfileID && $scope.users[0] && $scope.users[0].sysID !== $scope.liveProfileID)) {
$scope.contextOptions.push(["Open a new chat", function () {
snConnectService.openWithProfile($scope.users[0]);
}]);
}
}
}
}
});
$scope.$watch('members', function() {
if ($scope.members && !firstBuildAvatar)
buildAvatar();
});
$scope.avatarType = function() {
var result = [];
if($scope.groupAvatar || !$scope.users)
return result;
if ($scope.users.length > 1)
result.push("group");
if ($scope.users.length === 2)
result.push("avatar-duo");
if ($scope.users.length === 3)
result.push("avatar-trio");
if ($scope.users.length >= 4)
result.push("avatar-quad");
return result;
};
$scope.getBackgroundStyle = function(user) {
var avatar = (user ? user.avatar  : '');
if ($scope.groupAvatar)
avatar = $scope.groupAvatar;
if (avatar && avatar !== '')
return { 'background-image' : 'url(' + avatar + ')' };
if (user && user.name)
return '';
return void(0);
};
$scope.maxStringWidth = function() {
var paddedWidth = parseInt($scope.avatarWidth * 0.8, 10);
return $scope.users.length === 1 ? paddedWidth : paddedWidth / 2;
};
function buildInitials(name) {
if (!name)
return "--";
var initialMatchRegex = /^[A-ZÀ-Ÿ]|^[\u3040-\u309f]|^[\u30a0-\u30ff]|^[\uff66-\uff9f]|^[\u4e00-\u9faf]/;
var initials = name.split(" ").map(function(word) {
return word.toUpperCase();
}).filter(function(word) {
return word.match(initialMatchRegex);
}).map(function(word) {
return word.substring(0,1);
}).join("");
return (initials.length > 3)
? initials.substr(0, 3)
: initials;
}
$scope.avatartooltip = function() {
if (!$scope.enableTooltip) {
return '';
}
if (!$scope.users) {
return '';
}
var names = [];
$scope.users.forEach(function(user) {
if(!user) { return; }
names.push(user.name);
});
return names.join(', ');
};
function setPresence(){
$scope.presenceEnabled = $scope.showPresence && !$scope.isDocument && $scope.users.length === 1;
return $scope.presenceEnabled;
}
function buildAvatar() {
if(firstBuildAvatar)
firstBuildAvatar = false;
if (typeof $scope.primary === 'string') {
return $http.get('/api/now/live/profiles/sys_user.' + $scope.primary).then(function (response) {
$scope.users = [{
userID: $scope.primary,
name: response.data.result.name,
initials: buildInitials(response.data.result.name),
avatar: response.data.result.avatar
}];
return setPresence();
});
}
if ($scope.primary) {
if ($scope.primary.userImage)
$scope.primary.avatar = $scope.primary.userImage;
if (!$scope.primary.userID && $scope.primary.sys_id)
$scope.primary.userID = $scope.primary.sys_id;
}
$scope.isDocument = $scope.primary && $scope.primary.table && $scope.primary.table !== "sys_user" && $scope.primary.table !== "chat_queue_entry";
$scope.users = [$scope.primary];
if ($scope.primary && (!$scope.members || $scope.members.length <= 0) && ($scope.primary.avatar || $scope.primary.initials) && $scope.isDocument) {
$scope.users = [$scope.primary];
} else if ($scope.members && $scope.members.length > 0) {
$scope.users = buildCompositeAvatar($scope.members);
}
return $q.when(setPresence());
}
function buildCompositeAvatar(members) {
var currentUser = window.NOW.user ? window.NOW.user.userID : window.NOW.user_id;
var users = angular.isArray(members) ? members.slice() : [members];
users = users.sort(function(a, b) {
var aID = a.userID || a.document;
var bID = b.userID || b.document;
if (a.table === "chat_queue_entry")
return 1;
if (aID === currentUser)
return 1;
else if (bID === currentUser)
return -1;
return 0;
});
if (users.length === 2)
users = [users[0]];
if (users.length > 2 && $scope.primary && $scope.primary.name && $scope.primary.table === "sys_user") {
var index = -1;
angular.forEach(users, function(user, i) {
if (user.sys_id === $scope.primary.sys_id) {
index = i;
}
});
if (index > -1) {
users.splice(index, 1);
}
users.splice(1, 0, $scope.primary);
}
return users;
}
buildAvatar();
}
}
}
})
.directive('snAvatar', function (snAvatarFactory, getTemplateUrl){
var directive = snAvatarFactory();
directive.templateUrl = getTemplateUrl('sn_avatar.xml');
return directive;
})
.directive('snAvatarOnce', function (snAvatarFactory, getTemplateUrl) {
var directive = snAvatarFactory();
directive.templateUrl = getTemplateUrl('sn_avatar_once.xml');
return directive;
});
;
/*! RESOURCE: /scripts/sn/common/avatar/service.avatarProfilePersister.js */
angular.module('sn.common.avatar').service('avatarProfilePersister', function () {
"use strict";
var avatars = {};
function setAvatar (id, payload) {
avatars[id] = payload;
}
function getAvatar (id) {
return avatars[id];
}
return {
setAvatar: setAvatar,
getAvatar: getAvatar
}
});
;
/*! RESOURCE: /scripts/sn/common/avatar/directive.snUserAvatar.js */
angular.module('sn.common.avatar').directive('snUserAvatar', function(getTemplateUrl) {
"use strict";
return {
restrict: 'E',
templateUrl: getTemplateUrl('sn_user_avatar.xml'),
replace: true,
scope: {
profile: '=?',
userId: '=?',
avatarUrl: '=?',
initials: '=?',
enablePresence: '@',
disablePopover: '=?',
directConversationButton: '=?',
userName: '=?',
isAccessible: '=?'
},
link: function (scope, element) {
scope.evaluatedProfile = undefined;
scope.backgroundStyle = undefined;
scope.enablePresence = scope.enablePresence !== 'false';
if (scope.profile) {
scope.evaluatedProfile = scope.profile;
scope.userId = scope.profile.userID || "";
scope.avatarUrl = scope.profile.avatar || "";
scope.initials = scope.profile.initials || "";
scope.backgroundStyle = scope.getBackgroundStyle();
} else if (scope.userId || scope.avatarUrl || scope.initials || scope.userName) {
scope.evaluatedProfile = scope.profile = {
'userID': scope.userId || "",
'avatar': scope.avatarUrl || "",
'initials': scope.initials || "",
'userName': scope.userName || "",
'isAccessible': scope.isAccessible || false
};
scope.backgroundStyle = scope.getBackgroundStyle();
} else {
var unwatch = scope.$watch('profile', function (newVal) {
if (newVal) {
scope.evaluatedProfile = newVal;
scope.backgroundStyle = scope.getBackgroundStyle();
unwatch();
}
})
}
scope.directConversationButton = scope.directConversationButton !== 'false' && scope.directConversationButton !== false;
scope.template = '<sn-user-profile tabindex="-1" id="sn-bootstrap-popover" profile="evaluatedProfile" show-direct-message-prompt="::directConversationButton" class="avatar-popover avatar-popover-padding"></sn-user-profile>';
scope.ariaRole = scope.disablePopover ? 'presentation' : 'button';
},
controller: function($scope) {
$scope.getBackgroundStyle = function() {
if ( ($scope.avatarUrl && $scope.avatarUrl !== '') || $scope.evaluatedProfile && $scope.evaluatedProfile.avatar !== '' )
return {"background-image": 'url(' + ($scope.avatarUrl || $scope.evaluatedProfile.avatar) + ')'};
return {"background-image": ""};
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/avatar/directive.snGroupAvatar.js */
angular.module('sn.common.avatar').directive('snGroupAvatar', function($http, $compile, getTemplateUrl, avatarProfilePersister) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sn_group_avatar.xml'),
replace: true,
transclude: true,
scope : {
members: '=',
primary: '=?',
groupAvatar: "@"
},
controller: function($scope, liveProfileID) {
$scope.liveProfileID = liveProfileID;
$scope.$watch('members', function(newVal, oldVal) {
if(newVal === oldVal)
return;
if ($scope.members)
$scope.users = buildCompositeAvatar($scope.members);
});
$scope.avatarType = function() {
var result = [];
if($scope.groupAvatar || !$scope.users)
return result;
if ($scope.users.length > 1)
result.push("group")
if ($scope.users.length === 2)
result.push("sn-avatar_duo")
if ($scope.users.length === 3)
result.push("sn-avatar_trio")
if ($scope.users.length >= 4)
result.push("sn-avatar_quad")
return result;
};
$scope.getBackgroundStyle = function(user) {
var avatar = (user ? user.avatar  : '');
if ($scope.groupAvatar)
avatar = $scope.groupAvatar;
if (avatar && avatar !== '')
return {"background-image" : "url(" + avatar + ")"};
return {};
};
$scope.users = buildCompositeAvatar($scope.members);
function buildCompositeAvatar(members) {
var currentUser = window.NOW.user ? window.NOW.user.userID : window.NOW.user_id;
var users = angular.isArray(members) ? members.slice() : [members];
users = users.sort(function(a, b) {
var aID = a.userID || a.document;
var bID = b.userID || b.document;
if (a.table === "chat_queue_entry")
return 1;
if (aID === currentUser)
return 1;
else if (bID === currentUser)
return -1;
return 0;
});
if (users.length === 2)
users = [users[0]];
if (users.length > 2 && $scope.primary && $scope.primary.name && $scope.primary.table === "sys_user") {
var index = -1;
angular.forEach(users, function(user, i) {
if (user.sys_id === $scope.primary.sys_id) {
index = i;
}
});
if (index > -1) {
users.splice(index, 1);
}
users.splice(1, 0, $scope.primary);
}
return users;
}
}
}
});
;
;
/*! RESOURCE: /scripts/sn/common/controls/js_includes_controls.js */
/*! RESOURCE: /scripts/sn/common/controls/_module.js */
angular.module('sn.common.controls', ['sn.common.util']);
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snChoiceList.js */
angular.module('sn.common.controls').directive('snChoiceList', function(i18n, $timeout) {
"use strict";
return {
restrict : 'E',
replace : true,
scope : {
snModel: "=",
snTextField: "@",
snValueField: "@",
snOptions: "=?",
snItems: "=?",
snOnChange: "&",
snDisabled: "=",
snDialogName: "="
},
template :
'<select ng-disabled="snDisabled" ' +
'        ng-model="model" ' +
'        ng-options="item[snValueField] as item[snTextField] for item in snItems">' +
'  <option value="" ng-show="snOptions.placeholder">{{snOptions.placeholder}}</option>' +
'</select>',
link : function (scope, element, attrs) {
if (scope.snDialogName)
scope.$on("dialog." + scope.snDialogName + ".close", function() {
$timeout(function() {
$(element).select2("destroy");
})
});
$(element).css("opacity", 0);
var config = {
width: "100%"
};
if (angular.isFunction(element.select2)) {
i18n.getMessage('No matches found', function(msg) {
config.formatNoMatches = function() {
return msg;
};
});
}
if (scope.snOptions){
if (scope.snOptions.placeholder){
config.placeholder = scope.snOptions.placeholder;
config.placeholderOption = "first";
}
if (scope.snOptions.allowClear){
config.allowClear = scope.snOptions.allowClear;
}
if (scope.snOptions.hideSearch && scope.snOptions.hideSearch === true){
config.minimumResultsForSearch = -1;
}
}
function init(){
scope.model = scope.snModel;
render();
}
function render(){
if (!attrs){
$timeout(function(){render();});
return;
}
$timeout(function(){
$(element).css("opacity", 1);
$(element).select2("destroy");
$(element).select2(config);
});
}
init();
scope.$watch("snItems", function(newValue, oldValue){
if (newValue !== oldValue){
init();
}
}, true);
scope.$watch("snModel", function(newValue){
if (newValue !== undefined && newValue !== scope.model){
init();
}
});
scope.$watch("model", function(newValue, oldValue){
if (newValue !== oldValue){
scope.snModel = newValue;
if (scope.snOnChange)
scope.snOnChange({selectedValue:newValue});
}
});
scope.$on('$destroy', function() {
$(element).select2("destroy");
});
},
controller : function($scope) {
}
}
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snHtmlContentWrapper.js */
angular.module('sn.common.controls').directive('snHtmlContentWrapper', function() {
function link(scope, element, attrs) {
attrs.$observe("content", function(content) {
encapsulate(element[0], content, attrs.uniqueId);
});
}
function createDefaultCssLink() {
var link = document.createElement("link");
link.href = "styles/activity_encapsulated.css";
link.rel = "stylesheet";
link.type = "text/css";
return link;
}
function createBaseElement() {
var base = document.createElement("base");
base.setAttribute("target", "_blank")
return base;
}
function encapsulate(root, content, uniqueId) {
var defaultCssLink = createDefaultCssLink();
var style = document.createElement('style');
style.innerHTML = ':host img {max-width: 100%; height: auto; overflow: hidden;}';
if (document.head.createShadowRoot || document.head.attachShadow) {
var shadow = root.shadowRoot || (document.head.attachShadow ?
root.attachShadow({mode: 'open'}) :
root.createShadowRoot());
var contentDiv = document.createElement('div');
contentDiv.innerHTML = content;
shadow.innerHTML = contentDiv.outerHTML;
shadow.appendChild(defaultCssLink);
shadow.appendChild(style);
} else {
var iframeId = "activity-iframe-" + uniqueId;
var existingIframe = document.getElementById(iframeId);
if (existingIframe) {
existingIframe.contentDocument.write(content);
existingIframe.contentWindow.document.head.appendChild(defaultCssLink);
existingIframe.setAttribute("height", existingIframe.contentWindow.document.body.scrollHeight + 'px')
}
else {
var rootEl = $j(root);
var iframe = document.createElement("iframe");
iframe.setAttribute("id", iframeId);
iframe.setAttribute("style", "border:none;display:block;width:100%");
iframe.setAttribute("class", "html-content");
iframe.setAttribute("scrolling", "no");
iframe.setAttribute("height", "0");
iframe.setAttribute("sandbox", "allow-same-origin");
root.appendChild(iframe);
var doc = iframe.contentWindow.document;
doc.open();
doc.write(content);
doc.close();
iframe.contentWindow.document.head.appendChild(defaultCssLink);
iframe.contentWindow.document.head.appendChild(createBaseElement());
iframe.height = doc.body.scrollHeight + 'px';
var parentTab = rootEl.closest(".tabs2_section");
var parentSectionId = parentTab.attr("data-section-id");
var setIFrameHeightFn = function(tab) {
var openedTab = $j(".tabs2_section." + tab);
if (openedTab.length > 0 && openedTab.attr("data-section-id") === parentSectionId) {
iframe.contentWindow.document.head.appendChild(defaultCssLink);
iframe.height = doc.body.scrollHeight + 'px';
CustomEvent.un("tab.activated", setIFrameHeightFn);
}
};
CustomEvent.observe("tab.activated", setIFrameHeightFn);
}
}
}
return {
link: link,
restrict: 'E',
replace: true
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snReferencePicker.js */
angular.module('sn.common.controls').directive('snReferencePicker', function($timeout, $http, urlTools, filterExpressionParser, escapeHtml, i18n) {
"use strict";
return {
restrict: 'E',
replace: true,
scope: {
ed: "=?",
field: "=",
refTable: "=?",
refId: "=?",
snOptions: "=?",
atfQualifier: "=?",
snOnChange: "&",
snOnBlur: "&",
snOnClose: "&",
snOnOpen: '&',
minimumInputLength : "@",
snDisabled: "=",
snPageSize: "@",
dropdownCssClass: "@",
formatResultCssClass: "&",
overlay: "=",
additionalDisplayColumns: "@",
displayColumn: "@",
recordValues: '&',
getGlideForm: '&glideForm',
domain: "@",
snSelectWidth: '@',
},
template: '<input type="text" name="{{field.name}}" ng-disabled="snDisabled" style="min-width: 150px;" ng-model="field.displayValue" ' +
'sn-atf-settable="true" sn-atf-component-value="{{field.value}}" sn-atf-data-type="reference"' +
'sn-atf-data-type-params=\'{"reference" : "{{ed.reference}}", "reference_qual" : "{{atfQualifier || ed.qualifier}}", ' +
'"valueField" : "sys_id", "displayField" : "{{ed.searchField}}"}\' ng-attr-sn-atf-disabled="{{ snDisabled || undefined }}" />',
link: function(scope, element, attrs, ctrl) {
scope.ed = scope.ed || scope.field.ed;
scope.selectWidth = scope.snSelectWidth || '100%';
element.css("opacity", 0);
var fireReadyEvent = true;
var g_form;
if (angular.isDefined(scope.getGlideForm))
g_form = scope.getGlideForm();
var fieldAttributes = {};
if (angular.isDefined(scope.field) && angular.isDefined(scope.field.attributes) && typeof scope.ed.attributes == 'undefined')
if (Array.isArray(scope.field.attributes))
fieldAttributes = scope.field.attributes;
else
fieldAttributes = parseAttributes(scope.field.attributes);
else
fieldAttributes = parseAttributes(scope.ed.attributes);
if (!angular.isDefined(scope.additionalDisplayColumns) && angular.isDefined(fieldAttributes['ref_ac_columns']))
scope.additionalDisplayColumns = fieldAttributes['ref_ac_columns'];
var atfQualifier = scope.ed.qualifier || '';
if (scope.ed.dependent_field && scope.ed.dependent_value && scope.ed.dependent_table &&
!(scope.ed.reference == 'sys_user' && scope.ed.dependent_field.indexOf('group') != -1)) {
if (atfQualifier)
atfQualifier += "^";
atfQualifier += scope.ed.dependent_field + "=" + scope.ed.dependent_value;
}
scope.atfQualifier = atfQualifier;
var select2AjaxHelpers = {
formatSelection: function(item) {
return escapeHtml(getDisplayValue(item));
},
formatResult: function(item) {
var displayValues = getDisplayValues(item);
if (displayValues.length == 1)
return escapeHtml(displayValues[0]);
if (displayValues.length > 1) {
var width = 100 / displayValues.length;
var markup = "";
for (var i = 0; i < displayValues.length; i++)
markup += "<div style='width: " + width + "%;' class='select2-result-cell'>" + escapeHtml(displayValues[i])  + "</div>";
return markup;
}
return "";
},
search: function(queryParams) {
if ('sysparm_include_variables' in queryParams.data) {
var url = urlTools.getURL('ref_list_data', queryParams.data);
return $http.get(url).then(queryParams.success);
}else {
var urlQueryParameters = {};
if (queryParams.data['sysparm_for_impersonation']) {
urlQueryParameters['sysparm_for_impersonation'] = true;
}
var url = urlTools.getURL('ref_list_data', urlQueryParameters);
return $http.post(url, queryParams.data).then(queryParams.success);
}
},
initSelection: function(elem, callback) {
if (scope.field && scope.field.displayValue)
callback({
sys_id: scope.field.value,
name: scope.field.displayValue
});
}
};
var config = {
width : scope.selectWidth,
minimumInputLength: scope.minimumInputLength ? parseInt(scope.minimumInputLength, 10) : 0,
overlay: scope.overlay,
containerCssClass : 'select2-reference ng-form-element',
placeholder : '   ',
formatSearching: '',
allowClear: attrs.allowClear !== 'false',
clearAriaLabel: (scope.snOptions) ? scope.snOptions.clearAriaLabel : "",
id: function(item) {
return item.sys_id;
},
sortResults: (scope.snOptions && scope.snOptions.sortResults) ? scope.snOptions.sortResults : undefined,
ajax: {
quietMillis: NOW.ac_wait_time,
data: function(filterText, page) {
var q = _getReferenceQuery(filterText);
var params = {
start: (scope.pageSize * (page - 1)),
count: scope.pageSize,
sysparm_target_table: scope.refTable,
sysparm_target_sys_id: scope.refId,
sysparm_target_field: scope.ed.dependent_field || scope.ed.name,
table: scope.ed.reference,
qualifier: scope.ed.qualifier,
sysparm_for_impersonation: !!scope.ed.for_impersonation,
data_adapter: scope.ed.data_adapter,
attributes: scope.ed.attributes,
dependent_field: scope.ed.dependent_field,
dependent_table: scope.ed.dependent_table,
dependent_value: scope.ed.dependent_value,
p: scope.ed.reference + ';q:' + q + ';r:' + scope.ed.qualifier
};
if (scope.domain) {
params.sysparm_domain = scope.domain;
}
if (angular.isDefined(scope.field) && scope.field['_cat_variable'] === true){
delete params['sysparm_target_table'];
params['sysparm_include_variables'] = true;
params['variable_ids'] = scope.field.sys_id;
var getFieldSequence = g_form.$private.options('getFieldSequence');
if (getFieldSequence) {
params['variable_sequence1'] = getFieldSequence();
}
var itemSysId = g_form.$private.options('itemSysId');
params['sysparm_id'] = itemSysId;
var getFieldParams = g_form.$private.options('getFieldParams');
if (getFieldParams) {
angular.extend(params, getFieldParams());
}
}
if (scope.recordValues)
params.sysparm_record_values = scope.recordValues();
return params;
},
results: function(data, page) {
return ctrl.filterResults(data, page, scope.pageSize);
},
transport: select2AjaxHelpers.search
},
formatSelection: select2AjaxHelpers.formatSelection,
formatResult: select2AjaxHelpers.formatResult,
initSelection: select2AjaxHelpers.initSelection,
dropdownCssClass: attrs.dropdownCssClass,
formatResultCssClass: scope.formatResultCssClass || null
};
if (scope.snOptions) {
if (scope.snOptions.placeholder) {
config.placeholder = scope.snOptions.placeholder;
}
if (scope.snOptions.width) {
config.width = scope.snOptions.width;
}
}
function _getReferenceQuery(filterText) {
var filterExpression = filterExpressionParser.parse(filterText, scope.ed.defaultOperator);
var colToSearch = getReferenceColumnsToSearch();
var excludedValues = getExcludedValues();
return colToSearch.map(function(column) {
return column + filterExpression.operator + filterExpression.filterText +
'^' + column + 'ISNOTEMPTY' + excludedValues;
}).join("^NQ");
}
function getReferenceColumnsToSearch() {
var colName = ['name'];
if (scope.ed.searchField) {
colName = scope.ed.searchField.split(";");
} else if (fieldAttributes['ref_ac_columns_search'] == 'true' && 'ref_ac_columns' in fieldAttributes && fieldAttributes['ref_ac_columns'] != '') {
colName = fieldAttributes['ref_ac_columns'].split(';');
} else if (fieldAttributes['ref_ac_order_by']) {
colName = [fieldAttributes['ref_ac_order_by']];
}
return colName;
}
function getExcludedValues () {
if (scope.ed.excludeValues && scope.ed.excludeValues != '') {
return '^sys_idNOT IN' + scope.ed.excludeValues;
}
return '';
}
function parseAttributes(strAttributes) {
var attributeArray = (strAttributes && strAttributes.length ? strAttributes.split(',') : []);
var attributeObj = {};
for (var i = 0; i < attributeArray.length; i++) {
if (attributeArray[i].length > 0) {
var attribute = attributeArray[i].split('=');
attributeObj[attribute[0]] = attribute.length > 1 ? attribute[1] : '';
}
}
return attributeObj;
}
function init() {
scope.model = scope.snModel;
render();
}
function render() {
$timeout(function() {
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
element.css("opacity", 1);
element.select2("destroy");
var select2 = element.select2(config).select2('val', []);
select2.bind("change", select2Change);
select2.bind("select2-removed", select2Change);
select2.bind("select2-blur", function() {
scope.$apply(function() {
scope.snOnBlur();
});
});
select2.bind("select2-close", function() {
scope.$apply(function() {
scope.snOnClose();
});
});
select2.bind("select2-open", function() {
scope.$apply(function() {
if (scope.snOnOpen)
scope.snOnOpen();
});
});
select2.bind('select2-focus', function() {
redirectLabel(element);
});
select2.bind('sn-atf-setvalue', setValueATF);
if (fireReadyEvent) {
scope.$emit('select2.ready', element);
fireReadyEvent = false;
}
});
}
function select2Change(e) {
e.stopImmediatePropagation();
if (e.added) {
if (scope.$$phase || scope.$root.$$phase)
return;
var selectedItem = e.added;
var value = selectedItem.sys_id;
var displayValue = value ? getDisplayValue(selectedItem) : '';
if (scope.snOptions && scope.snOptions.useGlideForm === true) {
g_form.setValue(scope.field.name, value, displayValue);
scope.rowSelected();
e.displayValue = displayValue;
triggerSnOnChange();
} else {
scope.$apply(function() {
scope.field.value = value;
scope.field.displayValue = displayValue;
scope.rowSelected();
e.displayValue = displayValue;
triggerSnOnChange();
});
}
} else if (e.removed) {
if (scope.snOptions && scope.snOptions.useGlideForm === true) {
g_form.clearValue(scope.field.name);
triggerSnOnChange();
} else {
scope.$apply(function() {
scope.field.displayValue = '';
scope.field.value = '';
triggerSnOnChange();
});
}
}
$timeout(function() {
element.parent().find(".select2-focusser").focus();
}, 0, false);
function triggerSnOnChange(){
if (scope.snOnChange)
scope.snOnChange(e);
}
}
function redirectLabel($select2) {
if (NOW.select2LabelWorkaround)
NOW.select2LabelWorkaround($select2);
}
function getDisplayValue(selectedItem) {
var displayValue = '';
if (selectedItem && selectedItem.sys_id) {
if (scope.displayColumn && typeof selectedItem[scope.displayColumn] != "undefined")
displayValue = selectedItem[scope.displayColumn];
else if (selectedItem.$$displayValue)
displayValue = selectedItem.$$displayValue;
else if (selectedItem.name)
displayValue = selectedItem.name;
else if (selectedItem.title)
displayValue = selectedItem.title;
}
return displayValue;
}
function getDisplayValues(selectedItem) {
var displayValues = [];
if (selectedItem && selectedItem.sys_id) {
var current = "";
if (scope.displayColumn && typeof selectedItem[scope.displayColumn] != "undefined")
current = selectedItem[scope.displayColumn];
else if (selectedItem.$$displayValue)
current = selectedItem.$$displayValue;
else if (selectedItem.name)
current = selectedItem.name;
else if (selectedItem.title)
current = selectedItem.title;
displayValues.push(current);
}
if (scope.additionalDisplayColumns) {
var columns = scope.additionalDisplayColumns.split(",");
for (var i = 0; i < columns.length; i++) {
var column = columns[i];
if (selectedItem[column])
displayValues.push(selectedItem[column]);
}
}
return displayValues;
}
function setValueATF(e) {
e.stopImmediatePropagation();
var changeEventParameters = { type: "change" };
if (scope.field.value)
changeEventParameters.removed = element.select2("data");
var newValue = e.detail && e.detail.newValue;
if (newValue) {
var params = config.ajax.data('', 1);
if (params.qualifier)
params.qualifier += "^";
else
params.qualifier = "";
params.qualifier += "sys_id=" + newValue;
var data = {
data: params,
dataType: "json",
error: atfHandleNoResults,
success: function (answer) {
if (answer.data.items && answer.data.items.length == 1) {
var valueToSet = answer.data.items[0].sys_id;
changeEventParameters.added = answer.data.items[0];
$timeout(function() {
element.val(valueToSet);
element.triggerHandler(changeEventParameters);
}, 0, false);
} else
atfHandleNoResults();
},
};
select2AjaxHelpers.search(data);
} else {
element.val("");
element.triggerHandler(changeEventParameters);
}
function atfHandleNoResults() {
i18n.getMessage(
"Unable to set reference picker to value {0}",
function(errorMessage) {
throw new Error(i18n.format(errorMessage, newValue));
}
);
}
}
scope.$watch("field.displayValue", function(newValue, oldValue) {
if (newValue != oldValue && newValue !== scope.model) {
init();
}
});
scope.$on("snReferencePicker.activate", function(evt, parms) {
$timeout(function() {
element.select2("open");
})
});
init();
},
controller: function($scope, $rootScope) {
$scope.pageSize = 20;
if ($scope.snPageSize)
$scope.pageSize = parseInt($scope.snPageSize);
$scope.rowSelected = function() {
$rootScope.$broadcast("@page.reference.selected", {
field: $scope.field,
ed: $scope.ed
});
};
this.filterResults = function(data, page) {
return {
results: data.data.items,
more: (page * $scope.pageSize < data.data.total)
};
};
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snRecordPicker.js */
angular.module('sn.common.controls').directive('snRecordPicker', function($timeout, $http, urlTools, filterExpressionParser, escapeHtml, i18n) {
"use strict";
var cache = {};
function cleanLabel(val) {
if (val && typeof val == "object")
return typeof val.display_value == "string" ? val.display_value.trim() : "";
return typeof val == "string" ? val.trim() : val;
}
return {
restrict: 'E',
replace: true,
scope: {
field: '=',
table: '=',
defaultQuery: '=?',
startswith: '=?',
searchFields: '=?',
valueField: '=?',
displayField: '=?',
displayFields: '=?',
pageSize: '=?',
onChange: '&',
snDisabled: '=',
multiple: '=?',
options: '=?',
placeholder: '@'
},
template: '<input type="text" ng-disabled="snDisabled" style="min-width: 150px;" name="{{field.name}}" ng-model="field.value"' +
' sn-atf-data-type="reference" sn-atf-data-type-params=\'{"reference" : "{{table}}", "reference_qual" : "{{defaultQuery}}",' +
' "valueField" : "{{valueField}}", "displayField" : "{{displayField}}"}\' sn-atf-class="builtin:ATF.BaseSNRecordPicker" aria-hidden="true" sn-atf-component-value="{{field}}"/>',
controller: function($scope) {
if (!angular.isNumber($scope.pageSize))
$scope.pageSize = 20;
if (!angular.isDefined($scope.valueField))
$scope.valueField = 'sys_id';
this.filterResults = function(data, page) {
return {
results: data.data.result,
more: (page * $scope.pageSize < parseInt(data.headers('x-total-count'), 10))
};
};
},
link: function(scope, element, attrs, ctrl) {
var TOKENIZER = '####';
var isExecuting = false;
var remove = i18n.getMessage("Remove");
function getRemoveItem(label){ return jQuery("<span class='sr-only' />").text(remove + " " + label); };
var select2Helpers = {
formatSelection: function(item) {
return escapeHtml(getDisplayValue(item));
},
formatResult: function(item) {
var displayFields = getdisplayFields(item);
if (displayFields.length == 1)
return escapeHtml(cleanLabel(displayFields[0]));
if (displayFields.length > 1) {
var markup = escapeHtml(cleanLabel(displayFields[0]));
var width = 100 / (displayFields.length - 1);
markup += "<div>";
for (var i = 1; i < displayFields.length; i++)
markup += "<div style='width: " + width + "%;' class='select2-additional-display-field'>" + escapeHtml(cleanLabel(displayFields[i]))  + "</div>";
markup += "</div>";
return markup;
}
return "";
},
search: function(queryParams) {
var url = '/api/now/table/' + scope.table + '?' + urlTools.encodeURIParameters(queryParams.data);
if (scope.options && scope.options.cache && cache[url])
return queryParams.success(cache[url]);
return $http.get(url).then(function(response) {
if (scope.options && scope.options.cache) {
cache[url] = response;
}
return queryParams.success(response)
});
},
initSelection: function(elem, callback) {
if (scope.field.displayValue) {
if (scope.multiple){
var items = [], sel;
var values = scope.field.value.split(',');
var displayValues = scope.field.displayValue.split(TOKENIZER);
for(var i=0; i<values.length; i++){
sel = {};
sel[scope.valueField] = values[i];
sel[scope.displayField] = displayValues[i];
items.push(sel);
}
callback(items);
}
else {
var sel = {};
sel[scope.valueField] = scope.field.value;
sel[scope.displayField] = scope.field.displayValue;
callback(sel);
}
} else
callback([]);
},
formatSelectionCssClass: function(item, el) {
var anchorEl = el.parent().find("a");
if (anchorEl.length) {
anchorEl.removeAttr("tabindex");
anchorEl.addClass("fa fa-times");
anchorEl.append(getRemoveItem(item[scope.displayField]));
}
}
};
var config = {
width : '100%',
containerCssClass : 'select2-reference ng-form-element',
placeholder : scope.placeholder || '    ',
formatSearching: '',
allowClear: (scope.options && typeof scope.options.allowClear !== "undefined") ? scope.options.allowClear : true,
id: function(item) {
return item[scope.valueField];
},
ajax: {
quietMillis: NOW.ac_wait_time,
data: function(filterText, page) {
var fields = [scope.valueField, 'name', 'title'];
if (scope.displayField)
fields.push(scope.displayField);
if (scope.displayFields)
fields.push(scope.displayFields);
var params = {
sysparm_offset: (scope.pageSize * (page - 1)),
sysparm_limit: scope.pageSize,
sysparm_query: buildQuery(filterText, scope.searchFields, scope.defaultQuery),
sysparm_fields: fields.join(','),
sysparm_display_value: true
};
return params;
},
results: function(data, page) {
return ctrl.filterResults(data, page, scope.pageSize);
},
transport: select2Helpers.search
},
formatSelection: select2Helpers.formatSelection,
formatResult: select2Helpers.formatResult,
formatResultCssClass: function(){ return ''; },
initSelection: select2Helpers.initSelection,
multiple: scope.multiple,
formatSelectionCssClass: select2Helpers.formatSelectionCssClass
};
function buildQuery(filterText, searchFields, defaultQuery) {
var queryParts = [];
var operator = "CONTAINS";
if (scope.startswith)
operator = "STARTSWITH";
if (filterText.startsWith("*")) {
filterText = filterText.substring(1);
operator = "CONTAINS";
}
if (defaultQuery)
queryParts.push(defaultQuery);
var filterExpression = filterExpressionParser.parse(filterText, operator);
if (searchFields != null) {
var fields = searchFields.split(',');
if (filterExpression.filterText != '') {
var OR = "";
for (var i = 0; i < fields.length; i++) {
queryParts.push(OR + fields[i] + filterExpression.operator + filterExpression.filterText);
OR = "OR";
}
}
for (var i = 0; i < fields.length; i++)
queryParts.push('ORDERBY' + fields[i]);
queryParts.push('EQ');
}
return queryParts.join('^');
}
scope.field = scope.field || {};
if (scope.field.displayValue && scope.multiple)
scope.field.displayValue = scope.field.displayValue.replace(/,/g, TOKENIZER);
var initTimeout = null;
var value = scope.field.value;
var oldValue = scope.field.value;
var $select;
function init() {
element.css("opacity", 0);
$timeout.cancel(initTimeout);
initTimeout = $timeout(function() {
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
element.css("opacity", 1);
element.select2("destroy");
$select = element.select2(config);
$select.bind("change", onChanged);
$select.bind("select2-selecting", onSelecting);
$select.bind("select2-removing", onRemoving);
$select.bind("sn-atf-setvalue", onAtfSetValue);
scope.$emit('select2.ready', element);
updateAriaExpanded(false);
});
}
function onAtfSetValue(e) {
var valueToSet = e.detail ? e.detail.newValue : null;
if (scope.multiple) {
var data = element.select2("data");
for (var i = 0; i < data.length; i++) {
element.triggerHandler({ type: "select2-removing", choice: data[i] });
}
if (!valueToSet)
return;
var selected = {};
selected[scope.valueField] = valueToSet.value;
if (scope.displayField)
selected[scope.displayField] = valueToSet.displayValue;
element.triggerHandler({ type: "select2-selecting", choice: selected });
return;
}
var changeEventParameters = { type: "change" };
if (scope.field.value)
changeEventParameters.removed = element.select2("data");
if (valueToSet) {
var added = {};
added[scope.valueField] = valueToSet.value;
if (scope.displayField)
added[scope.displayField] = valueToSet.displayValue;
changeEventParameters.added = added;
element.val(valueToSet.value);
scope.field.displayValue = valueToSet.displayValue;
} else
element.val("");
element.triggerHandler(changeEventParameters);
}
function onSelecting(e) {
isExecuting = true;
oldValue = scope.field.value;
var selectedItem = e.choice;
if (scope.multiple && selectedItem[scope.valueField] != '') {
var values = !scope.field.value ? [] : scope.field.value.split(',');
var displayValues = !scope.field.displayValue ? [] : scope.field.displayValue.split(TOKENIZER);
values.push(selectedItem[scope.valueField]);
displayValues.push(getDisplayValue(selectedItem));
scope.field.value = values.join(',');
scope.field.displayValue = displayValues.join(TOKENIZER);
e.preventDefault();
$select.select2('val', values).select2('close');
scope.$apply(function() {
callChange(oldValue, e);
});
}
}
function onRemoving(e) {
isExecuting = true;
oldValue = scope.field.value;
var removed = e.choice;
if (scope.multiple){
var values = scope.field.value.split(',');
var displayValues = scope.field.displayValue.split(TOKENIZER);
for(var i = values.length-1; i>=0; i--){
if (removed[scope.valueField] == values[i]) {
values.splice(i, 1);
displayValues.splice(i, 1);
break;
}
}
scope.field.value = values.join(',');
scope.field.displayValue = displayValues.join(TOKENIZER);
e.preventDefault();
$select.select2('val', scope.field.value.split(','));
scope.$apply(function() {
callChange(oldValue, e);
});
}
}
function callChange(oldValue, e) {
var f = scope.field;
var p = {
field: f,
newValue: f.value,
oldValue: oldValue,
displayValue: f.displayValue
}
scope.$emit("field.change", p);
scope.$emit("field.change." + f.name, p);
if (scope.onChange)
try {
scope.onChange(e);
} catch(ex) {
console.log("directive.snRecordPicker error in onChange")
console.log(ex)
}
isExecuting = false;
}
function onChanged(e) {
e.stopImmediatePropagation();
if (scope.$$phase || scope.$root.$$phase) {
console.warn('in digest, returning early');
return;
}
if (e.added) {
var selectedItem = e.added;
if (!scope.multiple){
scope.field.value = selectedItem[scope.valueField];
if (scope.field.value) {
scope.field.displayValue = getDisplayValue(selectedItem);
} else
scope.field.displayValue = '';
}
} else if (e.removed) {
if (!scope.multiple) {
scope.field.displayValue = '';
scope.field.value = '';
}
}
scope.$apply(function() {
callChange(oldValue, e);
});
}
function getDisplayValue(selectedItem) {
var displayValue = selectedItem[scope.valueField];
if (selectedItem) {
if (scope.displayField && angular.isDefined(selectedItem[scope.displayField]))
displayValue = selectedItem[scope.displayField];
else if (selectedItem.name)
displayValue = selectedItem.name;
else if (selectedItem.title)
displayValue = selectedItem.title;
}
return cleanLabel(displayValue);
}
function getdisplayFields(selectedItem) {
var displayFields = [];
if (selectedItem && selectedItem[scope.valueField]) {
var current = "";
if (scope.displayField && angular.isDefined(selectedItem[scope.displayField]))
current = selectedItem[scope.displayField];
else if (selectedItem.name)
current = selectedItem.name;
else if (selectedItem.title)
current = selectedItem.title;
displayFields.push(current);
}
if (scope.displayFields) {
var columns = scope.displayFields.split(",");
for (var i = 0; i < columns.length; i++) {
var column = columns[i];
if (selectedItem[column])
displayFields.push(selectedItem[column]);
}
}
return displayFields;
}
scope.$watch("field.value", function(newValue) {
if (isExecuting) return;
if (angular.isDefined(newValue) && $select) {
if (scope.multiple)
$select.select2('val', newValue.split(',')).select2('close');
else
$select.select2('val', newValue).select2('close');
}
});
function updateAriaExpanded(isOpen) {
if (scope.multiple)
element.parent().find(".select2-choices input[role='combobox']").attr("aria-expanded", isOpen);
else
element.parent().find(".select2-focusser").attr("aria-expanded", isOpen);
}
element.bind("select2-open", function() {
updateAriaExpanded(true);
});
element.bind("select2-close", function() {
updateAriaExpanded(false);
});
if (attrs.displayValue) {
attrs.$observe('displayValue', function(value){
scope.field.value = value;
});
}
init();
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snSelectBasic.js */
angular.module('sn.common.controls').directive('snSelectBasic', function($timeout,i18n) {
return {
restrict: 'C',
priority: 1,
require: '?ngModel',
scope: {
'snAllowClear': '@',
'snSelectWidth': '@',
'snChoices': '=?'
},
link: function (scope, element, attrs, ngModel) {
if (angular.isFunction(element.select2)) {
var config = {
allowClear: scope.selectAllowClear,
width: scope.selectWidth
};
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
i18n.getMessage('No matches found', function(msg) {
config.formatNoMatches = function() {
return msg;
};
});
i18n.getMessage('Loading more results...', function(msg) {
config.formatLoadMore = function() {
return msg;
};
});
element.css("opacity", 0);
scope.selectWidth = scope.snSelectWidth || '100%';
scope.selectAllowClear = scope.snAllowClear === "true";
$timeout(function(){
element.css("opacity", 1);
element.select2(config);
if (ngModel === null)
return;
ngModel.$render = function(){
element.select2('val', ngModel.$viewValue);
element.val(ngModel.$viewValue);
};
element.parent().find(".select2-focusser").attr("aria-expanded", false);
});
element.on('change', function() {
scope.$evalAsync(setModelValue);
});
scope.$watch('snChoices', function(newValue, oldValue){
if (angular.isDefined(newValue) && newValue != oldValue) {
$timeout(function(){
setModelValue();
});
}
}, true);
function setModelValue(){
if (ngModel === null)
return;
ngModel.$setViewValue(element.val());
};
element.on("select2-open", function() {
if (element.data('select2').search.val() === " ")
element.select2("search", "");
element.parent().find(".select2-focusser").attr("aria-expanded", true);
});
element.on("select2-close", function() {
element.parent().find(".select2-focusser").attr("aria-expanded", false);
});
}
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snTableReference.js */
angular.module('sn.common.controls').directive('snTableReference', function($timeout) {
"use strict";
return {
restrict: 'E',
replace: true,
scope: {
field: "=",
snChange: "&",
snDisabled: "="
},
template: '<select ng-disabled="snDisabled" style="min-width: 150px;" name="{{::field.name}}" ng-model="fieldValue" ng-model-options="{getterSetter: true}" ng-options="choice.value as choice.label for choice in field.choices"></select>',
controller: function($scope){
$scope.fieldValue = function(selected){
if (angular.isDefined(selected)) {
$scope.snChange({ newValue: selected });
}
return $scope.field.value;
}
},
link: function(scope, element) {
var initTimeout = null;
var fireReadyEvent = true;
var field = scope.field;
var isOpen = false;
element.css("opacity", 0);
function render() {
var select2Focusser = element.parent().find('.select2-focusser');
$timeout.cancel(initTimeout);
initTimeout = $timeout(function() {
element.css("opacity", 1);
element.select2("destroy");
element.select2();
if (select2Focusser.length > 0)
setAccessibilityRoles();
if (fireReadyEvent) {
scope.$emit('select2.ready', element);
fireReadyEvent = false;
}
});
}
element.bind("select2-open", function(){
isOpen = true;
element.parent().find('.select2-focusser').attr('aria-expanded', isOpen);
});
element.bind("select2-close", function(){
isOpen = false;
element.parent().find('.select2-focusser').attr('aria-expanded', isOpen);
});
scope.$on('select2.ready', function() {
setAccessibilityRoles();
});
function setAccessibilityRoles() {
var select2Results = element.parent().find('ul.select2-results');
var select2Focusser = element.parent().find('.select2-focusser');
var select2Choice = element.parent().find(".select2-choice");
select2Focusser.removeAttr('aria-labelledby');
select2Focusser.attr('aria-label', getAriaLabel());
select2Focusser.attr('aria-required', field.isMandatory());
select2Focusser.attr('aria-expanded', isOpen);
select2Focusser.attr('aria-owns', select2Results.attr('id'));
select2Choice.attr("aria-hidden", true);
}
function getAriaLabel() {
var displayValue = '';
var label = '';
label += field.label;
displayValue = element.parent().find('.select2-choice .select2-chosen').text();
if (displayValue) {
label += (" " + displayValue);
}
return label;
}
scope.$watch("field.displayValue", function(newValue, oldValue) {
if (newValue !== undefined && newValue != oldValue) {
render();
}
});
render();
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snFieldReference.js */
angular.module('sn.common.controls').directive('snFieldReference', function($timeout, $http, nowServer) {
"use strict";
return {
restrict: 'E',
replace: true,
scope: {
field: "=",
snChange: "&",
snDisabled: "=",
getGlideForm: '&glideForm'
},
template: '<select ng-disabled="snDisabled" name="{{field.name}}" style="min-width: 150px;" ng-model="fieldValue" ng-model-options="{getterSetter: true}" ng-options="choice.name as choice.label for choice in field.choices"></select>',
controller: function($scope){
$scope.fieldValue = function(selected){
if (angular.isDefined(selected))
$scope.snChange({ newValue: selected });
return $scope.field.value;
}
$scope.$watch('field.dependentValue', function(newVal, oldVal){
if (!angular.isDefined(newVal))
return;
var src = nowServer.getURL('table_fields', 'exclude_formatters=true&fd_table=' + newVal);
$http.post(src).success(function(response) {
$scope.field.choices = response;
$scope.render();
});
});
},
link: function(scope, element) {
var initTimeout = null;
var fireReadyEvent = true;
scope.render = function() {
$timeout.cancel(initTimeout);
initTimeout = $timeout(function() {
element.select2("destroy");
element.select2();
if (fireReadyEvent) {
scope.$emit('select2.ready', element);
fireReadyEvent = false;
}
});
};
scope.$watch("field.displayValue", function(newValue, oldValue) {
if (newValue !== undefined && newValue != oldValue) {
scope.render();
}
});
scope.render();
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snSyncWith.js */
angular.module("sn.common.controls").directive('snSyncWith', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, elem, attr) {
var journalField = scope.$eval(attr.snSyncWith);
var journalValue =  scope.$eval(attr.ngModel);
if(attr.snSyncWithValueInFn)
scope.$eval(attr.ngModel + "=" + attr.snSyncWithValueInFn, {text: scope.value});
scope.$watch(function() {
return scope.$eval(attr.snSyncWith);
}, function(nv, ov) {
if (nv !== journalField)
journalField = nv;
});
scope.$watch(function() {
return scope.$eval(attr.ngModel);
}, function(nv, ov) {
if (nv !== ov)
journalValue = nv;
});
if (!window.g_form)
return;
scope.$watch(function(){
return journalValue;
}, function (n, o) {
if (n !== o)
setFieldValue();
});
function setFieldValue() {
setValue(journalField, journalValue);
}
function setValue(field, value) {
value = !!value ? value : '';
var control = g_form.getControl(field);
if(attr.snSyncWithValueOutFn)
value = scope.$eval(attr.snSyncWithValueOutFn,  {text: value})
control.value = value;
onChange(control.id);
}
scope.$watch(function(){
return journalField;
}, function(newValue, oldValue) {
if (newValue !== oldValue){
if (oldValue)
setValue(oldValue, '');
if (newValue)
setFieldValue();
}
}, true);
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.contenteditable.js */
angular.module('sn.common.controls').directive('contenteditable', function($timeout, $sanitize) {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ctrl) {
var changehandler = scope.changehandler;
scope.usenewline = scope.usenewline + "" != "false";
var newLine = "\n";
var nodeBR = "BR";
var nodeDIV = "DIV";
var nodeText = "#text";
var nbspRegExp = new RegExp(String.fromCharCode(160), "g");
if (!scope.usenewline)
elem.keypress(function(event) {
if (event.which == "13") {
if (scope.entercallback)
scope.entercallback(elem);
event.preventDefault();
}
});
function processNodes(nodes) {
var val = "";
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var follow = true;
switch (node.nodeName) {
case nodeText:
val += node.nodeValue.replace(nbspRegExp, " ");
break;
case nodeDIV:
val += newLine;
if (node.childNodes.length == 1 && node.childNodes[0].nodeName == nodeBR)
follow = false;
break;
case nodeBR:
val += scope.usenewline ? newLine : "";
}
if (follow)
val += processNodes(node.childNodes)
}
return val;
}
function readHtml() {
var val = processNodes(elem[0].childNodes);
ctrl.$setViewValue(val);
}
function writeHtml() {
var val = ctrl.$viewValue;
if (!val || val === null)
val = "";
val = val.replace(/\n/gi,	scope.usenewline ? "<br/>" : "");
val = val.replace(/  /gi,	" &nbsp;");
try {
if (attrs.contenteditableEscapeHtml == "true")
val = $sanitize(val);
} catch (err) {
var replacement = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;', '/': '&#x2F;'};
val = val.replace(/[&<>"'\/]/g, function (pattern) {return replacement[pattern]});
};
elem.html(val);
}
function processPlaceholder() {
if (elem[0].dataset) {
if (elem[0].textContent)
elem[0].dataset.divPlaceholderContent = 'true';
else if (elem[0].dataset.divPlaceholderContent)
delete(elem[0].dataset.divPlaceholderContent);
}
}
elem.bind('keyup', function() {
scope.$apply(function() {
readHtml();
processPlaceholder();
});
});
function selectText(elem) {
var range;
var selection;
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(elem);
range.select();
} else if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(elem);
selection.removeAllRanges();
selection.addRange(range);
}
}
elem.bind('focus', function() {
if (scope[attrs.tracker] && scope[attrs.tracker]['isDefault_' + attrs.trackeratt])
$timeout(function() {
selectText(elem[0]);
});
elem.original = ctrl.$viewValue;
});
elem.bind('blur', function() {
scope.$apply(function() {
readHtml();
processPlaceholder();
if (elem.original != ctrl.$viewValue && changehandler) {
if (scope[attrs.tracker] && typeof scope[attrs.tracker]['isDefault_' + attrs.trackeratt] != "undefined")
scope[attrs.tracker]['isDefault_' + attrs.trackeratt] = false;
changehandler(scope[attrs.tracker], attrs.trackeratt);
}
});
});
elem.bind('paste', function() {
scope.$apply(function() {
setTimeout(function() {
readHtml();
writeHtml();
}, 0);
return false;
});
});
ctrl.$render = function() {
writeHtml();
};
scope.$watch('field.readonly', function(){
elem[0].contentEditable = !scope.$eval('field.readonly');
});
scope.$watch(
function () {
return {
val: elem[0].textContent
};
},
function (newValue, oldValue) {
if (newValue.val != oldValue.val)
processPlaceholder();
},
true);
writeHtml();
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snGlyph.js */
angular.module("sn.common.controls").directive("snGlyph", function() {
"use strict";
return {
restrict : 'E',
replace : true,
scope : {
char : "@",
},
template : '<span class="glyphicon glyphicon-{{char}}" />',
link : function(scope) {}
}
});
angular.module("sn.common.controls").directive('fa', function () {
return {
restrict: 'E',
template: '<span class="fa" aria-hidden="true"></span>',
replace: true,
link: function (scope, element, attrs) {
'use strict';
var currentClasses = {};
function _observeStringAttr (attr, baseClass) {
var className;
attrs.$observe(attr, function () {
baseClass = baseClass || 'fa-' + attr;
element.removeClass(currentClasses[attr]);
if (attrs[attr]) {
className = [baseClass, attrs[attr]].join('-');
element.addClass(className);
currentClasses[attr] = className;
}
});
}
_observeStringAttr('name', 'fa');
_observeStringAttr('rotate');
_observeStringAttr('flip');
_observeStringAttr('stack');
attrs.$observe('size', function () {
var className;
element.removeClass(currentClasses.size);
if (attrs.size === 'large') {
className = 'fa-lg';
} else if (!isNaN(parseInt(attrs.size, 10))) {
className = 'fa-' + attrs.size + 'x';
}
element.addClass(className);
currentClasses.size = className;
});
attrs.$observe('stack', function () {
var className;
element.removeClass(currentClasses.stack);
if (attrs.stack === 'large') {
className = 'fa-stack-lg';
} else if (!isNaN(parseInt(attrs.stack, 10))) {
className = 'fa-stack-' + attrs.stack + 'x';
}
element.addClass(className);
currentClasses.stack = className;
});
function _observeBooleanAttr (attr, className) {
var value;
attrs.$observe(attr, function () {
className = className || 'fa-' + attr;
value = attr in attrs && attrs[attr] !== 'false' && attrs[attr] !== false;
element.toggleClass(className, value);
});
}
_observeBooleanAttr('border');
_observeBooleanAttr('fw');
_observeBooleanAttr('inverse');
_observeBooleanAttr('spin');
element.toggleClass('fa-li',
element.parent() &&
element.parent().prop('tagName') === 'LI' &&
element.parent().parent() &&
element.parent().parent().hasClass('fa-ul') &&
element.parent().children()[0] === element[0] &&
attrs.list !== 'false' &&
attrs.list !== false
);
attrs.$observe('alt', function () {
var altText = attrs.alt,
altElem = element.next(),
altElemClass = 'fa-alt-text';
if (altText) {
element.removeAttr('alt');
if (!altElem || !altElem.hasClass(altElemClass)) {
element.after('<span class="sr-only fa-alt-text"></span>');
altElem = element.next();
}
altElem.text(altText);
} else if (altElem && altElem.hasClass(altElemClass)) {
altElem.remove();
}
});
}
};
})
.directive('faStack', function () {
return {
restrict: 'E',
transclude: true,
template: '<span ng-transclude class="fa-stack fa-lg"></span>',
replace: true,
link: function (scope, element, attrs) {
var currentClasses = {};
function _observeStringAttr (attr, baseClass) {
var className;
attrs.$observe(attr, function () {
baseClass = baseClass || 'fa-' + attr;
element.removeClass(currentClasses[attr]);
if (attrs[attr]) {
className = [baseClass, attrs[attr]].join('-');
element.addClass(className);
currentClasses[attr] = className;
}
});
}
_observeStringAttr('size');
attrs.$observe('size', function () {
var className;
element.removeClass(currentClasses.size);
if (attrs.size === 'large') {
className = 'fa-lg';
} else if (!isNaN(parseInt(attrs.size, 10))) {
className = 'fa-' + attrs.size + 'x';
}
element.addClass(className);
currentClasses.size = className;
});
}
};
});
;
/*! RESOURCE: /scripts/sn/common/controls/directive.snImageUploader.js */
angular.module('sn.common.controls').directive('snImageUploader', function($window, $rootScope, $timeout, getTemplateUrl, i18n, snAttachmentHandler) {
var DRAG_IMAGE_SELECT = i18n.getMessage('Drag image or click to select');
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl('directive.snImageUploader'),
transclude: true,
scope: {
readOnly: '@',
tableName: '@',
sysId: '@',
fieldName: '@',
onUpload: '&',
onDelete: '&',
uploadMessage: '@',
src: '='
},
controller: function($scope) {
$scope.uploading = false;
$scope.getTitle = function() {
if($scope.readOnly !== 'true')
return DRAG_IMAGE_SELECT;
return '';
}
},
link: function(scope, element) {
function isValidImage(file) {
if (file.type.indexOf('image') != 0) {
$alert(i18n.getMessage('Please select an image'));
return false;
}
if (file.type.indexOf('tiff') > 0) {
$alert(i18n.getMessage('Please select a common image format such as gif, jpeg or png'));
return false;
}
return true;
}
function $alert(message) {
alert(message);
}
scope.onFileSelect = function($files) {
if (scope.readOnly === 'true')
return;
if ($files.length == 0)
return;
var file = $files[0];
if(!isValidImage(file))
return;
var uploadParams = {
sysparm_fieldname: scope.fieldName
};
scope.uploading = true;
snAttachmentHandler.create(scope.tableName, scope.sysId).uploadAttachment(file, uploadParams).then(function(response) {
$timeout(function() {
scope.uploading = false;
});
if (scope.onUpload)
scope.onUpload(response);
$rootScope.$broadcast("snImageUploader:complete", scope.sysId, response);
});
}
scope.openFileSelector = function($event) {
$event.stopPropagation();
var input = element.find('input[type=file]');
input.click();
}
scope.activateUpload = function($event) {
if (scope.readOnly !== 'true')
scope.openFileSelector($event);
else
scope.showUpload = !scope.showUpload;
}
scope.deleteAttachment = function () {
var sys_id = scope.src.split(".")[0];
snAttachmentHandler.deleteAttachment(sys_id).then(function () {
scope.src = null;
if (scope.onDelete)
scope.onDelete();
$rootScope.$broadcast("snImageUploader:delete", scope.sysId, sys_id);
});
}
}
}
});
;
;
/*! RESOURCE: /scripts/sn/common/i18n/js_includes_i18n.js */
/*! RESOURCE: /scripts/sn/common/i18n/_module.js */
angular.module('sn.common.i18n', ['sn.common.glide']);
angular.module('sn.i18n', ['sn.common.i18n']);
;
/*! RESOURCE: /scripts/sn/common/i18n/directive.snBindI18n.js */
angular.module('sn.common.i18n').directive('snBindI18n', function(i18n, $sanitize) {
return {
restrict: 'A',
link : function(scope, iElem, iAttrs) {
i18n.getMessage(iAttrs.snBindI18n, function(translatedValue) {
var sanitizedValue = $sanitize(translatedValue);
iElem.append(sanitizedValue);
});
}
}
});
;
/*! RESOURCE: /scripts/sn/common/i18n/directive.message.js */
angular.module('sn.common.i18n').directive('nowMessage', function(i18n) {
return {
restrict: 'E',
priority: 0,
template: '',
replace: true,
compile: function(element, attrs, transclude) {
var value = element.attr('value');
if (!attrs.key || !value)
return;
i18n.loadMessage(attrs.key, value);
}
};
});
;
/*! RESOURCE: /scripts/sn/common/i18n/service.i18n.js */
angular.module('sn.common.i18n').provider('i18n', function() {
var messageMap = {};
function loadMessage(msgKey, msgValue) {
messageMap[msgKey] = msgValue;
}
this.preloadMessages = function(messages) {
angular.forEach(messages, function(key, val) {
loadMessage(key, val);
});
};
function interpolate(param) {
return this.replace(/{([^{}]*)}/g,
function (a, b) {
var r = param[b];
return typeof r === 'string' || typeof r === 'number' ? r : a;
}
);
}
if (!String.prototype.withValues)
String.prototype.withValues = interpolate;
this.$get = function(nowServer, $http, $window, $log) {
var isDebug = $window.NOW ? $window.NOW.i18n_debug : true;
function debug(msg) {
if (!isDebug)
return;
$log.log('i18n: ' + msg);
}
function getMessageFromServer( msgKey, callback) {
getMessagesFromServer([msgKey], function() {
if (callback)
callback(messageMap[msgKey]);
});
}
function getMessagesFromServer( msgArray, callback,  msgArrayFull) {
var url = nowServer.getURL('message');
$http.post(url, { messages: msgArray }).success(function(response) {
var messages = response.messages;
for (var i in messages) {
loadMessage(i, messages[i]);
}
var returnMessages = {},
allMessages = msgArrayFull || msgArray;
for (var j = 0; j < allMessages.length; j++) {
var key = allMessages[j];
returnMessages[key] = messageMap[key];
}
if (callback)
callback(returnMessages);
});
}
return {
getMessage: function( msgKey, callback) {
debug('getMessage: Checking for ' + msgKey);
if (messageMap.hasOwnProperty(msgKey)) {
var message = messageMap[msgKey];
if (typeof(callback) == 'function')
callback(message);
debug('getMessage: Found: ' + msgKey + ', message: ' + message);
return message;
}
debug('getMessage: Not found: ' + msgKey + ', querying server');
getMessageFromServer(msgKey, callback);
msgKey.withValues = interpolate;
if (typeof(callback) != 'function')
$log.warn('getMessage (key="' + msgKey + '"): synchronous use not supported in Mobile or Service Portal unless message is already cached');
return msgKey;
},
format: function(message) {
if(arguments.length == 1)
return message;
if(arguments.length == 2 && (typeof arguments[1] === 'object'))
return interpolate.call(message, arguments[1]);
return interpolate.call(message, [].slice.call(arguments, 1));
},
getMessages: function( msgArray, callback) {
debug('getMessages: Checking for ' + msgArray.join(','));
var results = {},
needMessage = [],
needServerRequest = false;
for (var i = 0; i < msgArray.length; i++) {
var key = msgArray[i];
if (!messageMap.hasOwnProperty(key)) {
debug('getMessages: Did not find ' + key);
needMessage.push(key);
needServerRequest = true;
results[key] = key;
continue;
}
results[key] = messageMap[key];
debug('getMessages: Found ' + key + ', message: ' + results[key]);
}
if (needServerRequest) {
debug('getMessages: Querying server for ' + needMessage.join(','));
getMessagesFromServer(needMessage, callback, msgArray);
} else if (typeof(callback) == 'function') {
debug('getMessages: Found all messages');
callback(results);
}
return results;
},
clearMessages: function() {
debug('clearMessages: clearing messages');
messageMap = {};
},
loadMessage: function(msgKey, msgValue) {
loadMessage(msgKey, msgValue);
debug('loadMessage: loaded key: ' + msgKey + ', value: ' + msgValue);
},
preloadMessages: function() {
var that = this
angular.element('now-message').each(function() {
var elem = angular.element(this);
that.loadMessage(elem.attr('key'), elem.attr('value'));
})
}
};
};
});
;
;
/*! RESOURCE: /scripts/sn/common/link/js_includes_link.js */
/*! RESOURCE: /scripts/sn/common/link/_module.js */
angular.module("sn.common.link", []);
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContent.js */
angular.module('sn.common.link').directive('snLinkContent', function($compile, linkContentTypes) {
'use strict';
return {
restrict: 'E',
replace: true,
template: "<span />",
scope: {
link: "="
},
link: function(scope, elem) {
scope.isShowing = function() {
return (scope.link.isActive || scope.link.isUnauthorized) && !scope.link.isPending;
};
var linkDirective = linkContentTypes.forType(scope.link);
elem.attr(linkDirective, "");
elem.attr('ng-if', 'isShowing()');
$compile(elem)(scope);
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentYoutube.js */
angular.module('sn.common.link').directive('snLinkContentYoutube', function(getTemplateUrl, $sce, inFrameSet) {
'use strict';
return {
restrict: 'A',
replace: true,
templateUrl: getTemplateUrl('snLinkContentYoutube.xml'),
scope: {
link: "="
},
controller: function($scope) {
$scope.playerActive = false;
$scope.width = (inFrameSet) ? '248px' : '500px';
$scope.height = (inFrameSet) ? '139px' : '281px';
$scope.showPlayer = function() {
$scope.playerActive = true;
};
$scope.getVideoEmbedLink = function() {
if ($scope.link.embedLink) {
var videoLink = $scope.link.embedLink + "?autoplay=1";
return $sce.trustAsHtml("<iframe width='" + $scope.width + "' height='" + $scope.height + "' autoplay='1' frameborder='0' allowfullscreen='' src='" + videoLink + "'></iframe>");
}
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentSoundcloud.js */
angular.module('sn.common.link').directive('snLinkContentSoundcloud', function(getTemplateUrl, $sce, inFrameSet) {
'use strict';
return {
restrict: 'A',
replace: true,
templateUrl: getTemplateUrl('snLinkContentSoundcloud.xml'),
scope: {
link: "="
},
controller: function($scope) {
$scope.playerActive = false;
$scope.width = (inFrameSet) ? '248px' : '500px';
$scope.height = (inFrameSet) ? '139px' : '281px';
$scope.showPlayer = function() {
$scope.playerActive = true;
};
$scope.getVideoEmbedLink = function() {
if ($scope.link.embedLink) {
var videoLink = $scope.link.embedLink + "&amp;auto_play=true";
var width = (inFrameSet) ? 248 : 500;
return $sce.trustAsHtml("<iframe width='" + $scope.width + "' height='" + $scope.height + "' autoplay='1' frameborder='0' allowfullscreen='' src='" + videoLink + "'></iframe>");
}
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentArticle.js */
angular.module('sn.common.link').directive('snLinkContentArticle', function(getTemplateUrl) {
'use strict';
return {
restrict: 'A',
replace: true,
templateUrl: getTemplateUrl('snLinkContentArticle.xml'),
scope: {
link: "="
},
controller: function($scope) {
$scope.backgroundImageStyle = $scope.link.imageLink
? {"background-image": 'url(' + $scope.link.imageLink + ')'}
: {};
$scope.isVisible = function() {
var link = $scope.link;
return !!link.shortDescription || !!link.imageLink;
};
$scope.hasDescription = function() {
var link = $scope.link;
return link.shortDescription && (link.shortDescription !== link.title);
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentError.js */
angular.module('sn.common.link').directive('snLinkContentError', function(getTemplateUrl) {
'use strict';
return {
restrict: 'A',
replace: true,
templateUrl: getTemplateUrl('snLinkContentError.xml'),
scope: {
link: "="
},
controller: function($scope) {
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentImage.js */
angular.module('sn.common.link').directive('snLinkContentImage', function(getTemplateUrl) {
'use strict';
return {
restrict: 'A',
replace: true,
templateUrl: getTemplateUrl('snLinkContentImage.xml'),
scope: {
link: "="
},
controller: function($scope) {
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentAttachment.js */
angular.module('sn.common.link').directive('snLinkContentAttachment', function(getTemplateUrl) {
'use strict';
return {
restrict: 'EA',
replace: true,
templateUrl: getTemplateUrl('snLinkContentAttachment.xml'),
scope: {
attachment: '=',
link: '='
},
controller: function($scope, $element, snCustomEvent) {
$scope.attachmentFile = $scope.attachment || $scope.link.attachment;
$scope.calcImageSize = function() {
var imageWidth = $scope.width;
var imageHeight = $scope.height;
var MAX_IMAGE_SIZE = $element.width() < 298 ? $element.width() : 298;
if (imageHeight < 0 || imageWidth < 0)
return "";
if (imageHeight > imageWidth) {
if (imageHeight >= MAX_IMAGE_SIZE) {
imageWidth *= MAX_IMAGE_SIZE / imageHeight;
imageHeight = MAX_IMAGE_SIZE;
}
} else {
if (imageWidth >= MAX_IMAGE_SIZE) {
imageHeight *= MAX_IMAGE_SIZE / imageWidth;
imageWidth = MAX_IMAGE_SIZE
}
}
return "height: " + imageHeight + "px; width: " + imageWidth + "px;";
};
$scope.aspectRatioClass = function() {
return ($scope.height > $scope.width) ? 'limit-height' : 'limit-width';
};
$scope.showImage = function(event) {
if (event.keyCode === 9)
return;
snCustomEvent.fire('sn.attachment.preview', event, $scope.attachmentFile.rawData);
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/directive.snLinkContentRecord.js */
angular.module('sn.common.link').directive('snLinkContentRecord', function(getTemplateUrl) {
'use strict';
return {
restrict: 'A',
replace: true,
templateUrl: getTemplateUrl('snLinkContentRecord.xml'),
scope: {
link: '='
},
controller: function($scope) {
$scope.isTitleVisible = function() {
return !$scope.isDescriptionVisible() && $scope.link.title;
};
$scope.isDescriptionVisible = function() {
return $scope.link.shortDescription;
};
$scope.hasNoHeader = function() {
return !$scope.isTitleVisible() && !$scope.isDescriptionVisible();
};
$scope.isUnassigned = function() {
return $scope.link.isTask && !$scope.link.avatarID;
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/link/provider.linkContentTypes.js */
angular.module('sn.common.link').provider('linkContentTypes', function linkContentTypesProvider() {
"use strict";
var linkDirectiveMap = {
'record' : "sn-link-content-record",
'attachment' : "sn-link-content-attachment",
'video' : "sn-link-content-youtube",
'music.song': "sn-link-content-soundcloud",
'link'   : 'sn-link-content-article',
'article': 'sn-link-content-article',
'website': 'sn-link-content-article',
'image': 'sn-link-content-image'
};
this.$get = function linkContentTypesFactory() {
return {
forType: function(link) {
if (link.isUnauthorized)
return "sn-link-content-error";
return linkDirectiveMap[link.type] || "no-card";
}
}
};
});
;
;
/*! RESOURCE: /scripts/sn/common/mention/js_includes_mention.js */
/*! RESOURCE: /scripts/sn/common/mention/_module.js */
angular.module("sn.common.mention", []);
;
/*! RESOURCE: /scripts/sn/common/mention/directive.snMentionPopover.js */
angular.module('sn.common.mention').directive("snMentionPopover", function(getTemplateUrl, $timeout) {
'use strict';
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl('snMentionPopover.xml'),
link: function(scope, elem, $attrs) {
elem.detach().appendTo(document.body);
scope.dontPositionManually = scope.$eval($attrs.dontpositionmanually) || false;
scope.onClick = function(event) {
if (!angular.element(event.target).closest("#mention-popover").length
|| angular.element(event.target).closest("#direct-message-popover-trigger").length) {
scope.$evalAsync(function() {
scope.$parent.showPopover = false;
scope.$emit("snMentionPopover.showPopoverIsFalse");
if (scope.dontPositionManually && !(scope.$eval($attrs.snavatarpopover))) {
elem.remove();
} else {
scope.$broadcast("sn-avatar-popover-destroy");
}
angular.element('.popover').each(function () {
var object = angular.element(this);
if (object.popover) {
object.popover('hide');
}
})
});
}
};
scope.clickListener = $timeout(function() {
angular.element('html').on('click.mentionPopover', scope.onClick);
}, 0, false);
scope.$on('sn-bootstrap-popover.close-other-popovers', scope.onClick);
function setPopoverPosition(clickX, clickY) {
var topPosition;
var leftPosition;
var windowHeight = window.innerHeight;
var windowWidth  = window.innerWidth;
if (((clickY - (elem.height() / 2))) < 10)
topPosition = 10;
else
topPosition = ((clickY + (elem.height() / 2)) > windowHeight) ? windowHeight - elem.height() - 15 : clickY - (elem.height() / 2);
leftPosition = ((clickX + 20 + (elem.width())) > windowWidth) ? windowWidth - elem.width() - 15: clickX  + 20;
elem.css("top", topPosition + "px").css("left", leftPosition + "px");
}
if (!scope.dontPositionManually) {
$timeout(function () {
var clickX = (scope.$parent && scope.$parent.clickEvent && scope.$parent.clickEvent.pageX) ? scope.$parent.clickEvent.pageX : clickX || 300;
var clickY = (scope.$parent && scope.$parent.clickEvent && scope.$parent.clickEvent.pageY) ? scope.$parent.clickEvent.pageY : clickY || 300;
setPopoverPosition(clickX, clickY);
elem.velocity({
opacity: 1
}, {
duration: 100,
easing: "cubic"
});
});
}
},
controller: function($scope, $element, $attrs) {
$scope.profile = $scope.$eval($attrs.profile);
$scope.$on("$destroy", function() {
angular.element('html').off('click.mentionPopover', $scope.onClick);
$element.remove();
});
}
}
});
;
/*! RESOURCE: /scripts/sn/common/mention/service.snMention.js */
angular.module("sn.common.mention").factory("snMention", function(liveProfileID, $q, $http) {
"use strict";
var MENTION_PATH = "/api/now/form/mention/record";
var USER_PATH = '/api/now/ui/user/';
var avatarCache = {};
function retrieveMembers(table, document, term) {
if(!term || !document || !table) {
var deferred = $q.defer();
deferred.resolve([]);
return deferred.promise;
}
return $http( {
url: MENTION_PATH + "/" + table + "/" + document,
method: "GET",
params: {
term: term
}
}).then(function(response) {
var members = response.data.result;
var promises = [];
angular.forEach(members, function(user) {
if (avatarCache[user.sys_id]) {
user.initials = avatarCache[user.sys_id].initials;
user.avatar = avatarCache[user.sys_id].avatar;
} else {
var promise = $http.get(USER_PATH + user.sys_id).success(function(response) {
user.initials = response.result.user_initials;
user.avatar = response.result.user_avatar;
avatarCache[user.sys_id] = {initials: user.initials, avatar: user.avatar};
});
promises.push(promise);
}
});
return $q.all(promises).then(function() {
return members;
});
})
}
return {
retrieveMembers: retrieveMembers
}
});
;
;
/*! RESOURCE: /scripts/sn/common/messaging/js_includes_messaging.js */
/*! RESOURCE: /scripts/doctype/CustomEventManager.js */
var NOW = NOW || {};
var CustomEventManager = (function (existingCustomEvent) {
"use strict";
var events = (existingCustomEvent && existingCustomEvent.events) || {};
var isFiringFlag = false;
var trace = false;
var suppressEvents = false;
var NOW_MSG = 'NOW.PostMessage';
function observe(eventName, fn){
if (trace)
jslog("$CustomEventManager observing: " + eventName);
on(eventName, fn);
}
function on(name, func) {
if (!func || typeof func !== 'function')
return;
if (typeof name === 'undefined')
return;
if (!events[name])
events[name] = [];
events[name].push(func);
}
function un(name, func) {
if (!events[name])
return;
var idx = -1;
for (var i = 0; i < events[name].length; i++) {
if (events[name][i] === func) {
idx = i;
break;
}
}
if (idx >= 0)
events[name].splice(idx, 1)
}
function unAll(name) {
if (events[name])
delete events[name];
}
function fire(eventName, args){
if (trace)
jslog("$CustomEventManager firing: " + eventName + " args: " + arguments.length);
return fireEvent.apply(null, arguments);
}
function fireUp(eventName, args){
var win = window;
while (win){
try {
if (win.CustomEvent.fireEvent.apply(null, arguments) === false)
return;
win = win.parent === win ? null : win.parent;
}catch(e){
return;
}
}
}
function fireEvent() {
if (suppressEvents)
return true;
var args = Array.prototype.slice.apply(arguments);
var name = args.shift();
var eventList = events[name];
if (!eventList)
return true;
var event = eventList.slice();
isFiringFlag = true;
for (var i = 0, l = event.length; i < l; i++) {
var ev = event[i];
if (!ev)
continue;
if (ev.apply(null, args) === false) {
isFiringFlag = false;
return false;
}
}
isFiringFlag = false;
return true;
}
function isFiring() {
return isFiringFlag;
}
function forward(name, element, func) {
on(name, func);
element.addEventListener(name, function(e) {
fireEvent(e.type, this, e);
}.bind(api));
}
function isOriginInWhiteList(origin, whitelistStr) {
if (!whitelistStr) {
return false;
}
var delimiterRegex = /[\n, ]/;
var whitelist = whitelistStr.split(delimiterRegex)
.filter(function(whiteListedOrigin) {
return whiteListedOrigin;
})
.map(function(whiteListedOrigin) {
return whiteListedOrigin.toLowerCase();
});
if (~whitelist.indexOf(origin.toLowerCase())) {
return true;
}
return false;
}
function shouldProcessMessage(sourceOrigin) {
if (!window.g_concourse_onmessage_enforce_same_origin || sourceOrigin === window.location.origin) {
return true;
}
return isOriginInWhiteList(sourceOrigin, window.g_concourse_onmessage_enforce_same_origin_whitelist);
}
function registerPostMessageEvent() {
if (NOW.registeredPostMessageEvent) {
return;
}
if (!window.postMessage) {
return;
}
window.addEventListener('message', function (event) {
if (!shouldProcessMessage(event.origin)) {
console.warn('Incoming message ignored due to origin mismatch.');
return;
}
var nowMessageJSON = event.data;
var nowMessage;
try {
nowMessage = JSON.parse(nowMessageJSON.toString());
} catch (e) {
return;
}
if (!nowMessage.type == NOW_MSG) {
return;
}
fire(nowMessage.eventName, nowMessage.args);
}, false);
NOW.registeredPostMessageEvent = true;
}
function doPostMessage(win, event, msg, targetOrigin) {
var nowMessage = {type: NOW_MSG, eventName: event, args: msg};
var nowMessageJSON;
if (!win || !win.postMessage) {
return
}
nowMessageJSON = JSON.stringify(nowMessage);
win.postMessage(nowMessageJSON, targetOrigin);
}
function fireTop(eventName, args){
if (trace)
jslog("$CustomEventManager firing: " + eventName + " args: " + arguments.length);
fireEvent.apply(null, arguments);
var t = getTopWindow();
if (t !== null && window !== t)
t.CustomEvent.fire(eventName, args);
}
function fireAll(eventName, args) {
if (trace)
jslog("$CustomEventManager firing: " + eventName + " args: " + arguments.length);
var topWindow = getTopWindow();
if (topWindow !== window.self)
CustomEvent.fireEvent(eventName, args);
notifyAllFrom(topWindow);
function notifyAllFrom(rootFrame) {
var childFrame;
rootFrame.CustomEvent.fireEvent(eventName, args);
for (var i = 0; i < rootFrame.frames.length; i++) {
try {
childFrame = rootFrame.frames[i];
if (!childFrame)
continue;
if (childFrame.CustomEvent && typeof childFrame.CustomEvent.fireEvent === "function") {
notifyAllFrom(childFrame);
}
} catch(e) {
}
}
}
}
function fireToWindow(targetWindow, eventName, args, usePostMessage, targetOrigin) {
if (trace)
jslog("$CustomEventManager firing: " + eventName + " args: " + args.length);
if (usePostMessage) {
doPostMessage(targetWindow, eventName, args, targetOrigin);
} else {
targetWindow.CustomEvent.fireEvent(eventName, args);
}
}
function getTopWindow() {
var topWindow = window.self;
try {
while (topWindow.CustomEvent.fireEvent && topWindow !== topWindow.parent && topWindow.parent.CustomEvent.fireEvent) {
topWindow = topWindow.parent;
}
} catch (e) {}
return topWindow;
}
function isTopWindow() {
return getTopWindow() == window.self;
}
function jslog(msg, src, dateTime) {
try {
if (!src) {
var path = window.self.location.pathname;
src = path.substring(path.lastIndexOf('/') + 1);
}
if (window.self.opener && window != window.self.opener) {
if (window.self.opener.jslog) {
window.self.opener.jslog(msg, src, dateTime);
}
} else if (parent && parent.jslog && jslog != parent.jslog) {
parent.jslog(msg, src, dateTime);
} else {
if (window.console && window.console.log)
console.log(msg);
}
} catch (e) {
}
}
var api =  {
set trace(value) {
trace = !!value;
},
get trace() {
return trace;
},
set suppressEvents(value) {
suppressEvents = !!value;
},
get suppressEvents() {
return suppressEvents;
},
get events() {
return events;
},
set events(value) {
events = value;
},
on: on,
un: un,
unAll: unAll,
forward: forward,
isFiring: isFiring,
fireEvent: fireEvent,
observe: observe,
fire: fire,
fireTop: fireTop,
fireAll: fireAll,
fireToWindow: fireToWindow,
isTopWindow: isTopWindow,
fireUp: fireUp,
toString: function() { return 'CustomEventManager'; }
};
registerPostMessageEvent();
return api;
})(NOW.CustomEvent);
NOW.CustomEvent = CustomEventManager;
if (typeof CustomEvent !== "undefined") {
CustomEvent.observe = NOW.CustomEvent.observe.bind(NOW.CustomEvent);
CustomEvent.fire = NOW.CustomEvent.fire.bind(NOW.CustomEvent);
CustomEvent.fireUp = NOW.CustomEvent.fireUp.bind(NOW.CustomEvent);
CustomEvent.fireTop = NOW.CustomEvent.fireTop.bind(NOW.CustomEvent);
CustomEvent.fireAll = NOW.CustomEvent.fireAll.bind(NOW.CustomEvent);
CustomEvent.fireToWindow = NOW.CustomEvent.fireToWindow.bind(NOW.CustomEvent);
CustomEvent.on = NOW.CustomEvent.on.bind(NOW.CustomEvent);
CustomEvent.un = NOW.CustomEvent.un.bind(NOW.CustomEvent);
CustomEvent.unAll = NOW.CustomEvent.unAll.bind(NOW.CustomEvent);
CustomEvent.forward = NOW.CustomEvent.forward.bind(NOW.CustomEvent);
CustomEvent.isFiring = NOW.CustomEvent.isFiring.bind(NOW.CustomEvent);
CustomEvent.fireEvent = NOW.CustomEvent.fireEvent.bind(NOW.CustomEvent);
CustomEvent.events = NOW.CustomEvent.events;
CustomEvent.isTopWindow = NOW.CustomEvent.isTopWindow.bind(NOW.CustomEvent);
} else {
window.CustomEvent = NOW.CustomEvent;
}
;
/*! RESOURCE: /scripts/sn/common/messaging/_module.js */
angular.module('sn.common.messaging', []);
angular.module('sn.messaging', ['sn.common.messaging']);
;
/*! RESOURCE: /scripts/sn/common/messaging/service.snCustomEvent.js */
angular.module('sn.common.messaging').factory('snCustomEvent',  function() {
"use strict";
if (typeof NOW.CustomEvent === 'undefined')
throw "CustomEvent not found in NOW global";
return NOW.CustomEvent;
});
;
;
/*! RESOURCE: /scripts/sn/common/notification/js_includes_notification.js */
/*! RESOURCE: /scripts/sn/common/notification/_module.js */
angular.module('sn.common.notification', ['sn.common.util', 'ngSanitize', 'sn.common.i18n']);
;
/*! RESOURCE: /scripts/sn/common/notification/factory.notificationWrapper.js */
angular.module("sn.common.notification").factory("snNotificationWrapper", function($window, $timeout) {
"use strict";
function assignHandler(notification, handlerName, options){
if (typeof options[handlerName] === "function")
notification[handlerName.toLowerCase()] = options[handlerName];
}
return function NotificationWrapper(title, options) {
var defaults = {
dir: 'auto',
lang: 'en_US',
decay: true,
lifespan: 4000,
body: "",
tag: "",
icon: '/native_notification_icon.png'
};
var optionsOnClick = options.onClick;
options.onClick = function() {
if(angular.isFunction($window.focus))
$window.focus();
if(typeof optionsOnClick === "function")
optionsOnClick();
}
var result = {};
options = angular.extend(defaults, options);
var previousOnClose = options.onClose;
options.onClose = function() {
if(angular.isFunction(result.onclose))
result.onclose();
if(angular.isFunction(previousOnClose))
previousOnClose();
}
var notification = new $window.Notification(title, options);
assignHandler(notification, "onShow", options);
assignHandler(notification, "onClick", options);
assignHandler(notification, "onError", options);
assignHandler(notification, "onClose", options);
if (options.decay && options.lifespan > 0)
$timeout(function() {
notification.close();
}, options.lifespan)
result.close = function() {
notification.close();
}
return result;
}
})
;
/*! RESOURCE: /scripts/sn/common/notification/service.snNotifier.js */
angular.module("sn.common.notification").factory("snNotifier", function ($window, snNotificationWrapper) {
"use strict";
return function(settings) {
function requestNotificationPermission() {
if($window.Notification && $window.Notification.permission === "default")
$window.Notification.requestPermission();
}
function canUseNativeNotifications() {
return ($window.Notification && $window.Notification.permission === "granted");
}
var currentNotifications = [];
settings = angular.extend({
notifyMethods: ["native", "glide"]
}, settings);
var methods = {
'native': nativeNotify,
'glide': glideNotify
};
function nativeNotify(title, options) {
if(canUseNativeNotifications()) {
var newNotification = snNotificationWrapper(title, options);
newNotification.onclose = function () {
stopTrackingNotification(newNotification)
};
currentNotifications.push(newNotification);
return true;
}
return false;
}
function glideNotify(title, options) {
return false;
}
function stopTrackingNotification(newNotification) {
var index = currentNotifications.indexOf(newNotification);
if(index > -1)
currentNotifications.splice(index, 1);
}
function notify(title, options) {
if(typeof options === "string")
options = {body: options};
options = options || {};
for(var i = 0, len = settings.notifyMethods.length; i < len; i++)
if(typeof settings.notifyMethods[i] == "string") {
if(methods[settings.notifyMethods[i]](title, options))
break;
} else {
if(settings.notifyMethods[i](title, options))
break;
}
}
function clearAllNotifications() {
while(currentNotifications.length > 0)
currentNotifications.pop().close();
}
return {
notify: notify,
canUseNativeNotifications: canUseNativeNotifications,
clearAllNotifications: clearAllNotifications,
requestNotificationPermission: requestNotificationPermission
}
}
});
;
/*! RESOURCE: /scripts/sn/common/notification/directive.snNotification.js */
angular.module('sn.common.notification').directive('snNotification', function($timeout, $rootScope) {
"use strict";
return {
restrict: 'E',
replace: true,
template: '<div class="notification-container"></div>',
link: function(scope, element) {
scope.addNotification = function(payload) {
if (!payload)
payload = {};
if (!payload.text)
payload.text = '';
if (!payload.classes)
payload.classes = '';
if (!payload.duration)
payload.duration = 5000;
angular.element('<div/>').qtip({
content: {
text: payload.text,
title: {
button: false
}
},
position: {
target: [0, 0],
container: angular.element('.notification-container')
},
show: {
event: false,
ready: true,
effect: function () {
angular.element(this).stop(0, 1).animate({ height: 'toggle' }, 400, 'swing');
},
delay: 0,
persistent: false
},
hide: {
event: false,
effect: function (api) {
angular.element(this).stop(0, 1).animate({ height: 'toggle' }, 400, 'swing');
}
},
style: {
classes: 'jgrowl' + ' ' + payload.classes,
tip: false
},
events: {
render: function (event, api) {
if (!api.options.show.persistent) {
angular.element(this).bind('mouseover mouseout', function(e) {
clearTimeout(api.timer);
if (e.type !== 'mouseover') {
api.timer = setTimeout(function() {
api.hide(e);
}, payload.duration);
}
})
.triggerHandler('mouseout');
}
}
}
});
},
scope.$on('notification.notify', function(event, payload) {
scope.addNotification(payload);
});
}
};
});
;
/*! RESOURCE: /scripts/sn/common/notification/service.snNotification.js */
angular.module('sn.common.notification').factory('snNotification', function($document, $templateCache, $compile, $rootScope, $timeout, $q, getTemplateUrl, $http, i18n) {
'use strict';
var openNotifications = [],
timeouts = {},
options = {
top: 20,
gap: 10,
duration: 5000
},
a11yContainer,
a11yDuration = 5000;
return {
show: function(type, message, duration, onClick, container) {
return createNotificationElement(type, message).then(function(element) {
return displayAndDestroyNotification(element, container, duration);
});
},
showScreenReaderOnly: function(type, message, duration, onClick, container) {
return createNotificationElement(type, message, true).then(function(element) {
return displayAndDestroyNotification(element, container, duration);
});
},
hide: hide,
setOptions: function(opts) {
if (angular.isObject(opts))
angular.extend(options, opts);
}
};
function displayAndDestroyNotification(element, container, duration) {
displayNotification(element, container);
checkAndSetDestroyDuration(element, duration);
return element;
}
function getTemplate() {
var templateName = 'sn_notification.xml',
template = $templateCache.get(templateName),
deferred = $q.defer();
if (!template) {
var url = getTemplateUrl(templateName);
$http.get(url).then(function(result) {
$templateCache.put(templateName, result.data);
deferred.resolve(result.data);
},
function(reason) {
return $q.reject(reason);
});
} else
deferred.resolve(template);
return deferred.promise;
}
function createNotificationElement(type, message, screenReaderOnly) {
var thisScope, thisElement;
var icon = 'icon-info';
screenReaderOnly = typeof(screenReaderOnly) === 'undefined' ? false : screenReaderOnly;
if (type == 'error') {
icon = 'icon-cross-circle';
} else if (type == 'warning') {
icon = 'icon-alert';
} else if (type == 'success') {
icon = 'icon-check-circle';
}
return getTemplate().then(function(template) {
thisScope = $rootScope.$new();
thisScope.type = type;
thisScope.message = message;
thisScope.icon = icon;
thisScope.screenReaderOnly = screenReaderOnly;
thisElement = $compile(template)(thisScope);
return angular.element(thisElement[0]);
});
}
function displayNotification(element, container) {
if( !a11yContainer ) {
a11yContainer = angular.element('<div class="notification-a11y-container sr-only" aria-live="assertive">');
$document.find('body').append(a11yContainer);
}
var container = $document.find(container || 'body'),
id = 'elm' + Date.now(),
pos;
container.append(element);
pos = options.top + openNotifications.length * getElementHeight(element);
positionElement(element, pos);
element.addClass('visible');
element.attr('id', id);
element.find('button').bind('click', function(e) {
hideElement(element);
});
openNotifications.push(element);
if (options.duration > 0)
timeouts[id] = $timeout(function () {
hideNext();
}, options.duration);
$timeout(function() {
var srElement = angular.element('<div>').text(element.text());
a11yContainer.append(srElement);
$timeout(function() {
srElement.remove();
}, a11yDuration, false);
}, 0, false)
}
function hide(element) {
$timeout.cancel(timeouts[element.attr('id')]);
element.removeClass('visible');
element.addClass('hidden');
element.find('button').eq(0).unbind();
element.scope().$destroy();
element.remove();
repositionAll();
}
function hideElement(element) {
var index = openNotifications.indexOf(element);
openNotifications.splice(index, 1);
hide(element);
}
function hideNext() {
var element = openNotifications.shift();
if (element)
hide(element);
}
function getElementHeight(element) {
return element[0].offsetHeight + options.gap;
}
function positionElement(element, pos) {
element[0].style.top = pos + 'px';
}
function repositionAll() {
var pos = options.top;
openNotifications.forEach(function(element) {
positionElement(element, pos);
pos += getElementHeight(element);
});
}
function checkAndSetDestroyDuration(element, duration){
if (duration){
timeouts[element.attr('id')] = $timeout(function(){
hideElement(element);
}, duration);
}
}
});
;
;
/*! RESOURCE: /scripts/sn/common/util/js_includes_util.js */
/*! RESOURCE: /scripts/thirdparty/autosizer/autosizer.min.js */
/*!
 Autosize 4.0.0
 license: MIT
 http://www.jacklmoore.com/autosize
 */
!function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),s="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(s)&&(s=0),l()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){var t=e.style.height,n=o(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="";var i=e.scrollHeight+s;return 0===e.scrollHeight?void(e.style.height=t):(e.style.height=i+"px",u=e.clientWidth,n.forEach(function(e){e.node.scrollTop=e.scrollTop}),void(r&&(document.documentElement.scrollTop=r)))}function l(){r();var t=Math.round(parseFloat(e.style.height)),o=window.getComputedStyle(e,null),i="content-box"===o.boxSizing?Math.round(parseFloat(o.height)):e.offsetHeight;if(i!==t?"hidden"===o.overflowY&&(n("scroll"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==o.overflowY&&(n("hidden"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),a!==i){a=i;var l=d("autosize:resized");try{e.dispatchEvent(l)}catch(e){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var s=null,u=e.clientWidth,a=null,c=function(){e.clientWidth!==u&&l()},p=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",l,!1),e.removeEventListener("keyup",l,!1),e.removeEventListener("autosize:destroy",p,!1),e.removeEventListener("autosize:update",l,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n]}),i.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",p,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",l,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",l,!1),e.addEventListener("autosize:update",l,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:p,update:l}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:function(){var e=[],t=[];return{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){e.indexOf(n)===-1&&(e.push(n),t.push(o))},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1))}}}(),d=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){d=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(l=function(e){return e},l.destroy=function(e){return e},l.update=function(e){return e}):(l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},l.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.exports=l});
/*! RESOURCE: /scripts/sn/common/util/_module.js */
angular.module('sn.common.util', ['sn.common.auth']);
angular.module('sn.util', ['sn.common.util']);
;
/*! RESOURCE: /scripts/sn/common/util/factory.escapeHtml.js */
angular.module('sn.common.util').factory('escapeHtml', function() {
return function(value) {
if (typeof value !== 'string') {
return '';
}
return value
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/'/g, '&#39;')
.replace(/"/g, '&quot;')
.replace(/\//g, '&#x2F;');
};
});
;
/*! RESOURCE: /scripts/sn/common/util/service.dateUtils.js */
angular.module('sn.common.util').factory('dateUtils', function(){
var dateUtils = {
SYS_DATE_FORMAT: "yyyy-MM-dd",
SYS_TIME_FORMAT: "HH:mm:ss",
SYS_DATE_TIME_FORMAT: "yyyy-MM-dd HH:mm:ss",
MONTH_NAMES: new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),
DAY_NAMES: new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat'),
LZ: function (x) {return(x<0||x>9?"":"0")+x},
isDate: function (val,format) {
var date=this.getDateFromFormat(val,format);
if (date==0) { return false; }
return true;
},
compareDates: function (date1,dateformat1,date2,dateformat2) {
var d1=this.getDateFromFormat(date1,dateformat1);
var d2=this.getDateFromFormat(date2,dateformat2);
if (d1==0 || d2==0) {
return -1;
}
else if (d1 > d2) {
return 1;
}
return 0;
},
formatDateServer: function(date, format) {
var ga = new GlideAjax("DateTimeUtils");
ga.addParam("sysparm_name", "formatCalendarDate");
var browserOffset = date.getTimezoneOffset() * 60000;
var utcTime = date.getTime() - browserOffset;
var userDateTime = utcTime - g_tz_offset;
ga.addParam("sysparm_value", userDateTime);
ga.getXMLWait();
return ga.getAnswer();
},
formatDate: function(date,format) {
if (format.indexOf("z") > 0)
return this.formatDateServer(date, format);
format=format+"";
var result="";
var i_format=0;
var c="";
var token="";
var y=date.getYear()+"";
var M=date.getMonth()+1;
var d=date.getDate();
var E=date.getDay();
var H=date.getHours();
var m=date.getMinutes();
var s=date.getSeconds();
var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
var value=new Object();
value["M"]=M;
value["MM"]=this.LZ(M);
value["MMM"]=this.MONTH_NAMES[M+11];
value["NNN"]=this.MONTH_NAMES[M+11];
value["MMMM"]=this.MONTH_NAMES[M-1];
value["d"]=d;
value["dd"]=this.LZ(d);
value["E"]=this.DAY_NAMES[E+7];
value["EE"]=this.DAY_NAMES[E];
value["H"]=H;
value["HH"]=this.LZ(H);
if (format.indexOf('w') != -1) {
var wk = date.getWeek();
if (wk >= 52 && M == 1) {
y = date.getYear();
y--;
y = y + "";
}
if (wk == 1 && M == 12) {
y = date.getYear();
y++;
y = y + "";
}
value["w"] = wk;
value["ww"] = this.LZ(wk);
}
var dayOfWeek = (7 + (E + 1) - (g_first_day_of_week - 1)) % 7;
if (dayOfWeek == 0)
dayOfWeek = 7;
value["D"] = dayOfWeek;
if (y.length < 4) {
y=""+(y-0+1900);
}
value["y"]=""+y;
value["yyyy"]=y;
value["yy"]=y.substring(2,4);
if (H==0) {
value["h"]=12;
} else if (H>12){
value["h"]=H-12;
} else {
value["h"]=H;
}
value["hh"]=this.LZ(value["h"]);
if (H>11) {
value["K"]=H-12;
} else {
value["K"]=H;
}
value["k"]=H+1;
value["KK"]=this.LZ(value["K"]);
value["kk"]=this.LZ(value["k"]);
if (H > 11) {
value["a"]="PM";
} else {
value["a"]="AM";
}
value["m"]=m;
value["mm"]=this.LZ(m);
value["s"]=s;
value["ss"]=this.LZ(s);
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (value[token] != null) { result=result + value[token]; }
else { result=result + token; }
}
return result;
},
_isInteger: function (val) {
var digits="1234567890";
for (var i=0; i < val.length; i++) {
if (digits.indexOf(val.charAt(i))==-1) { return false; }
}
return true;
},
_getInt: function (str,i,minlength,maxlength) {
for (var x=maxlength; x>=minlength; x--) {
var token=str.substring(i,i+x);
if (token.length < minlength) { return null; }
if (this._isInteger(token)) { return token; }
}
return null;
},
getDateFromFormat: function (val,format) {
val=val+"";
format=format+"";
var i_val=0;
var i_format=0;
var c="";
var token="";
var token2="";
var x,y;
var now=new Date();
var year=now.getYear();
var month=now.getMonth()+1;
var date=0;
var hh=now.getHours();
var mm=now.getMinutes();
var ss=now.getSeconds();
var ampm="";
var week = false;
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (token=="yyyy" || token=="yy" || token=="y") {
if (token=="yyyy") { x=4;y=4; }
if (token=="yy")   { x=2;y=2; }
if (token=="y")    { x=2;y=4; }
year=this._getInt(val,i_val,x,y);
if (year==null) { return 0; }
i_val += year.length;
if (year.length==2) {
if (year > 70) { year=1900+(year-0); }
else { year=2000+(year-0); }
}
}
else if (token=="MMM"||token=="NNN"){
month=0;
for (var i=0; i<this.MONTH_NAMES.length; i++) {
var month_name=this.MONTH_NAMES[i];
if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
if (token=="MMM"||(token=="NNN"&&i>11)) {
month=i+1;
if (month>12) { month -= 12; }
i_val += month_name.length;
break;
}
}
}
if ((month < 1)||(month>12)){return 0;}
}
else if (token=="EE"||token=="E") {
for (var i=0; i<this.DAY_NAMES.length; i++) {
var day_name=this.DAY_NAMES[i];
if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
if (week) {
if (i==0 || i == 7)
date+=6;
else if (i== 2 || i == 9)
date+=1;
else if (i== 3 || i == 10)
date+=2;
else if (i == 4 || i == 11)
date+=3;
else if (i == 5 || i == 12)
date +=4;
else if (i == 6 || i== 13)
date+=5;
}
i_val += day_name.length;
break;
}
}
}
else if (token=="MM"||token=="M") {
month=this._getInt(val,i_val,token.length,2);
if(month==null||(month<1)||(month>12)){return 0;}
i_val+=month.length;}
else if (token=="dd"||token=="d") {
date=this._getInt(val,i_val,token.length,2);
if(date==null||(date<1)||(date>31)){return 0;}
i_val+=date.length;}
else if (token=="hh"||token=="h") {
hh=this._getInt(val,i_val,token.length,2);
if(hh==null||(hh<1)||(hh>12)){return 0;}
i_val+=hh.length;}
else if (token=="HH"||token=="H") {
hh=this._getInt(val,i_val,token.length,2);
if(hh==null||(hh<0)||(hh>23)){return 0;}
i_val+=hh.length;}
else if (token=="KK"||token=="K") {
hh=this._getInt(val,i_val,token.length,2);
if(hh==null||(hh<0)||(hh>11)){return 0;}
i_val+=hh.length;}
else if (token=="kk"||token=="k") {
hh=this._getInt(val,i_val,token.length,2);
if(hh==null||(hh<1)||(hh>24)){return 0;}
i_val+=hh.length;hh--;}
else if (token=="mm"||token=="m") {
mm=this._getInt(val,i_val,token.length,2);
if(mm==null||(mm<0)||(mm>59)){return 0;}
i_val+=mm.length;}
else if (token=="ss"||token=="s") {
ss=this._getInt(val,i_val,token.length,2);
if(ss==null||(ss<0)||(ss>59)){return 0;}
i_val+=ss.length;}
else if (token=="a") {
if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";}
else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";}
else {return 0;}
i_val+=2;}
else if (token == "w" || token == "ww") {
var weekNum = this._getInt(val,i_val,token.length, 2);
week = true;
if (weekNum != null) {
var temp = new Date(year, 0, 1, 0, 0, 0);
temp.setWeek(parseInt(weekNum, 10));
year = temp.getFullYear();
month = temp.getMonth()+1;
date = temp.getDate();
}
weekNum += "";
i_val += weekNum.length;
}
else if (token=="D") {
if (week) {
var day = this._getInt(val,i_val,token.length, 1);
if ((day == null) || (day <= 0) || (day > 7))
return 0;
var temp = new Date(year, month-1, date, hh, mm, ss);
var dayOfWeek = temp.getDay();
day = parseInt(day, 10);
day = (day + g_first_day_of_week - 1) % 7;
if (day == 0)
day = 7;
day--;
if (day < dayOfWeek)
day = 7 - (dayOfWeek - day);
else
day -= dayOfWeek;
if (day > 0) {
temp.setDate(temp.getDate() + day);
year = temp.getFullYear();
month = temp.getMonth() + 1;
date = temp.getDate();
}
i_val++;
}
} else if (token =="z")
i_val+=3;
else {
if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
else {i_val+=token.length;}
}
}
if (i_val != val.length) { return 0; }
if (month==2) {
if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) {
if (date > 29){ return 0; }
}
else { if (date > 28) { return 0; } }
}
if ((month==4)||(month==6)||(month==9)||(month==11)) {
if (date > 30) { return 0; }
}
if (hh<12 && ampm=="PM") { hh=hh-0+12; }
else if (hh>11 && ampm=="AM") { hh-=12; }
var newdate=new Date(year,month-1,date,hh,mm,ss);
return newdate.getTime();
},
parseDate: function (val) {
var preferEuro=(arguments.length==2)?arguments[1]:false;
generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');
monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');
dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');
yearFirst =new Array( 'yyyyw.F', 'yyw.F');
var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst', 'yearFirst');
var d=null;
for (var i=0; i<checkList.length; i++) {
var l=window[checkList[i]];
for (var j=0; j<l.length; j++) {
d=this.getDateFromFormat(val,l[j]);
if (d!=0) { return new Date(d); }
}
}
return null;
}
};
Date.prototype.getWeek = function() {
var newYear = new Date(this.getFullYear(),0,1);
var day = newYear.getDay() - (g_first_day_of_week - 1);
day = (day >= 0 ? day : day + 7);
var dayNum = Math.floor((this.getTime() - newYear.getTime() - (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
var weekNum;
if (day < 4) {
weekNum = Math.floor((dayNum+day-1)/7) +1;
if (weekNum > 52)
weekNum = this._checkNextYear(weekNum);
return weekNum;
}
weekNum = Math.floor((dayNum+day-1)/7);
if (weekNum < 1)
weekNum = this._lastWeekOfYear();
else if (weekNum > 52)
weekNum = this._checkNextYear(weekNum);
return weekNum;
};
Date.prototype._lastWeekOfYear = function() {
var newYear = new Date(this.getFullYear() - 1,0,1);
var endOfYear = new Date(this.getFullYear() - 1,11,31);
var day = newYear.getDay() - (g_first_day_of_week - 1);
var dayNum = Math.floor((endOfYear.getTime() - newYear.getTime() - (endOfYear.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
return day < 4 ? Math.floor((dayNum+day-1)/7) + 1 : Math.floor((dayNum+day-1)/7);
};
Date.prototype._checkNextYear = function() {
var nYear = new Date(this.getFullYear() + 1,0,1);
var nDay = nYear.getDay() - (g_first_day_of_week-1);
nDay = nDay >= 0 ? nDay : nDay + 7;
return nDay < 4 ? 1 : 53;
};
Date.prototype.setWeek = function(weekNum) {
weekNum--;
var startOfYear = new Date(this.getFullYear(), 0, 1);
var day = startOfYear.getDay() - (g_first_day_of_week - 1);
if (day > 0 && day < 4) {
this.setFullYear(startOfYear.getFullYear() - 1);
this.setDate(31 - day + 1);
this.setMonth(11);
} else if (day > 3)
this.setDate(startOfYear.getDate() + (7-day));
this.setDate(this.getDate() + (7 * weekNum));
};
return dateUtils;
})
;
/*! RESOURCE: /scripts/sn/common/util/service.debounceFn.js */
angular.module("sn.common.util").service("debounceFn", function () {
"use strict";
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
return {
debounce: debounce
}
});
;
/*! RESOURCE: /scripts/sn/common/util/factory.unwrappedHTTPPromise.js */
angular.module('sn.common.util').factory("unwrappedHTTPPromise", function ($q) {
"use strict";
function isGenericPromise(promise){
return (typeof promise.then === "function" &&
promise.success === undefined &&
promise.error === undefined);
}
return function(httpPromise){
if(isGenericPromise(httpPromise))
return httpPromise;
var deferred = $q.defer();
httpPromise.success(function(data){
deferred.resolve(data);
}).error(function(data, status){
deferred.reject({
data: data,
status: status
})
});
return deferred.promise;
};
});
;
/*! RESOURCE: /scripts/sn/common/util/service.urlTools.js */
angular.module('sn.common.util').constant('angularProcessorUrl', 'angular.do?sysparm_type=');
angular.module('sn.common.util').factory("urlTools", function(getTemplateUrl, angularProcessorUrl) {
"use strict";
function getPartialURL(name, parameters) {
var url = getTemplateUrl(name);
if (parameters) {
if (typeof parameters !== 'string') {
parameters = encodeURIParameters(parameters);
}
if (parameters.length) {
url += "&" + parameters;
}
}
if (window.NOW && window.NOW.ng_cache_defeat)
url += "&t=" + new Date().getTime();
return url;
}
function getURL(name, parameters) {
if (parameters && typeof parameters === 'object')
return urlFor(name, parameters);
var url = angularProcessorUrl;
url += name;
if (parameters)
url += "&" + parameters;
return url;
}
function urlFor(route, parameters) {
var p = encodeURIParameters(parameters);
return angularProcessorUrl + route + (p.length ? '&' + p : '');
}
function getPropertyURL(name) {
var url = angularProcessorUrl + "get_property&name=" + name;
url += "&t=" + new Date().getTime();
return url;
}
function encodeURIParameters(parameters) {
var s = [];
for (var parameter in parameters) {
if (parameters.hasOwnProperty(parameter)) {
var key = encodeURIComponent(parameter);
var value = parameters[parameter] ? encodeURIComponent(parameters[parameter]) : '';
s.push(key + "=" + value);
}
}
return s.join('&');
}
function parseQueryString(qs) {
qs = qs || '';
if (qs.charAt(0) === '?') {
qs = qs.substr(1);
}
var a = qs.split('&');
if (a === "") {
return {};
}
if(a && a[0].indexOf('http') != -1)
a[0] = a[0].split("?")[1];
var b = {};
for (var i = 0; i < a.length; i++) {
var p = a[i].split('=', 2);
if (p.length == 1) {
b[p[0]] = "";
} else {
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
}
return b;
}
var urlPattern = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)/;
var hostnameGroupIndex = 4;
function isUrlExternal(url) {
var matchResult = url.match(urlPattern);
if (matchResult && matchResult[hostnameGroupIndex] && matchResult[hostnameGroupIndex].length > 0)
return true;
return false;
}
return {
getPartialURL: getPartialURL,
getURL: getURL,
urlFor: urlFor,
getPropertyURL: getPropertyURL,
encodeURIParameters: encodeURIParameters,
parseQueryString: parseQueryString,
isUrlExternal: isUrlExternal
};
});
;
/*! RESOURCE: /scripts/sn/common/util/service.getTemplateUrl.js */
angular.module('sn.common.util').provider('getTemplateUrl', function(angularProcessorUrl) {
'use strict';
var _handlerId = 0;
var _handlers = {};
this.registerHandler = function(handler) {
var registeredId = _handlerId;
_handlers[_handlerId] = handler;
_handlerId++;
return function() {
delete _handlers[registeredId];
};
};
this.$get = function() {
return getTemplateUrl;
};
function getTemplateUrl(templatePath) {
if (_handlerId > 0) {
var path;
var handled = false;
angular.forEach(_handlers, function(handler) {
if (!handled) {
var handlerPath = handler(templatePath);
if (typeof handlerPath !== 'undefined') {
path = handlerPath;
handled = true;
}
}
});
if (handled) {
return path;
}
}
return angularProcessorUrl + 'get_partial&name=' + templatePath;
}
});
;
/*! RESOURCE: /scripts/sn/common/util/service.snTabActivity.js */
angular.module("sn.common.util").service("snTabActivity", function ($window, $timeout, $rootElement, $document) {
"use strict";
var activeEvents = ["keydown", "DOMMouseScroll", "mousewheel", "mousedown", "touchstart", "mousemove", "mouseenter", "input", "focus", "scroll"],
defaultIdle = 75000,
isPrimary = true,
idleTime = 0,
isVisible = true,
idleTimeout = void(0),
pageIdleTimeout = void(0),
hasActed = false,
appName = $rootElement.attr('ng-app') || "",
storageKey = "sn.tabs." + appName + ".activeTab";
var callbacks = {
"tab.primary": [],
"tab.secondary": [],
"activity.active": [],
"activity.idle": [{delay: defaultIdle, cb: function(){}}]
};
$window.tabGUID = $window.tabGUID || createGUID();
function getActiveEvents() {
return activeEvents.join(".snTabActivity ") + ".snTabActivity";
}
function setAppName (an) {
appName = an;
storageKey = "sn.tabs." + appName + ".activeTab";
makePrimary(true);
}
function createGUID(l) {
l = l || 32;
var strResult = '';
while (strResult.length < l)
strResult += (((1+Math.random()+new Date().getTime())*0x10000)|0).toString(16).substring(1);
return strResult.substr(0, l);
}
function ngObjectIndexOf(arr, obj) {
for (var i = 0, len = arr.length; i < len; i++)
if (angular.equals(arr[i], obj))
return i;
return -1;
}
var detectedApi,
apis = [{
eventName: 'visibilitychange',
propertyName: 'hidden'
},{
eventName: 'mozvisibilitychange',
propertyName: 'mozHidden'
},{
eventName: 'msvisibilitychange',
propertyName: 'msHidden'
},{
eventName: 'webkitvisibilitychange',
propertyName: 'webkitHidden'
}];
apis.some(function(api) {
if (angular.isDefined($document[0][api.propertyName])) {
detectedApi = api;
return true;
}
});
if(detectedApi)
$document.on(detectedApi.eventName, function() {
if(!$document[0][detectedApi.propertyName]) {
makePrimary();
isVisible = true;
} else {
if(!idleTimeout && !idleTime)
waitForIdle(0);
isVisible = false;
}
});
angular.element($window).on({
"mouseleave": function(e) {
var destination = angular.isUndefined(e.toElement) ? e.relatedTarget : e.toElement;
if (destination === null && $document[0].hasFocus()) {
waitForIdle(0);
}
},
"blur": function(e) {
makePrimary(true);
isVisible = false;
resetIdleTime();
},
"storage": function(e) {
if(e.originalEvent.key !== storageKey)
return;
if($window.localStorage.getItem(storageKey) !== $window.tabGUID)
makeSecondary();
}
});
function waitForIdle(index, delayOffset) {
var callback = callbacks['activity.idle'][index];
var numCallbacks = callbacks['activity.idle'].length;
delayOffset = delayOffset || callback.delay;
angular.element($window).off(getActiveEvents());
angular.element($window).one(getActiveEvents(), setActive);
if(index >= numCallbacks)
return;
if(idleTimeout)
$timeout.cancel(idleTimeout);
idleTimeout = $timeout(function() {
idleTime = callback.delay;
callback.cb();
$timeout.cancel(idleTimeout);
idleTimeout = void(0);
angular.element($window).off(getActiveEvents());
angular.element($window).one(getActiveEvents(), setActive);
for( var i = index + 1; i < numCallbacks; i++ ) {
var nextDelay = callbacks['activity.idle'][i].delay;
if(nextDelay <= callback.delay)
callbacks['activity.idle'][i].cb();
else {
waitForIdle(i, nextDelay - callback.delay);
break;
}
}
}, delayOffset, false);
}
function setActive() {
angular.element($window).off(getActiveEvents());
if(idleTimeout) {
$timeout.cancel(idleTimeout);
idleTimeout = void(0);
}
var activeCallbacks =  callbacks['activity.active'];
activeCallbacks.some(function(callback) {
if(callback.delay <= idleTime)
callback.cb();
else
return true;
});
idleTime = 0;
makePrimary();
if(pageIdleTimeout) {
$timeout.cancel(pageIdleTimeout);
pageIdleTimeout = void(0);
}
var minDelay = callbacks['activity.idle'][0].delay;
hasActed = false;
if(!pageIdleTimeout)
pageIdleTimeout = $timeout(pageIdleHandler, minDelay, false);
listenForActivity();
}
function pageIdleHandler() {
if(idleTimeout)
return;
var minDelay = callbacks['activity.idle'][0].delay;
if(hasActed) {
hasActed = false;
if(pageIdleTimeout)
$timeout.cancel(pageIdleTimeout);
pageIdleTimeout = $timeout(pageIdleHandler, minDelay, false);
listenForActivity();
return;
}
var delayOffset = minDelay;
if(callbacks['activity.idle'].length > 1)
delayOffset = callbacks['activity.idle'][1].delay - minDelay;
idleTime = minDelay;
callbacks['activity.idle'][0].cb();
waitForIdle(1, delayOffset);
pageIdleTimeout = void(0);
}
function listenForActivity() {
angular.element($window).off(getActiveEvents());
angular.element($window).one(getActiveEvents(), onActivity);
angular.element("#gsft_main").on("load.snTabActivity", function() {
var src = angular.element(this).attr('src');
if(src.indexOf("/") == 0 || src.indexOf($window.location.origin) == 0 || src.indexOf('http') == -1) {
var iframeWindow = this.contentWindow ? this.contentWindow : this.contentDocument.defaultView;
angular.element(iframeWindow).off(getActiveEvents());
angular.element(iframeWindow).one(getActiveEvents(), onActivity);
}
});
angular.element('iframe').each(function(idx, iframe) {
var src = angular.element(iframe).attr('src');
if (!src)
return;
if(src.indexOf("/") == 0 || src.indexOf($window.location.origin) == 0 || src.indexOf('http') == -1) {
var iframeWindow = iframe.contentWindow ? iframe.contentWindow : iframe.contentDocument.defaultView;
try {
angular.element(iframeWindow).off(getActiveEvents());
angular.element(iframeWindow).one(getActiveEvents(), onActivity);
} catch(e) {
return;
}
}
});
}
function onActivity() {
hasActed = true;
makePrimary();
}
function makePrimary(initial) {
var oldGuid = $window.localStorage.getItem(storageKey);
isPrimary = true;
isVisible = true;
$timeout.cancel(idleTimeout);
idleTimeout = void(0);
if(canUseStorage() && oldGuid !== $window.tabGUID && !initial)
for(var i = 0, len = callbacks["tab.primary"].length; i < len; i++)
callbacks["tab.primary"][i].cb();
try {
$window.localStorage.setItem(storageKey, $window.tabGUID);
} catch (ignored) {
}
if(idleTime && $document[0].hasFocus())
setActive();
}
function makeSecondary() {
isPrimary = false;
isVisible = false;
for(var i = 0, len = callbacks["tab.secondary"].length; i < len; i++)
callbacks["tab.secondary"][i].cb();
}
function registerCallback(event, callback, scope) {
var cbObject = angular.isObject(callback) ? callback : {delay: defaultIdle, cb: callback};
if(callbacks[event]) {
callbacks[event].push(cbObject);
callbacks[event].sort(function(a, b) {
return a.delay - b.delay;
})
}
function destroyCallback() {
if (callbacks[event]) {
var pos = ngObjectIndexOf(callbacks[event], cbObject);
if (pos !== -1)
callbacks[event].splice(pos, 1);
}
}
if(scope)
scope.$on("$destroy", function() {
destroyCallback();
});
return destroyCallback;
}
function registerIdleCallback(options, onIdle, onReturn, scope) {
var delay = options,
onIdleDestroy,
onReturnDestroy;
if(angular.isObject(options)) {
delay = options.delay;
onIdle = options.onIdle || onIdle;
onReturn = options.onReturn || onReturn;
scope = options.scope || scope;
}
if(angular.isFunction(onIdle))
onIdleDestroy = registerCallback("activity.idle", {delay: delay, cb: onIdle});
else if (angular.isFunction(onReturn)) {
onIdleDestroy = registerCallback("activity.idle", {delay: delay, cb: function(){}});
}
if(angular.isFunction(onReturn))
onReturnDestroy = registerCallback("activity.active", {delay: delay, cb: onReturn});
function destroyAll() {
if(angular.isFunction(onIdleDestroy))
onIdleDestroy();
if(angular.isFunction(onReturnDestroy))
onReturnDestroy();
}
if(scope)
scope.$on("$destroy", function() {
destroyAll();
});
return destroyAll;
}
function canUseStorage() {
var canWe = false;
try {
$window.localStorage.setItem(storageKey, $window.tabGUID);
canWe = true;
} catch (ignored) {
}
return canWe;
}
function resetIdleTime() {
if(idleTime > 0) {
idleTime = 0;
if(pageIdleTimeout) {
$timeout.cancel(pageIdleTimeout);
pageIdleTimeout = void(0);
}
}
waitForIdle(0);
}
makePrimary(true);
listenForActivity();
pageIdleTimeout = $timeout(pageIdleHandler, defaultIdle, false);
return {
on: registerCallback,
onIdle: registerIdleCallback,
setAppName: setAppName,
get isPrimary() { return isPrimary; },
get isIdle() { return idleTime > 0; },
get idleTime() { return idleTime; },
get isVisible() { return isVisible; },
get appName() { return appName; },
get defaultIdleTime() { return defaultIdle },
isActive: function() {
return this.idleTime < this.defaultIdleTime && this.isVisible;
},
resetIdleTime: resetIdleTime
}
});
;
/*! RESOURCE: /scripts/sn/common/util/factory.ArraySynchronizer.js */
angular.module("sn.common.util").factory("ArraySynchronizer", function() {
'use strict';
function ArraySynchronizer(){}
function index(key, arr) {
var result = {};
var keys = [];
result.orderedKeys = keys;
angular.forEach(arr, function(item) {
var keyValue = item[key];
result[keyValue] = item;
keys.push(keyValue);
});
return result;
}
function sortByKeyAndModel(arr, key, model) {
arr.sort(function(a, b) {
var aIndex = model.indexOf(a[key]);
var bIndex = model.indexOf(b[key]);
if(aIndex > bIndex)
return 1;
else if (aIndex < bIndex)
return -1;
return 0;
});
}
ArraySynchronizer.prototype = {
add: function(syncField, dest, source, end) {
end = end || "bottom";
var destIndex = index(syncField, dest);
var sourceIndex = index(syncField, source);
angular.forEach(sourceIndex.orderedKeys, function(key) {
if(destIndex.orderedKeys.indexOf(key) === -1) {
if(end === "bottom") {
dest.push(sourceIndex[key]);
} else {
dest.unshift(sourceIndex[key]);
}
}
});
},
synchronize: function(syncField, dest, source, deepKeySyncArray) {
var destIndex = index(syncField, dest);
var sourceIndex = index(syncField, source);
deepKeySyncArray = (typeof deepKeySyncArray === "undefined") ? [] : deepKeySyncArray;
for(var i = destIndex.orderedKeys.length - 1; i >= 0; i--) {
var key = destIndex.orderedKeys[i];
if(sourceIndex.orderedKeys.indexOf(key) === -1) {
destIndex.orderedKeys.splice(i, 1);
dest.splice(i, 1);
}
if (deepKeySyncArray.length > 0) {
angular.forEach(deepKeySyncArray, function(deepKey) {
if (sourceIndex[key] && destIndex[key][deepKey] !== sourceIndex[key][deepKey]) {
destIndex[key][deepKey] = sourceIndex[key][deepKey];
}
});
}
}
angular.forEach(sourceIndex.orderedKeys, function(key) {
if(destIndex.orderedKeys.indexOf(key) === -1)
dest.push(sourceIndex[key]);
});
sortByKeyAndModel(dest, syncField, sourceIndex.orderedKeys);
}
};
return ArraySynchronizer;
});
;
/*! RESOURCE: /scripts/sn/common/util/directive.snBindOnce.js */
angular.module("sn.common.util").directive("snBindOnce", function($sanitize) {
"use strict";
return {
restrict: "A",
link: function(scope, element, attrs) {
var value = scope.$eval(attrs.snBindOnce);
var sanitizedValue = $sanitize(value);
element.append(sanitizedValue);
}
}
})
;
/*! RESOURCE: /scripts/sn/common/util/directive.snCloak.js */
angular.module("sn.common.util").directive("snCloak", function() {
"use strict";
return {
restrict: "A",
compile: function(element, attr) {
return function() {
attr.$set('snCloak', undefined);
element.removeClass('sn-cloak');
}
}
};
})
;
/*! RESOURCE: /scripts/sn/common/util/service.md5.js */
angular.module('sn.common.util').factory('md5', function() {
'use strict';
var md5cycle = function(x, k) {
var a = x[0], b = x[1], c = x[2], d = x[3];
a = ff(a, b, c, d, k[0], 7, -680876936);
d = ff(d, a, b, c, k[1], 12, -389564586);
c = ff(c, d, a, b, k[2], 17,  606105819);
b = ff(b, c, d, a, k[3], 22, -1044525330);
a = ff(a, b, c, d, k[4], 7, -176418897);
d = ff(d, a, b, c, k[5], 12,  1200080426);
c = ff(c, d, a, b, k[6], 17, -1473231341);
b = ff(b, c, d, a, k[7], 22, -45705983);
a = ff(a, b, c, d, k[8], 7,  1770035416);
d = ff(d, a, b, c, k[9], 12, -1958414417);
c = ff(c, d, a, b, k[10], 17, -42063);
b = ff(b, c, d, a, k[11], 22, -1990404162);
a = ff(a, b, c, d, k[12], 7,  1804603682);
d = ff(d, a, b, c, k[13], 12, -40341101);
c = ff(c, d, a, b, k[14], 17, -1502002290);
b = ff(b, c, d, a, k[15], 22,  1236535329);
a = gg(a, b, c, d, k[1], 5, -165796510);
d = gg(d, a, b, c, k[6], 9, -1069501632);
c = gg(c, d, a, b, k[11], 14,  643717713);
b = gg(b, c, d, a, k[0], 20, -373897302);
a = gg(a, b, c, d, k[5], 5, -701558691);
d = gg(d, a, b, c, k[10], 9,  38016083);
c = gg(c, d, a, b, k[15], 14, -660478335);
b = gg(b, c, d, a, k[4], 20, -405537848);
a = gg(a, b, c, d, k[9], 5,  568446438);
d = gg(d, a, b, c, k[14], 9, -1019803690);
c = gg(c, d, a, b, k[3], 14, -187363961);
b = gg(b, c, d, a, k[8], 20,  1163531501);
a = gg(a, b, c, d, k[13], 5, -1444681467);
d = gg(d, a, b, c, k[2], 9, -51403784);
c = gg(c, d, a, b, k[7], 14,  1735328473);
b = gg(b, c, d, a, k[12], 20, -1926607734);
a = hh(a, b, c, d, k[5], 4, -378558);
d = hh(d, a, b, c, k[8], 11, -2022574463);
c = hh(c, d, a, b, k[11], 16,  1839030562);
b = hh(b, c, d, a, k[14], 23, -35309556);
a = hh(a, b, c, d, k[1], 4, -1530992060);
d = hh(d, a, b, c, k[4], 11,  1272893353);
c = hh(c, d, a, b, k[7], 16, -155497632);
b = hh(b, c, d, a, k[10], 23, -1094730640);
a = hh(a, b, c, d, k[13], 4,  681279174);
d = hh(d, a, b, c, k[0], 11, -358537222);
c = hh(c, d, a, b, k[3], 16, -722521979);
b = hh(b, c, d, a, k[6], 23,  76029189);
a = hh(a, b, c, d, k[9], 4, -640364487);
d = hh(d, a, b, c, k[12], 11, -421815835);
c = hh(c, d, a, b, k[15], 16,  530742520);
b = hh(b, c, d, a, k[2], 23, -995338651);
a = ii(a, b, c, d, k[0], 6, -198630844);
d = ii(d, a, b, c, k[7], 10,  1126891415);
c = ii(c, d, a, b, k[14], 15, -1416354905);
b = ii(b, c, d, a, k[5], 21, -57434055);
a = ii(a, b, c, d, k[12], 6,  1700485571);
d = ii(d, a, b, c, k[3], 10, -1894986606);
c = ii(c, d, a, b, k[10], 15, -1051523);
b = ii(b, c, d, a, k[1], 21, -2054922799);
a = ii(a, b, c, d, k[8], 6,  1873313359);
d = ii(d, a, b, c, k[15], 10, -30611744);
c = ii(c, d, a, b, k[6], 15, -1560198380);
b = ii(b, c, d, a, k[13], 21,  1309151649);
a = ii(a, b, c, d, k[4], 6, -145523070);
d = ii(d, a, b, c, k[11], 10, -1120210379);
c = ii(c, d, a, b, k[2], 15,  718787259);
b = ii(b, c, d, a, k[9], 21, -343485551);
x[0] = add32(a, x[0]);
x[1] = add32(b, x[1]);
x[2] = add32(c, x[2]);
x[3] = add32(d, x[3]);
};
var cmn = function(q, a, b, x, s, t) {
a = add32(add32(a, q), add32(x, t));
return add32((a << s) | (a >>> (32 - s)), b);
};
var ff = function(a, b, c, d, x, s, t) {
return cmn((b & c) | ((~b) & d), a, b, x, s, t);
};
var gg = function(a, b, c, d, x, s, t) {
return cmn((b & d) | (c & (~d)), a, b, x, s, t);
};
var hh = function(a, b, c, d, x, s, t) {
return cmn(b ^ c ^ d, a, b, x, s, t);
};
var ii = function(a, b, c, d, x, s, t) {
return cmn(c ^ (b | (~d)), a, b, x, s, t);
};
var md51 = function(s) {
var txt = '';
var n = s.length,
state = [1732584193, -271733879, -1732584194, 271733878], i;
for (i=64; i<=s.length; i+=64) {
md5cycle(state, md5blk(s.substring(i-64, i)));
}
s = s.substring(i-64);
var tail = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
for (i=0; i<s.length; i++)
tail[i>>2] |= s.charCodeAt(i) << ((i%4) << 3);
tail[i>>2] |= 0x80 << ((i%4) << 3);
if (i > 55) {
md5cycle(state, tail);
for (i=0; i<16; i++) tail[i] = 0;
}
tail[14] = n*8;
md5cycle(state, tail);
return state;
};
var md5blk = function(s) {
var md5blks = [], i;
for (i=0; i<64; i+=4) {
md5blks[i>>2] = s.charCodeAt(i)
+ (s.charCodeAt(i+1) << 8)
+ (s.charCodeAt(i+2) << 16)
+ (s.charCodeAt(i+3) << 24);
}
return md5blks;
};
var hex_chr = '0123456789abcdef'.split('');
var rhex = function(n) {
var s='', j=0;
for(; j<4; j++)
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F]
+ hex_chr[(n >> (j * 8)) & 0x0F];
return s;
};
var hex = function(x) {
for (var i=0; i<x.length; i++)
x[i] = rhex(x[i]);
return x.join('');
};
var add32 = function(a, b) {
return (a + b) & 0xFFFFFFFF;
};
return function(s) {
return hex(md51(s));
};
});
;
/*! RESOURCE: /scripts/sn/common/util/service.priorityQueue.js */
angular.module('sn.common.util').factory('priorityQueue', function() {
'use strict';
return function(comparator) {
var items = [];
var compare = comparator || function(a, b) {
return a - b;
};
var swap = function(a, b) {
var temp = items[a];
items[a] = items[b];
items[b] = temp;
};
var bubbleUp = function(pos) {
var parent;
while (pos > 0) {
parent = (pos - 1) >> 1;
if (compare(items[pos], items[parent]) >= 0)
break;
swap(parent, pos);
pos = parent;
}
};
var bubbleDown = function(pos) {
var left, right, min, last = items.length - 1;
while (true) {
left = (pos << 1) + 1;
right = left + 1;
min = pos;
if (left <= last && compare(items[left], items[min]) < 0)
min = left;
if (right <= last && compare(items[right], items[min]) < 0)
min = right;
if (min === pos)
break;
swap(min, pos);
pos = min;
}
};
return {
add: function(item) {
items.push(item);
bubbleUp(items.length - 1);
},
poll: function() {
var first = items[0],
last = items.pop();
if (items.length > 0) {
items[0] = last;
bubbleDown(0);
}
return first;
},
peek: function() {
return items[0];
},
clear: function() {
items = [];
},
inspect: function() {
return angular.toJson(items, true);
},
get size() {
return items.length;
},
get all() {
return items;
},
set comparator(fn) {
compare = fn;
}
};
};
});
;
/*! RESOURCE: /scripts/sn/common/util/service.snResource.js */
angular.module('sn.common.util').factory('snResource', function($http, $q, priorityQueue, md5) {
'use strict';
var methods = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'jsonp', 'trace'],
queue = priorityQueue(function(a, b) {
return a.timestamp - b.timestamp;
}),
resource = {},
pendingRequests = [],
inFlightRequests = [];
return function() {
var requestInterceptors = $http.defaults.transformRequest,
responseInterceptors = $http.defaults.transformResponse;
var next = function() {
var request = queue.peek();
pendingRequests.shift();
inFlightRequests.push(request.hash);
$http(request.config).then(function(response) {
request.deferred.resolve(response);
}, function(reason) {
request.deferred.reject(reason);
}).finally(function() {
queue.poll();
inFlightRequests.shift();
if (queue.size > 0)
next();
});
};
angular.forEach(methods, function(method) {
resource[method] = function(url, data) {
var deferredRequest = $q.defer(),
promise = deferredRequest.promise,
deferredAbort = $q.defer(),
config = {
method: method,
url: url,
data: data,
transformRequest: requestInterceptors,
transformResponse: responseInterceptors,
timeout: deferredAbort.promise
},
hash = md5(JSON.stringify(config));
pendingRequests.push(hash);
queue.add({
config: config,
deferred: deferredRequest,
timestamp: Date.now(),
hash: hash
});
if (queue.size === 1)
next();
promise.abort = function() {
deferredAbort.resolve('Request cancelled');
};
return promise;
};
});
resource.addRequestInterceptor = function(fn) {
requestInterceptors = requestInterceptors.concat([fn]);
};
resource.addResponseInterceptor = function(fn) {
responseInterceptors = responseInterceptors.concat([fn]);
};
resource.queueSize = function() {
return queue.size;
};
resource.queuedRequests = function() {
return queue.all;
};
return resource;
};
});
;
/*! RESOURCE: /scripts/sn/common/util/service.snConnect.js */
angular.module("sn.common.util").service("snConnectService", function ($http, snCustomEvent) {
"use strict";
var connectPaths = ["/$c.do", "/$chat.do"];
function canOpenInFrameset() {
return window.top.NOW.collaborationFrameset;
}
function isInConnect() {
var parentPath = getParentPath();
return connectPaths.some(function(path) {
return parentPath == path;
});
}
function getParentPath() {
try {
return window.top.location.pathname;
} catch(IGNORED) {
return "";
}
}
function openWithProfile(profile) {
if (isInConnect() || canOpenInFrameset())
snCustomEvent.fireTop('chat:open_conversation', profile);
else
window.open("$c.do#/with/" + profile.sys_id, "_blank");
}
return {
openWithProfile: openWithProfile
}
});
;
/*! RESOURCE: /scripts/sn/common/util/snPolyfill.js */
(function(){
"use strict";
polyfill(String.prototype, 'startsWith', function(prefix) {
return this.indexOf(prefix) === 0;
});
polyfill(String.prototype, 'endsWith', function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
});
polyfill(Number, 'isNaN', function(value) {
return value !== value;
});
polyfill(window, 'btoa', function (input) {
var str = String(input);
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
for (
var block, charCode, idx = 0, map = chars, output = '';
str.charAt(idx | 0) || (map = '=', idx % 1);
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
) {
charCode = str.charCodeAt(idx += 3/4);
if (charCode > 0xFF) {
throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
}
block = block << 8 | charCode;
}
return output;
});
function polyfill(obj, slot, fn) {
if (obj[slot] === void(0)) {
obj[slot] = fn;
}
}
window.console = window.console || { log: function(){} };
})();
;
/*! RESOURCE: /scripts/sn/common/util/directive.snFocus.js */
angular.module('sn.common.util').directive('snFocus', function($timeout) {
'use strict';
return function(scope, element, attrs) {
scope.$watch(attrs.snFocus, function(value) {
if (value !== true)
return;
$timeout(function() {
element[0].focus();
});
});
};
});
;
/*! RESOURCE: /scripts/sn/common/util/directive.snResizeHeight.js */
angular.module('sn.common.util').directive('snResizeHeight', function($window) {
'use strict';
return {
restrict : 'A',
link : function(scope, elem, attrs) {
if (typeof $window.autosize === 'undefined') {
return;
}
$window.autosize(elem);
function _update() {
$window.autosize.update(elem);
}
function _destroy() {
$window.autosize.destroy(elem);
}
if (typeof attrs.disableValueWatcher === "undefined") {
scope.$watch(function() {
return elem.val();
}, function valueWatcher(newValue, oldValue) {
if (newValue === oldValue) {
return;
}
_update();
});
}
elem.on('input.resize', _update());
scope.$on('$destroy', function() {
_destroy();
});
if (attrs.snTextareaAutosizer === 'trim') {
elem.on('blur', function() {
elem.val(elem.val().trim());
_update();
})
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/util/directive.snBlurOnEnter.js */
angular.module('sn.common.util').directive('snBlurOnEnter', function() {
'use strict';
return function(scope, element) {
element.bind("keydown keypress", function(event) {
if (event.which !== 13)
return;
element.blur();
event.preventDefault();
});
};
});
;
/*! RESOURCE: /scripts/sn/common/util/directive.snStickyHeaders.js */
angular.module('sn.common.util').directive('snStickyHeaders', function() {
"use strict";
return {
restrict : 'A',
transclude: false,
replace: false,
link: function (scope, element, attrs) {
element.addClass('sticky-headers');
var containers;
var scrollContainer = element.find('[sn-sticky-scroll-container]');
scrollContainer.addClass('sticky-scroll-container');
function refreshHeaders () {
if (attrs.snStickyHeaders !== 'false') {
angular.forEach(containers, function (container) {
var stickyContainer = angular.element(container);
var stickyHeader = stickyContainer.find('[sn-sticky-header]');
var stickyOffset = stickyContainer.position().top + stickyContainer.outerHeight();
stickyContainer.addClass('sticky-container');
if (stickyOffset < stickyContainer.outerHeight() && stickyOffset > -stickyHeader.outerHeight()) {
stickyContainer.css('padding-top', stickyHeader.outerHeight());
stickyHeader.css('width', stickyHeader.outerWidth());
stickyHeader.removeClass('sticky-header-disabled').addClass('sticky-header-enabled');
} else {
stickyContainer.css('padding-top', '');
stickyHeader.css('width', '');
stickyHeader.removeClass('sticky-header-enabled').addClass('sticky-header-disabled');
}
});
} else {
element.find('[sn-sticky-container]').removeClass('sticky-container');
element.find('[sn-sticky-container]').css('padding-top', '');
element.find('[sn-sticky-header]').css('width', '');
element.find('[sn-sticky-header]').removeClass('sticky-header-enabled').addClass('sticky-header-disabled');
}
}
scope.$watch(function () {
scrollContainer.find('[sn-sticky-header]').addClass('sticky-header');
containers = element.find('[sn-sticky-container]');
return attrs.snStickyHeaders;
}, refreshHeaders);
scope.$watch(function () {
return scrollContainer[0].scrollHeight;
}, refreshHeaders);
scrollContainer.on('scroll', refreshHeaders);
}
};
});
;
/*! RESOURCE: /scripts/sn/common/util/directive.snBanner.js */
angular.module('sn.common.util').directive('snBanner', function(getTemplateUrl, $window, $http) {
'use strict';
function isIOS () {
var match = navigator.userAgent.match(/iPhone; CPU iPhone OS ([0-9_]*)/);
return !!match;
};
function isNative () {
return (navigator.userAgent.match(/SnMobile/i)
|| navigator.userAgent.match(/ServiceNow/i))
};
var isBannerClosed = function() {
var localStorageTime = $window.localStorage.getItem('mobileBannerDismissed');
var isBannerClosedFlag = false;
var SECONDS_IN_A_DAY = 86400000;
if(localStorageTime) {
if(((Date.now() - localStorageTime)/SECONDS_IN_A_DAY) < 1) {
isBannerClosedFlag = true;
} else {
$window.localStorage.removeItem('mobileBannerDismissed');
}
}
return isBannerClosedFlag;
};
var setBannerClosedTime = function() {
$window.localStorage.setItem('mobileBannerDismissed', Date.now());
};
var emitBannerState = function(state, $scope) {
$scope.$emit(state);
}
return {
restrict: 'E',
templateUrl: getTemplateUrl('sn_banner.xml'),
scope: {
bannerApiUrl: '='
},
controller: function($scope) {
$scope.isIOS = isIOS();
$scope.closeBanner = function() {
$scope.banner.show = false;
setBannerClosedTime();
emitBannerState('banner.closed', $scope);
};
$scope.openUrl = function() {
$window.open($scope.banner.nativeAppUrl, '_blank');
};
$scope.$watch('bannerApiUrl', function(newVal, oldVal) {
if (newVal && newVal !== oldVal) {
setBanner(newVal);
}
});
function setBanner(bannerApiUrl) {
$scope.banner = {};
if (isBannerClosed()) {
$scope.banner.show = false;
return;
}
if (isNative()) {
$scope.banner.show = false;
return;
};
$http.get(bannerApiUrl)
.then(function(response) {
var data = response.data;
if (data.BannerDetails) {
$scope.banner.show =  true;
$scope.banner.icon = data.BannerDetails.IconPath;
$scope.banner.name = data.BannerDetails.Name;
$scope.banner.description = data.BannerDetails.Description;
$scope.banner.nativeAppUrl = data.BannerDetails.Ulink;
emitBannerState('banner.opened', $scope);
} else {
$scope.banner.show =  false;
emitBannerState('banner.closed', $scope);
}
});
}
}
}
});
;
;
/*! RESOURCE: /scripts/sn/common/ui/js_includes_ui.js */
/*! RESOURCE: /scripts/sn/common/ui/_module.js */
angular.module('sn.common.ui', ['sn.common.messaging']);
;
/*! RESOURCE: /scripts/sn/common/ui/popover/js_includes_ui_popover.js */
/*! RESOURCE: /scripts/sn/common/ui/popover/_module.js */
angular.module('sn.common.ui.popover', []);
;
/*! RESOURCE: /scripts/sn/common/ui/popover/directive.snBindPopoverSelection.js */
angular.module('sn.common.ui.popover').directive('snBindPopoverSelection', function(snCustomEvent) {
"use strict";
return {
restrict: "A",
controller: function($scope, $element, $attrs , snCustomEvent) {
snCustomEvent.observe('list.record_select', recordSelectDataHandler);
function recordSelectDataHandler(data, event) {
if (!data || !event)
return;
event.stopPropagation();
var ref = ($scope.field) ? $scope.field.ref : $attrs.ref;
if (data.ref === ref) {
if (window.g_form) {
if ($attrs.addOption) {
addGlideListChoice('select_0' + $attrs.ref, data.value, data.displayValue);
} else {
var fieldValue = typeof $attrs.ref === 'undefined' ? data.ref : $attrs.ref;
window.g_form._setValue(fieldValue, data.value, data.displayValue);
clearDerivedFields(data.value);
}
}
if ($scope.field) {
$scope.field.value = data.value;
$scope.field.displayValue = data.displayValue;
}
}
}
function clearDerivedFields(value) {
if (window.DerivedFields) {
var df = new DerivedFields($scope.field ? $scope.field.ref : $attrs.ref);
df.clearRelated();
df.updateRelated(value);
}
}
}
};
});
;
/*! RESOURCE: /scripts/sn/common/ui/popover/directive.snComplexPopover.js */
angular.module('sn.common.ui.popover').directive('snComplexPopover', function(getTemplateUrl, $q, $http, $templateCache, $compile, $timeout){
"use strict";
return {
restrict: 'E',
replace:true,
templateUrl: function(elem, attrs){
return getTemplateUrl(attrs.buttonTemplate);
},
controller: function($scope, $element, $attrs, $q, $document, snCustomEvent, snComplexPopoverService){
$scope.type = $attrs.complexPopoverType || "complex_popover";
if ($scope.closeEvent){
snCustomEvent.observe($scope.closeEvent, destroyPopover);
$scope.$on($scope.closeEvent, destroyPopover);
}
$scope.$parent.$on('$destroy', destroyPopover);
$scope.$on('$destroy', function() {
snCustomEvent.un($scope.closeEvent, destroyPopover);
});
var newScope;
var open;
var popover;
var content;
var popoverDefaults = {
container: 'body',
html: true,
placement: 'auto',
trigger: 'manual',
template: '<div class="complex_popover popover" role="dialog"><div class="arrow"></div><div class="popover-content"></div></div>'
};
var popoverConfig = angular.extend(popoverDefaults, $scope.popoverConfig);
$scope.loading      = false;
$scope.initialized  = false;
$scope.popOverDisplaying = false;
$scope.togglePopover = function(event) {
if (!open){
showPopover(event);
} else {
destroyPopover();
}
$scope.popOverDisplaying = !$scope.popOverDisplaying;
};
function showPopover(e) {
if ($scope.loading)
return;
$scope.$toggleButton = angular.element(e.target);
$scope.loading = true;
$scope.$emit('list.toggleLoadingState', true);
_getTemplate()
.then(_insertTemplate)
.then(_createPopover)
.then(_bindHtml)
.then(function(){
$scope.initialized = true;
if (!$scope.loadEvent)
_openPopover();
});
}
function destroyPopover() {
if (!newScope)
return;
$scope.$toggleButton.on('hidden.bs.popover', function(){
open = false;
$scope.$toggleButton.data('bs.popover').$element.removeData('bs.popover').off('.popover');
$scope.$toggleButton = null;
snCustomEvent.fire('hidden.complexpopover.' + $scope.ref);
});
$scope.$toggleButton.popover('hide');
snCustomEvent.fire('hide.complexpopover.' + $scope.ref, $scope.$toggleButton);
newScope.$broadcast('$destroy');
newScope.$destroy();
newScope = null;
$scope.initialized = false;
angular.element(popoverConfig.container).off({
'keydown': keyDownHandler
});
angular.element(window).off({
'click': complexHtmlHandler
});
}
function _getTemplate() {
return snComplexPopoverService.getTemplate(getTemplateUrl($attrs.template));
}
function _createPopover() {
$scope.$toggleButton.popover(popoverConfig);
return $q.when(true);
}
function _insertTemplate(response) {
newScope = $scope.$new();
if ($scope.loadEvent)
newScope.$on($scope.loadEvent, _openPopover);
content = $compile(response.data)(newScope);
popoverConfig.content = content;
newScope.open = true;
snCustomEvent.fire('inserted.complexpopover.' + $scope.ref, $scope.$toggleButton);
return $q.when(true);
}
function _bindHtml() {
angular.element(popoverConfig.container).on({
'keydown': keyDownHandler
});
angular.element(window).on({
'click': complexHtmlHandler
});
return $q.when(true);
}
function complexHtmlHandler(e) {
var parentComplexPopoverScope = angular.element(e.target).parents('.popover-content').children().scope();
if (parentComplexPopoverScope && (parentComplexPopoverScope.type = "complex_popover") && $scope.type === "complex_popover")
return;
if (!open || angular.element(e.target).parents('html').length === 0)
return;
if ($scope.initialized && !$scope.loading && !$scope.$toggleButton.is(e.target) && content.parents('.popover').has(angular.element(e.target)).length === 0) {
_eventClosePopover(e);
destroyPopover(e);
}
}
function keyDownHandler(e) {
if (e.keyCode != 27)
return;
if (!open || angular.element(e.target).parents('html').length === 0)
return;
if ($scope.initialized && !$scope.loading && !$scope.$toggleButton.is(e.target) && content.parents('.popover').has(angular.element(e.target)).length > 0) {
_eventClosePopover(e);
destroyPopover();
}
}
function _eventClosePopover(e) {
e.preventDefault();
e.stopPropagation();
}
function createAndActivateFocusTrap(popover) {
var deferred = $q.defer();
if (!window.focusTrap) {
deferred.reject('Focus trap not found');
} else {
if (!$scope.focusTrap) {
$scope.focusTrap = window.focusTrap(popover, { clickOutsideDeactivates: true });
}
try {
$scope.focusTrap.activate({
onActivate: function() {
deferred.resolve();
}
});
} catch(e) {
console.warn("Unable to activate focus trap", e);
}
}
return deferred.promise;
}
function deactivateAndDestroyFocusTrap() {
var deferred = $q.defer();
if (!$scope.focusTrap) {
deferred.reject("Focus trap not found");
} else {
try {
$scope.focusTrap.deactivate({
returnFocus: false,
onDeactivate: function () {
deferred.resolve();
}
});
} catch (e) {
console.warn("Unable to deactivate focus trap", e);
}
$scope.focusTrap = null;
}
return deferred.promise;
}
function _openPopover() {
if (open) {
return;
}
open = true;
$timeout(function() {
$scope.$toggleButton.popover('show');
$scope.loading = false;
snCustomEvent.fire('show.complexpopover.' + $scope.ref, $scope.$toggleButton);
$scope.$toggleButton.on('shown.bs.popover', function(evt) {
var popoverObject = angular.element(evt.target).data('bs.popover'),
$tooltip,
popover;
$tooltip = popoverObject && popoverObject.$tip;
popover = $tooltip && $tooltip[0];
if (popover) {
createAndActivateFocusTrap(popover);
}
snCustomEvent.fire('shown.complexpopover.' + $scope.ref, $scope.$toggleButton);
});
$scope.$toggleButton.on('hide.bs.popover', function () {
deactivateAndDestroyFocusTrap().finally(function() {
$scope.$toggleButton.focus();
});
});
}, 0 );
}
}
};
});
;
/*! RESOURCE: /scripts/sn/common/ui/popover/service.snComplexPopoverService.js */
angular.module('sn.common.ui.popover').service('snComplexPopoverService', function($http, $q, $templateCache){
"use strict";
return {
getTemplate: getTemplate
};
function getTemplate(template){
return $http.get(template, {cache: $templateCache});
}
});
;
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snConfirmModal.js */
angular.module('sn.common.ui').directive('snConfirmModal', function(getTemplateUrl) {
return {
templateUrl: getTemplateUrl('sn_confirm_modal.xml'),
restrict: 'E',
replace: true,
transclude: true,
scope: {
config: '=?',
modalName: '@',
title: '@?',
message: '@?',
cancelButton:  '@?',
okButton: '@?',
alertButton: '@?',
cancel: '&?',
ok: '&?',
alert: '&?'
},
link: function (scope, element) {
element.find('.modal').remove();
},
controller: function($scope, $rootScope) {
$scope.config = $scope.config || {};
function Button(fn, text) {
return { fn: fn, text: text }
}
var buttons = {
'cancelButton': new Button('cancel', 'Cancel'),
'okButton':     new Button('ok',     'OK'),
'alertButton':  new Button('alert',  'Close'),
getText: function(type) {
var button = this[type];
if (button && $scope.get(button.fn))
return button.text;
}
};
$scope.get = function(type) {
if ($scope.config[type])
return $scope.config[type];
if (!$scope[type]) {
var text = buttons.getText(type);
if (text)
return $scope.config[type] = text;
}
return $scope.config[type] = $scope[type];
};
if(!$scope.get('modalName'))
$scope.config.modalName = 'confirm-modal';
function call(type) {
var action = $scope.get(type);
if (action) {
if (angular.isFunction(action))
action();
return true;
}
return !!buttons.getText(type);
}
$scope.cancelPressed = close('cancel');
$scope.okPressed = close('ok');
$scope.alertPressed = close('alert');
function close (type) {
return function () {
actionClosed = true;
$rootScope.$broadcast('dialog.' + $scope.config.modalName + '.close');
call(type);
}
}
var actionClosed;
$scope.$on('dialog.' + $scope.get('modalName') + '.opened', function() {
actionClosed = false;
$scope.isOpen = true;
});
$scope.$on('dialog.' + $scope.get('modalName') + '.closed', function() {
$scope.isOpen = false;
if (actionClosed)
return;
if (call('cancel'))
return;
if (call('alert'))
return;
call('ok');
});
}
};
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snContextMenu.js */
angular.module('sn.common.ui').directive('contextMenu', function ($document, $window, snCustomEvent) {
var $contextMenu, $ul;
var scrollHeight = angular.element("body").get(0).scrollHeight;
var contextMenuItemHeight = 0;
var $triggeringElement;
var _focusTrap;
function setContextMenuPosition(event, $ul){
if (!event.pageX && event.originalEvent.changedTouches)
event = event.originalEvent.changedTouches[0];
if (contextMenuItemHeight === 0)
contextMenuItemHeight = 24;
var cmWidth = 150;
var cmHeight = contextMenuItemHeight * $ul.children().length;
var pageX = event.pageX;
var pageY = event.pageY;
if (!pageX) {
var rect = event.target.getBoundingClientRect();
pageX = rect.left + angular.element(event.target).width();
pageY = rect.top + angular.element(event.target).height();
}
var startX = pageX + cmWidth >= $window.innerWidth ? pageX - cmWidth : pageX;
var startY = pageY + cmHeight >= $window.innerHeight ? pageY - cmHeight : pageY;
$ul.css({
display: 'block',
position: 'absolute',
left: startX,
top: startY
});
}
function renderContextMenuItems($scope, event, options) {
$ul.empty();
angular.forEach(options, function (item) {
var $li = angular.element('<li role="presentation">');
if (item === null) {
$li.addClass('divider');
} else {
var $a = angular.element('<a role="menuitem" href="javascript:void(0)">');
$a.text(typeof item[0] == 'string' ? item[0] : item[0].call($scope, $scope));
$li.append($a);
$li.on('click', function ($event) {
$event.preventDefault();
$scope.$apply(function () {
_clearContextMenus(event);
item[1].call($scope, $scope);
});
});
}
$ul.append($li);
});
setContextMenuPosition(event, $ul);
}
var renderContextMenu = function ($scope, event, options) {
angular.element(event.currentTarget).addClass('context');
$contextMenu = angular.element('<div>', {
'class': 'dropdown clearfix context-dropdown open'
});
$contextMenu.on('click', function (e) {
if (angular.element(e.target).hasClass('dropdown')) {
_clearContextMenus(event);
}
});
$contextMenu.on('contextmenu', function (event) {
event.preventDefault();
_clearContextMenus(event);
});
$contextMenu.on('keydown', function(event) {
if (event.keyCode != 27 && event.keyCode != 9)
return;
event.preventDefault();
_clearContextMenus(event);
});
$contextMenu.css({
position: 'absolute',
top: 0,
height: angular.element("body").get(0).scrollHeight,
left: 0,
right: 0,
zIndex: 9999
});
$document.find('body').append($contextMenu);
$ul = angular.element('<ul>', {
'class': 'dropdown-menu',
'role': 'menu'
});
renderContextMenuItems($scope, event, options);
$contextMenu.append($ul);
$triggeringElement = document.activeElement;
activateFocusTrap();
$contextMenu.data('resizeHandler', function() {
scrollHeight = angular.element("body").get(0).scrollHeight;
$contextMenu.css('height', scrollHeight);
});
snCustomEvent.observe('partial.page.reload', $contextMenu.data('resizeHandler'));
};
function _clearContextMenus(event){
if (!event)
return;
angular.element(event.currentTarget).removeClass('context');
var els = angular.element(".context-dropdown");
angular.forEach(els, function(el){
snCustomEvent.un('partial.page.reload', angular.element(el).data('resizeHandler'));
angular.element(el).remove();
});
deactivateFocusTrap();
}
function activateFocusTrap() {
if (_focusTrap || !window.focusTrap)
return;
_focusTrap = focusTrap($contextMenu[0], {
focusOutsideDeactivates: true,
clickOutsideDeactivates: true
});
_focusTrap.activate();
}
function deactivateFocusTrap() {
if (!_focusTrap || !window.focusTrap)
return;
_focusTrap.deactivate();
_focusTrap = null;
}
return function (scope, element, attrs) {
element.on('contextmenu', function (event) {
if (event.ctrlKey)
return;
if (angular.element(element).attr('context-type'))
return;
showMenu(event);
});
element.on('click', handleClick);
element.on('keydown', function(event) {
if (event.keyCode == 32) {
handleSpace(event);
} else if (event.keyCode === 13) {
handleClick(event);
}
});
var doubleTapTimeout,
doubleTapActive = false,
doubleTapStartPosition;
element.on('touchstart', function(event) {
doubleTapStartPosition = {
x: event.originalEvent.changedTouches[0].screenX,
y: event.originalEvent.changedTouches[0].screenY
};
});
element.on('touchend', function(event) {
var distX = Math.abs(event.originalEvent.changedTouches[0].screenX - doubleTapStartPosition.x);
var distY = Math.abs(event.originalEvent.changedTouches[0].screenY - doubleTapStartPosition.y);
if (distX > 15 || distY > 15) {
doubleTapStartPosition = null;
return;
}
if (doubleTapActive) {
doubleTapActive = false;
clearTimeout(doubleTapTimeout);
showMenu(event);
event.preventDefault();
return;
}
doubleTapActive = true;
event.preventDefault();
doubleTapTimeout = setTimeout(function() {
doubleTapActive = false;
if (event.target)
event.target.click();
}, 300);
});
function handleSpace(evt) {
var $target = angular.element(evt.target);
if ($target.is('button, [role=button]')) {
handleClick(evt);
return;
}
if (!$target.hasClass('list-edit-cursor'))
return;
showMenu(evt);
}
function handleClick(event) {
var $el = angular.element(element);
var $target = angular.element(event.target);
if (!$el.attr('context-type') && !$target.hasClass('context-menu-click'))
return;
showMenu(event);
}
function showMenu(evt) {
scope.$apply(function () {
applyMenu(evt);
clearWindowSelection();
});
}
function clearWindowSelection() {
if (window.getSelection)
if (window.getSelection().empty)
window.getSelection().empty();
else if (window.getSelection().removeAllRanges)
window.getSelection().removeAllRanges();
else if (document.selection)
document.selection.empty();
}
function applyMenu(event) {
var tagName = event.target.tagName;
if (tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'BUTTON') {
return;
}
var menu = scope.$eval(attrs.contextMenu, { event: event });
if (menu instanceof Array) {
if (menu.length > 0) {
event.stopPropagation();
event.preventDefault();
scope.$watch(function(){ return menu; }, function(newValue, oldValue){ if (newValue !== oldValue) renderContextMenuItems(scope, event, menu);}, true);
renderContextMenu(scope, event, menu);
}
} else if (typeof menu !== 'undefined' && typeof menu.then === 'function' ) {
event.stopPropagation();
event.preventDefault();
menu.then(function(response) {
var contextMenu = response;
if (contextMenu.length > 0) {
scope.$watch(function() {
return contextMenu;
}, function(newValue, oldValue) {
if (newValue !== oldValue)
renderContextMenuItems(scope, event, contextMenu);
}, true);
renderContextMenu(scope, event, contextMenu);
} else {
throw '"' + attrs.contextMenu + '" is not an array or promise';
}
});
} else {
throw '"' + attrs.contextMenu + '" is not an array or promise';
}
}
};
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snDialog.js */
angular.module("sn.common.ui").directive("snDialog", function($timeout, $rootScope, $document) {
"use strict";
return {
restrict: "AE",
transclude: true,
scope: {
modal: "=?",
disableAutoFocus: "=?",
classCheck: "="
},
replace: true,
template: '<dialog ng-keydown="escape($event)"><div ng-click="onClickClose()" title="Close" class="close-button icon-button icon-cross" tabindex="-1"></div></dialog>',
link: function(scope, element, attrs, ctrl, transcludeFn) {
var transcludeScope = {};
var _focusTrap = null;
scope.isOpen = function() {
return element[0].open;
};
transcludeFn(element.scope().$new(), function(a, b) {
element.prepend('<i class="sn-dialog-focus-trap-boundary" tabindex="0" ></i>');
element.append(a);
element.append('<i class="sn-dialog-focus-trap-boundary" tabindex="0" ></i>');
transcludeScope = b;
});
element.click(function(event) {
event.stopPropagation();
if (event.offsetX < 0 || event.offsetX > element[0].offsetWidth || event.offsetY < 0 || event.offsetY > element[0].offsetHeight)
if (!scope.classCheck)
scope.onClickClose();
else {
var classes = scope.classCheck.split(",");
var found = false;
for (var i = 0; i < classes.length; i++)
if (angular.element(event.target).closest(classes[i]).length > 0)
found = true;
if (!found)
scope.onClickClose();
}
});
scope.show = function() {
var d = element[0];
if (!d.showModal || true) {
dialogPolyfill.registerDialog(d);
d.setDisableAutoFocus(scope.disableAutoFocus);
}
if (scope.modal)
d.showModal();
else
d.show();
if(!angular.element(d).hasClass('sn-alert')) {
$timeout(function() {
if (d.dialogPolyfillInfo && d.dialogPolyfillInfo.backdrop) {
angular.element(d.dialogPolyfillInfo.backdrop).one('click', function(event) {
if (!scope.classCheck || angular.element(event.srcElement).closest(scope.classCheck).length == 0)
scope.onClickClose();
})
}
else {
$document.on('click', function(event) {
if (!scope.classCheck || angular.element(event.srcElement).closest(scope.classCheck).length == 0)
scope.onClickClose();
})
}
});
}
element.find('.btn-primary').eq(0).focus();
};
scope.setPosition = function(data) {
var contextData = scope.getContextData(data);
if (contextData && element && element[0]) {
if (contextData.position) {
element[0].style.top = contextData.position.top + "px";
element[0].style.left = contextData.position.left + "px";
element[0].style.margin = "0px";
}
if (contextData.dimensions) {
element[0].style.width = contextData.dimensions.width + "px";
element[0].style.height = contextData.dimensions.height + "px";
}
}
}
scope.$on("dialog." + attrs.name + ".move", function(event, data) {
scope.setPosition(data);
})
scope.$on("dialog." + attrs.name + ".show", function(event, data) {
scope.setPosition(data);
scope.setKeyEvents(data);
if (scope.isOpen() === true)
scope.close();
else
scope.show();
angular.element(".sn-dialog-menu").each(function(index, value) {
var name = angular.element(this).attr('name');
if(name != attrs.name && !angular.element(this).attr('open')) {
return true;
}
if(name != attrs.name  && angular.element(this).attr('open')) {
$rootScope.$broadcast("dialog." + name + ".close");
}
});
activateFocusTrap();
})
scope.onClickClose = function() {
if (scope.isOpen())
$rootScope.$broadcast("dialog." + attrs.name + ".close");
}
scope.escape = function($event) {
if ($event.keyCode === 27) {
scope.onClickClose();
}
};
scope.close = function() {
var d = element[0];
d.close();
scope.removeListeners();
deactivateFocusTrap();
}
scope.ok = function(contextData) {
contextData.ok();
scope.removeListeners();
}
scope.cancel = function(contextData) {
contextData.cancel();
scope.removeListeners();
}
scope.removeListeners = function() {
element[0].removeEventListener("ok", scope.handleContextOk, false);
element[0].removeEventListener("cancel", scope.handleContextCancel, false);
}
scope.setKeyEvents = function(data) {
var contextData = scope.getContextData(data);
if (contextData && contextData.cancel) {
scope.handleContextOk = function() {
scope.ok(contextData);
}
scope.handleContextCancel = function() {
scope.cancel(contextData);
}
element[0].addEventListener("ok", scope.handleContextOk, false);
element[0].addEventListener("cancel", scope.handleContextCancel, false);
}
}
scope.getContextData = function(data) {
var context = attrs.context;
var contextData = null;
if (context && data && context in data) {
contextData = data[context];
transcludeScope[context] = contextData;
}
return contextData;
}
scope.$on("dialog." + attrs.name + ".close", scope.close);
function focusTrap(element) {
var getSentinelElements = function() {
var boundarySelector = '.sn-dialog-focus-trap-boundary';
var sentinelNodes = element.querySelectorAll(boundarySelector);
return sentinelNodes;
}
var getTabbableElements = function (elm, selector) {
var tabbables = window.tabbable ? window.tabbable(elm, selector) : [];
return tabbables;
};
var focusElement = function (reverse) {
return function (e) {
var selectors =
'iframe, input, select, a[href], textarea, button, [tabindex]:not(.sn-dialog-focus-trap-boundary), [contenteditable]:not([contenteditable="false"])';
var tabbables = getTabbableElements(element, selectors);
if (tabbables.length === 0) return;
var newTarget = reverse
? tabbables[tabbables.length - 1]
: tabbables[0];
if (newTarget.tagName == "IFRAME") {
var frameElements = getTabbableElements(
newTarget.contentDocument
);
if (frameElements.length > 0)
newTarget = reverse
? frameElements[frameElements.length - 1]
: frameElements[0];
}
newTarget.focus();
};
};
var sentinelElements = getSentinelElements();
var topSentinelElement = sentinelElements[0];
var bottomSentinelElement = sentinelElements[1];
var nodeFocusedBeforeActivation = null;
var forwardTrap = focusElement(true);
var reverseTrap = focusElement(false);
var activate = function () {
nodeFocusedBeforeActivation = document.activeElement;
topSentinelElement.addEventListener("focusin", forwardTrap);
bottomSentinelElement.addEventListener("focusin", reverseTrap);
};
var deactivate = function () {
if(nodeFocusedBeforeActivation)
nodeFocusedBeforeActivation.focus();
topSentinelElement.removeEventListener("focusin", forwardTrap);
bottomSentinelElement.removeEventListener("focusin", reverseTrap);
};
return {
activate: activate,
deactivate: deactivate,
};
}
function activateFocusTrap() {
if (_focusTrap)
return;
_focusTrap = focusTrap(element[0]);
_focusTrap.activate();
}
function deactivateFocusTrap() {
if (!_focusTrap)
return;
_focusTrap.deactivate();
_focusTrap = null;
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snFlyout.js */
angular.module('sn.common.ui').directive('snFlyout', function(getTemplateUrl) {
'use strict';
return {
restrict: 'E',
transclude: true,
replace: 'true',
templateUrl: getTemplateUrl('sn_flyout.xml'),
scope: true,
link: function($scope, element, attrs) {
$scope.open = false;
$scope.more = false;
$scope.position = attrs.position || 'left';
$scope.flyoutControl = attrs.control;
$scope.register = attrs.register;
var body = angular.element('.flyout-body', element);
var header = angular.element('.flyout-header', element);
var tabs = angular.element('.flyout-tabs', element);
var distance = 0;
var position = $scope.position;
var options = {duration: 800, easing: 'easeOutBounce'}
var animation = {};
if ($scope.flyoutControl) {
$('.flyout-handle', element).hide();
var controls = angular.element('#' + $scope.flyoutControl);
controls.click(function() { angular.element(this).trigger("snFlyout.open"); });
controls.on('snFlyout.open', function() {
$scope.$apply(function() { $scope.open = !$scope.open; });
});
}
var animate = function() {
element.velocity(animation, options);
}
var setup = function() {
animation[position] = -distance;
if ($scope.open)
element.css(position, 0);
else
element.css(position, -distance);
}
var calculatePosition = function() {
if ($scope.open) {
animation[position] = 0;
} else {
if ($scope.position === 'left' || $scope.position === 'right')
animation[position] = -body.outerWidth();
else
animation[position] = -body.outerHeight();
}
}
$scope.$watch('open', function(newValue, oldValue) {
if(newValue === oldValue)
return;
calculatePosition();
animate();
});
$scope.$watch('more', function(newValue, oldValue) {
if (newValue === oldValue)
return;
var moreAnimation = {};
if ($scope.more) {
element.addClass('fly-double');
moreAnimation = {width: body.outerWidth() * 2};
}
else {
element.removeClass('fly-double');
moreAnimation = {width: body.outerWidth() / 2};
}
body.velocity(moreAnimation, options);
header.velocity(moreAnimation, options);
});
if ($scope.position === 'left' || $scope.position === 'right') {
$scope.$watch(element[0].offsetWidth, function() {
element.addClass('fly-from-' + $scope.position);
distance = body.outerWidth();
setup();
});
} else if ($scope.position === 'top' || $scope.position === 'bottom') {
$scope.$watch(element[0].offsetWidth, function() {
element.addClass('fly-from-' + $scope.position);
distance = body.outerHeight() + header.outerHeight();
setup();
});
}
$scope.$on($scope.register + ".bounceTabByIndex", function(event, index) {
$scope.bounceTab(index);
});
$scope.$on($scope.register + ".bounceTab", function(event, tab) {
$scope.bounceTab($scope.tabs.indexOf(tab));
});
$scope.$on($scope.register + ".selectTabByIndex", function(event, index) {
$scope.selectTab($scope.tabs[index]);
});
$scope.$on($scope.register + ".selectTab", function(event, tab) {
$scope.selectTab(tab);
});
},
controller: function($scope, $element) {
$scope.tabs = [];
var baseColor, highLightColor;
$scope.selectTab = function(tab) {
if ($scope.selectedTab)
$scope.selectedTab.selected = false;
tab.selected = true;
$scope.selectedTab = tab;
normalizeTab($scope.tabs.indexOf(tab));
}
function expandTab(tabElem) {
tabElem.queue("tabBounce", function(next) {
tabElem.velocity({
width: ["2.5rem", "2.125rem"],
backgroundColorRed: [highLightColor[0], baseColor[0]],
backgroundColorGreen: [highLightColor[1], baseColor[1]],
backgroundColorBlue: [highLightColor[2], baseColor[2]]
},{
easing: "easeInExpo",
duration: 250
});
next();
});
}
function contractTab(tabElem) {
tabElem.queue("tabBounce", function(next) {
tabElem.velocity({
width: ["2.125rem","2.5rem"],
backgroundColorRed: [baseColor[0], highLightColor[0]],
backgroundColorGreen: [baseColor[1], highLightColor[1]],
backgroundColorBlue: [baseColor[2], highLightColor[2]]
},{
easing: "easeInExpo",
duration: 250
});
next();
});
}
$scope.bounceTab = function(index) {
if(index >= $scope.tabs.length || index < 0)
return;
var tabScope = $scope.tabs[index];
if(!tabScope.selected) {
var tabElem =  $element.find('.flyout-tab').eq(index);
if(!baseColor) {
baseColor = tabElem.css('backgroundColor').match(/[0-9]+/g);
for( var i = 0; i < baseColor.length; i++)
baseColor[i] = parseInt(baseColor[i], 10);
}
if(!highLightColor)
highLightColor = invertColor(baseColor);
if(tabScope.highlighted)
contractTab(tabElem);
for(var i = 0; i < 2; i++) {
expandTab(tabElem);
contractTab(tabElem);
}
expandTab(tabElem);
tabElem.dequeue("tabBounce");
tabScope.highlighted = true;
}
}
$scope.toggleOpen = function() {
$scope.open = !$scope.open;
}
this.addTab = function(tab) {
$scope.tabs.push(tab);
if($scope.tabs.length === 1)
$scope.selectTab(tab)
}
function normalizeTab(index) {
if(index < 0 || index >= $scope.tabs.length || !$scope.tabs[index].highlighted)
return;
var tabElem =  $element.find('.flyout-tab').eq(index);
tabElem.velocity({
width: ["2.125rem", "2.5rem"]
},{
easing: "easeInExpo",
duration: 250
});
tabElem.css('backgroundColor', '');
$scope.tabs[index].highlighted = false;
}
function invertColor(rgb) {
if(typeof rgb === "string")
var color = rgb.match(/[0-9]+/g);
else
var color = rgb.slice(0);
for(var i = 0; i < color.length; i++)
color[i] = 255 - parseInt(color[i], 10);
return color;
}
}
}
}).directive("snFlyoutTab", function() {
"use strict";
return {
restrict: "E",
require: "^snFlyout",
replace: true,
scope: true,
transclude: true,
template: "<div ng-show='selected' ng-transclude='' style='height: 100%'></div>",
link: function(scope, element, attrs, flyoutCtrl) {
flyoutCtrl.addTab(scope);
}
}
})
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snModal.js */
angular.module("sn.common.ui").directive("snModal", function($timeout, $rootScope) {
"use strict";
return {
restrict: "AE",
transclude: true,
scope: {},
replace: true,
template: '<div tabindex="-1" aria-modal="true" aria-hidden="true" class="modal" role="dialog"></div>',
link: function(scope, element, attrs, ctrl, transcludeFn) {
var transcludeScope = {};
transcludeFn(element.scope().$new(), function(a, b) {
element.append(a);
element.append('<i class="focus-trap-boundary-south" tabindex="0"></i>');
transcludeScope = b;
});
scope.$on("dialog." + attrs.name + ".show", function(event, data) {
if (!isOpen())
show(data);
});
scope.$on("dialog." + attrs.name + ".close", function() {
if (isOpen())
close();
});
function eventFn(eventName) {
return function (e) {
$rootScope.$broadcast("dialog." + attrs.name + "." + eventName, e);
}
}
var events = {
'shown.bs.modal'  : eventFn("opened"),
'hide.bs.modal'   : eventFn("hide"),
'hidden.bs.modal' : eventFn("closed")
};
function show(data) {
var context = attrs.context;
var contextData = null;
if (context && data && context in data) {
contextData = data[context];
transcludeScope[context] = contextData;
}
$timeout(function() {
angular.element('.sn-popover-basic').each(function () {
var $this = angular.element(this);
if (angular.element($this.attr('data-target')).is(':visible')) {
$this.popover('hide');
}
});
});
element.modal('show');
element.attr('aria-hidden', 'false');
for (var event in events)
if(events.hasOwnProperty(event))
element.on(event, events[event]);
if (attrs.moveBackdrop == 'true')
moveBackdrop(element);
}
function close() {
element.modal('hide');
element.attr('aria-hidden', 'true');
for (var event in events)
if(events.hasOwnProperty(event))
element.off(event, events[event]);
}
function isOpen() {
return element.hasClass('in');
}
function moveBackdrop(element) {
var backdrop = element.data('bs.modal').$backdrop;
if (!backdrop)
return;
element.after(backdrop.remove());
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snModalShow.js */
angular.module('sn.common.ui').directive('snModalShow', function() {
"use strict";
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.click(function() {
showDialog();
});
function showDialog() {
scope.$broadcast('dialog.' + attrs.snModalShow + '.show');
}
}
}
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snTabs.js */
angular.module('sn.common.ui').directive('snTabs', function() {
'use strict';
return {
restrict: 'E',
transclude: true,
replace: 'true',
scope: {
tabData: '='
},
link: function($scope, element, attrs) {
$scope.tabClass = attrs.tabClass;
$scope.register = attrs.register;
attrs.$observe('register', function(value) {
$scope.register = value;
$scope.setupListeners();
});
$scope.bounceTab = function() {
angular.element()
}
},
controller: 'snTabs'
}
}).controller('snTabs', function($scope, $rootScope) {
$scope.selectedTabIndex = 0;
$scope.tabData[$scope.selectedTabIndex].selected = true;
$scope.setupListeners = function() {
$scope.$on($scope.register + '.selectTabByIndex', function(event, index) {
$scope.selectTabByIndex(event, index);
});
}
$scope.selectTabByIndex = function(event, index) {
if (index === $scope.selectedTabIndex)
return;
if (event.stopPropagation)
event.stopPropagation();
$scope.tabData[$scope.selectedTabIndex].selected = false;
$scope.tabData[index].selected = true;
$scope.selectedTabIndex = index;
$rootScope.$broadcast($scope.register + '.selectTabByIndex', $scope.selectedTabIndex);
}
}).directive('snTab', function() {
'use strict';
return {
restrict: 'E',
transclude: true,
replace: 'true',
scope: {
tabData: '=',
index: '='
},
template: '',
controller: 'snTab',
link: function($scope, element, attrs) {
$scope.register = attrs.register;
attrs.$observe('register', function(value) {
$scope.register = value;
$scope.setupListeners();
});
$scope.bounceTab = function() {
alert('Bounce Tab at Index: ' + $scope.index);
}
}
}
}).controller('snTab', function($scope) {
$scope.selectTabByIndex = function(index) {
$scope.$emit($scope.register + '.selectTabByIndex', index);
}
$scope.setupListeners = function() {
$scope.$on($scope.register + '.showTabActivity', function(event, index, type) {
$scope.showTabActivity(index, type);
});
}
$scope.showTabActivity = function(index, type) {
if ($scope.index !== index)
return;
switch (type) {
case 'message':
break;
case 'error':
break;
default:
$scope.bounceTab();
}
}
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snTextExpander.js */
angular.module('sn.common.ui').directive('snTextExpander', function(getTemplateUrl, $timeout) {
'use strict';
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl('sn_text_expander.xml'),
scope: {
maxHeight: '&',
value: '='
},
link: function compile(scope, element, attrs) {
var container = angular.element(element).find('.textblock-content-container');
var content = angular.element(element).find('.textblock-content');
if (scope.maxHeight() === undefined) {
scope.maxHeight = function () {
return 100;
}
}
container.css('overflow-y', 'hidden');
container.css('max-height', scope.maxHeight() + 'px');
},
controller: function ($scope, $element) {
var container = $element.find('.textblock-content-container');
var content = $element.find('.textblock-content');
$scope.value = $scope.value || '';
$scope.toggleExpand = function () {
$scope.showMore = !$scope.showMore;
if ($scope.showMore) {
container.css('max-height', content.height());
} else {
container.css('max-height', $scope.maxHeight());
}
};
$timeout(function () {
if (content.height() > $scope.maxHeight()) {
$scope.showToggle = true;
$scope.showMore = false;
}
});
}
};
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snAttachmentPreview.js */
angular.module('sn.common.ui').directive('snAttachmentPreview', function(getTemplateUrl, snCustomEvent) {
return {
restrict: 'E',
templateUrl: getTemplateUrl('sn_attachment_preview.xml'),
controller: function($scope) {
snCustomEvent.observe('sn.attachment.preview', function(evt, attachment) {
if (evt.stopPropagation)
evt.stopPropagation();
if (evt.preventDefault)
evt.preventDefault();
$scope.image = attachment;
$scope.$broadcast('dialog.attachment_preview.show');
return false;
});
}
}
});
;
/*! RESOURCE: /scripts/sn/common/ui/service.progressDialog.js */
angular.module('sn.common.ui').factory('progressDialog', ['$rootScope', '$compile', '$timeout', '$http', '$templateCache', 'nowServer', 'i18n', function($rootScope, $compile, $timeout, $http, $templateCache, nowServer, i18n) {
'use strict';
i18n.getMessages(['Close']);
return {
STATES : ["Pending", "Running", "Succeeded", "Failed", "Cancelled" ],
STATUS_IMAGES : ["images/workflow_skipped.gif", "images/loading_anim2.gifx",
"images/progress_success.png", "images/progress_failure.png",
'images/request_cancelled.gif' ],
EXPAND_IMAGE : "images/icons/filter_hide.gif",
COLLAPSE_IMAGE : "images/icons/filter_reveal.gif",
BACK_IMAGE : "images/activity_filter_off.gif",
TIMEOUT_INTERVAL : 750,
_findChildMessage: function( statusObject ) {
if ( !statusObject.children ) return null;
for ( var i = 0; i < statusObject.children.length; i++ ) {
var child = statusObject.children[i];
if ( child.state == '1' ) {
var msg = child.message;
var submsg = this._findChildMessage( child );
if ( submsg == null )
return msg;
else
return null;
} else if ( child.state == '0' ) {
return null;
} else {
}
}
return null;
},
create: function(scope, elemid, title, startCallback, endCallback, closeCallback) {
var namespace = this;
var progressItem = scope.$new(true);
progressItem.id = elemid + "_progressDialog";
progressItem.overlayVisible = true;
progressItem.state = 0;
progressItem.message = '';
progressItem.percentComplete = 0;
progressItem.enableChildMessages = false;
if (!title) title = '';
progressItem.title = title;
progressItem.button_close = i18n.getMessage('Close');
var overlayElement;
overlayElement = $compile(
'<div id="{{id}}" ng-show="overlayVisible" class="modal modal-mask" role="dialog" tabindex="-1">' +
'<div class="modal-dialog m_progress_overlay_content">' +
'<div class="modal-content">' +
'<header class="modal-header">' +
'<h4 class="modal-title">{{title}}</h4>' +
'</header>' +
'<div class="modal-body">' +
'<div class="progress" ng-class="{\'progress-danger\': (state == 3)}">' +
'<div class="progress-bar" ng-class="{\'progress-bar-danger\': (state == 3)}" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="{{percentComplete}}" ng-style="{width: percentComplete + \'%\'}">' +
'</div>' +
'</div>' +
'<div>{{message}}<span style="float: right;" ng-show="state==1 || state == 2">{{percentComplete}}%</span></div>' +
'</div>' +
'<footer class="modal-footer">' +
'<button class="btn btn-default sn-button sn-button-normal" ng-click="close()" ng-show="state > 1">{{button_close}}</button>' +
'</footer>' +
'</div>' +
'</div>' +
'</div>')(progressItem);
$("body")[0].appendChild(overlayElement[0]);
progressItem.setEnableChildMessages = function( enableChildren ) {
progressItem.enableChildMessages = enableChildren;
}
progressItem.start = function( src, dataArray ) {
$http.post(src, dataArray).success(function(response) {
progressItem.trackerId = response.sys_id;
try { if ( startCallback ) startCallback(response); } catch(e) { }
$timeout(progressItem.checkProgress.bind(progressItem));
})
.error(function(response, status, headers, config) {
progressItem.state = '3';
if (endCallback) endCallback( response );
});
};
progressItem.checkProgress = function() {
var src = nowServer.getURL('progress_status', {sysparm_execution_id: this.trackerId});
$http.post(src).success(function(response) {
if ( $.isEmptyObject(response) ) {
progressItem.state = '3';
if (endCallback) endCallback( response );
return;
}
progressItem.update( response );
if (response.status == 'error' || response.state == '') {
progressItem.state = '3';
if ( response.message )
progressItem.message = response.message;
else
progressItem.message = response;
if (endCallback) endCallback( response );
return;
}
if ( response.state == '0' || response.state == '1' ) {
$timeout(progressItem.checkProgress.bind(progressItem), namespace.TIMEOUT_INTERVAL);
} else {
if (endCallback) endCallback( response );
}
})
.error(function(response, status, headers, config) {
progressItem.state = '3';
progressItem.message = response;
if (endCallback) endCallback( response );
});
};
progressItem.update = function( statusObject ) {
var msg = statusObject.message;
if ( progressItem.enableChildMessages ) {
var childMsg = namespace._findChildMessage( statusObject );
if ( childMsg != null )
msg = childMsg;
}
this.message = msg;
this.state = statusObject.state;
this.percentComplete = statusObject.percent_complete;
};
progressItem.close = function(ev) {
try { if (closeCallback) closeCallback(); } catch(e) { }
$("body")[0].removeChild($("#" + this.id)[0]);
delete namespace.progressItem;
};
return progressItem;
}
}
}]);
;
/*! RESOURCE: /scripts/sn/common/ui/factory.paneManager.js */
angular.module("sn.common.ui").factory("paneManager", ['$timeout', 'userPreferences', 'snCustomEvent', function($timeout, userPreferences, snCustomEvent) {
"use strict";
var paneIndex = {};
function registerPane(paneName) {
if (!paneName in paneIndex) {
paneIndex[paneName] = false;
}
userPreferences.getPreference(paneName + '.opened').then(function(value) {
var isOpen = value !== 'false';
if (isOpen) {
togglePane(paneName, false);
}
});
}
function togglePane(paneName, autoFocusPane) {
for (var currentPane in paneIndex) {
if (paneName != currentPane && paneIndex[currentPane]) {
CustomEvent.fireTop(currentPane + '.toggle');
saveState(currentPane, false);
}
}
snCustomEvent.fireTop(paneName + '.toggle', false, autoFocusPane);
saveState(paneName, !paneIndex[paneName]);
};
function saveState(paneName, state) {
paneIndex[paneName] = state;
userPreferences.setPreference(paneName + '.opened', state);
}
return {
registerPane : registerPane,
togglePane : togglePane
};
}]);
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snBootstrapPopover.js */
angular.module('sn.common.ui').directive('snBootstrapPopover', function ($timeout, $compile, $rootScope) {
'use strict';
return {
restrict: 'A',
link: function (scope, element) {
element.on('click.snBootstrapPopover', function (event) {
$rootScope.$broadcast('sn-bootstrap-popover.close-other-popovers');
createPopover(event);
});
element.on('keypress.snBootstrapPopover', function (event) {
if (event.keyCode != 13 && event.keyCode != 32)
return;
if (event.keyCode ===  32 ) {
event.preventDefault();
}
scope.$broadcast('sn-bootstrap-popover.close-other-popovers');
createPopover(event);
});
var popoverOpen = false;
function _hidePopover() {
popoverOpen = false;
var api = element.data('bs.popover');
if (api) {
api.hide();
element.off('.popover').removeData('bs.popover');
element.data('bs.popover', void(0));
element.focus();
}
}
function _openPopover() {
$timeout(function () {
popoverOpen = true;
element.on('hidden.bs.popover', function () {
_hidePopover();
popoverOpen = false;
});
element.popover('show');
var popoverBody = angular.element(document.getElementById('sn-bootstrap-popover'));
popoverBody.focus();
popoverBody.on('keydown', function (e) {
if (e.keyCode === 27) {
popoverBody.off('keydown');
_hidePopover();
}
});
}, 0, false);
}
function createPopover (evt) {
angular.element('.popover').each(function () {
var object = angular.element(this);
if (!object.is(evt.target) && object.has(evt.target).length === 0 && angular.element('.popover').has(evt.target).length === 0) {
_hidePopover();
object.popover('hide');
}
});
if (scope.disablePopover || evt.keyCode === 9)
return;
if (popoverOpen) {
_hidePopover();
return;
}
var childScope = scope.$new();
evt.stopPropagation();
element.attr('data-toggle', 'popover');
element.attr('data-trigger','focus');
element.attr('tabindex',0);
angular.element(element).popover({
container: 'body',
placement: 'auto top',
html: true,
trigger: 'manual',
content: $compile(scope.template)(childScope)
});
var wait = element.attr('popover-wait-event');
if (wait)
scope.$on(wait, _openPopover);
else
_openPopover();
var bodyClickEvent = angular.element('body').on('click.snBootstrapPopover.body', function (evt) {
angular.element('.popover').each(function () {
var object = angular.element(this);
if (!object.is(evt.target) && object.has(evt.target).length === 0 && angular.element('.popover').has(evt.target).length === 0) {
bodyClickEvent.off();
_hidePopover();
childScope.$destroy();
}
})
});
element.on('$destroy', function () {
bodyClickEvent.off();
_hidePopover();
childScope.$destroy();
})
};
}
}
});
;
/*! RESOURCE: /scripts/sn/common/ui/directive.snFocusEsc.js */
angular.module('sn.common.ui').directive('snFocusEsc', function($document) {
'use strict';
return {
restrict: 'A',
scope: false,
link: function (scope, element, attrs) {
$document.on('keyup', function($event) {
if ($event.keyCode === 27 ) {
var focusedElement = $event.target;
if (focusedElement && element[0].contains(focusedElement)) {
scope.$eval(attrs.snFocusEsc);
}
}
});
}
};
});
;
;
/*! RESOURCE: /scripts/sn/common/stream/js_includes_stream.js */
/*! RESOURCE: /scripts/thirdparty/ment.io/mentio.js */
(function() {
'use strict';
angular.module('mentio', [])
.directive('mentio', ['mentioUtil', '$document', '$compile', '$log', '$timeout',
function (mentioUtil, $document, $compile, $log, $timeout) {
return {
restrict: 'A',
scope: {
macros: '=mentioMacros',
search: '&mentioSearch',
select: '&mentioSelect',
items: '=mentioItems',
typedTerm: '=mentioTypedTerm',
altId: '=mentioId',
iframeElement: '=mentioIframeElement',
requireLeadingSpace: '=mentioRequireLeadingSpace',
suppressTrailingSpace: '=mentioSuppressTrailingSpace',
selectNotFound: '=mentioSelectNotFound',
trimTerm: '=mentioTrimTerm',
ngModel: '='
},
controller: ["$scope", "$timeout", "$attrs", function($scope, $timeout, $attrs) {
$scope.query = function (triggerChar, triggerText) {
var remoteScope = $scope.triggerCharMap[triggerChar];
if ($scope.trimTerm === undefined || $scope.trimTerm) {
triggerText = triggerText.trim();
}
remoteScope.showMenu();
remoteScope.search({
term: triggerText
});
remoteScope.typedTerm = triggerText;
};
$scope.defaultSearch = function(locals) {
var results = [];
angular.forEach($scope.items, function(item) {
if (item.label.toUpperCase().indexOf(locals.term.toUpperCase()) >= 0) {
results.push(item);
}
});
$scope.localItems = results;
};
$scope.bridgeSearch = function(termString) {
var searchFn = $attrs.mentioSearch ? $scope.search : $scope.defaultSearch;
searchFn({
term: termString
});
};
$scope.defaultSelect = function(locals) {
return $scope.defaultTriggerChar + locals.item.label;
};
$scope.bridgeSelect = function(itemVar) {
var selectFn = $attrs.mentioSelect ? $scope.select : $scope.defaultSelect;
return selectFn({
item: itemVar
});
};
$scope.setTriggerText = function(text) {
if ($scope.syncTriggerText) {
$scope.typedTerm = ($scope.trimTerm === undefined || $scope.trimTerm) ? text.trim() : text;
}
};
$scope.context = function() {
if ($scope.iframeElement) {
return {iframe: $scope.iframeElement};
}
};
$scope.replaceText = function (text, hasTrailingSpace) {
$scope.hideAll();
mentioUtil.replaceTriggerText($scope.context(), $scope.targetElement, $scope.targetElementPath,
$scope.targetElementSelectedOffset, $scope.triggerCharSet, text, $scope.requireLeadingSpace,
hasTrailingSpace, $scope.suppressTrailingSpace);
if (!hasTrailingSpace) {
$scope.setTriggerText('');
angular.element($scope.targetElement).triggerHandler('change');
if ($scope.isContentEditable()) {
$scope.contentEditableMenuPasted = true;
var timer = $timeout(function() {
$scope.contentEditableMenuPasted = false;
}, 200);
$scope.$on('$destroy', function() {
$timeout.cancel(timer);
});
}
}
};
$scope.hideAll = function () {
for (var key in $scope.triggerCharMap) {
if ($scope.triggerCharMap.hasOwnProperty(key)) {
$scope.triggerCharMap[key].hideMenu();
}
}
};
$scope.getActiveMenuScope = function () {
for (var key in $scope.triggerCharMap) {
if ($scope.triggerCharMap.hasOwnProperty(key)) {
if ($scope.triggerCharMap[key].visible) {
return $scope.triggerCharMap[key];
}
}
}
return null;
};
$scope.selectActive = function () {
for (var key in $scope.triggerCharMap) {
if ($scope.triggerCharMap.hasOwnProperty(key)) {
if ($scope.triggerCharMap[key].visible) {
$scope.triggerCharMap[key].selectActive();
}
}
}
};
$scope.isActive = function () {
for (var key in $scope.triggerCharMap) {
if ($scope.triggerCharMap.hasOwnProperty(key)) {
if ($scope.triggerCharMap[key].visible) {
return true;
}
}
}
return false;
};
$scope.isContentEditable = function() {
return ($scope.targetElement.nodeName !== 'INPUT' && $scope.targetElement.nodeName !== 'TEXTAREA');
};
$scope.replaceMacro = function(macro, hasTrailingSpace) {
if (!hasTrailingSpace) {
$scope.replacingMacro = true;
$scope.timer = $timeout(function() {
mentioUtil.replaceMacroText($scope.context(), $scope.targetElement,
$scope.targetElementPath, $scope.targetElementSelectedOffset,
$scope.macros, $scope.macros[macro]);
angular.element($scope.targetElement).triggerHandler('change');
$scope.replacingMacro = false;
}, 300);
$scope.$on('$destroy', function() {
$timeout.cancel($scope.timer);
});
} else {
mentioUtil.replaceMacroText($scope.context(), $scope.targetElement, $scope.targetElementPath,
$scope.targetElementSelectedOffset, $scope.macros, $scope.macros[macro]);
}
};
$scope.addMenu = function(menuScope) {
if (menuScope.parentScope && $scope.triggerCharMap.hasOwnProperty(menuScope.triggerChar)) {
return;
}
$scope.triggerCharMap[menuScope.triggerChar] = menuScope;
if ($scope.triggerCharSet === undefined) {
$scope.triggerCharSet = [];
}
$scope.triggerCharSet.push(menuScope.triggerChar);
menuScope.setParent($scope);
};
$scope.$on(
'menuCreated', function (event, data) {
if (
$attrs.id !== undefined ||
$attrs.mentioId !== undefined
)
{
if (
$attrs.id === data.targetElement ||
(
$attrs.mentioId !== undefined &&
$scope.altId === data.targetElement
)
)
{
$scope.addMenu(data.scope);
}
}
}
);
$document.on(
'click', function () {
if ($scope.isActive()) {
$scope.$apply(function () {
$scope.hideAll();
});
}
}
);
$document.on(
'keydown keypress paste', function (event) {
var activeMenuScope = $scope.getActiveMenuScope();
if (activeMenuScope) {
if (event.which === 9 || event.which === 13) {
event.preventDefault();
activeMenuScope.selectActive();
}
if (event.which === 27) {
event.preventDefault();
activeMenuScope.$apply(function () {
activeMenuScope.hideMenu();
});
}
if (event.which === 40) {
event.preventDefault();
activeMenuScope.$apply(function () {
activeMenuScope.activateNextItem();
});
activeMenuScope.adjustScroll(1);
}
if (event.which === 38) {
event.preventDefault();
activeMenuScope.$apply(function () {
activeMenuScope.activatePreviousItem();
});
activeMenuScope.adjustScroll(-1);
}
if (event.which === 37 || event.which === 39) {
event.preventDefault();
}
}
}
);
}],
link: function (scope, element, attrs, $timeout) {
scope.triggerCharMap = {};
scope.targetElement = element;
scope.scrollBarParents = element.parents().filter(function() {
var overflow = angular.element(this).css("overflow");
return this.scrollHeight > this.clientHeight && overflow !== "hidden" && overflow !== "visible";
});
scope.scrollPosition = null;
attrs.$set('autocomplete','off');
if (attrs.mentioItems) {
scope.localItems = [];
scope.parentScope = scope;
var itemsRef = attrs.mentioSearch ? ' mentio-items="items"' : ' mentio-items="localItems"';
scope.defaultTriggerChar = attrs.mentioTriggerChar ? scope.$eval(attrs.mentioTriggerChar) : '@';
var html = '<mentio-menu' +
' mentio-search="bridgeSearch(term)"' +
' mentio-select="bridgeSelect(item)"' +
itemsRef;
if (attrs.mentioTemplateUrl) {
html = html + ' mentio-template-url="' + attrs.mentioTemplateUrl + '"';
}
html = html + ' mentio-trigger-char="\'' + scope.defaultTriggerChar + '\'"' +
' mentio-parent-scope="parentScope"' +
'/>';
var linkFn = $compile(html);
var el = linkFn(scope);
element.parent().append(el);
scope.$on('$destroy', function() {
el.remove();
});
}
if (attrs.mentioTypedTerm) {
scope.syncTriggerText = true;
}
function keyHandler(event) {
function stopEvent(event) {
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
}
var activeMenuScope = scope.getActiveMenuScope();
if (activeMenuScope) {
if (event.which === 9 || event.which === 13) {
stopEvent(event);
activeMenuScope.selectActive();
return false;
}
if (event.which === 27) {
stopEvent(event);
activeMenuScope.$apply(function () {
activeMenuScope.hideMenu();
});
return false;
}
if (event.which === 40) {
stopEvent(event);
activeMenuScope.$apply(function () {
activeMenuScope.activateNextItem();
});
activeMenuScope.adjustScroll(1);
return false;
}
if (event.which === 38) {
stopEvent(event);
activeMenuScope.$apply(function () {
activeMenuScope.activatePreviousItem();
});
activeMenuScope.adjustScroll(-1);
return false;
}
if (event.which === 37 || event.which === 39) {
stopEvent(event);
return false;
}
}
}
scope.$watch(
'iframeElement', function(newValue) {
if (newValue) {
var iframeDocument = newValue.contentWindow.document;
iframeDocument.addEventListener('click',
function () {
if (scope.isActive()) {
scope.$apply(function () {
scope.hideAll();
});
}
}
);
iframeDocument.addEventListener('keydown', keyHandler, true );
scope.$on ( '$destroy', function() {
iframeDocument.removeEventListener ( 'keydown', keyHandler );
});
}
}
);
scope.$watch(
'ngModel',
function (newValue) {
if ((!newValue || newValue === '') && !scope.isActive()) {
return;
}
if (scope.triggerCharSet === undefined) {
$log.warn('Error, no mentio-items attribute was provided, ' +
'and no separate mentio-menus were specified.  Nothing to do.');
return;
}
if (scope.contentEditableMenuPasted) {
scope.contentEditableMenuPasted = false;
return;
}
if (scope.replacingMacro) {
$timeout.cancel(scope.timer);
scope.replacingMacro = false;
}
var isActive = scope.isActive();
var isContentEditable = scope.isContentEditable();
var mentionInfo = mentioUtil.getTriggerInfo(scope.context(), scope.triggerCharSet,
scope.requireLeadingSpace, isActive);
if (mentionInfo !== undefined &&
(
!isActive ||
(isActive &&
(
(isContentEditable && mentionInfo.mentionTriggerChar ===
scope.currentMentionTriggerChar) ||
(!isContentEditable && mentionInfo.mentionPosition ===
scope.currentMentionPosition)
)
)
)
)
{
if (mentionInfo.mentionSelectedElement) {
scope.targetElement = mentionInfo.mentionSelectedElement;
scope.targetElementPath = mentionInfo.mentionSelectedPath;
scope.targetElementSelectedOffset = mentionInfo.mentionSelectedOffset;
}
scope.setTriggerText(mentionInfo.mentionText);
scope.currentMentionPosition = mentionInfo.mentionPosition;
scope.currentMentionTriggerChar = mentionInfo.mentionTriggerChar;
scope.query(mentionInfo.mentionTriggerChar, mentionInfo.mentionText);
} else {
var currentTypedTerm = scope.typedTerm;
scope.setTriggerText('');
scope.hideAll();
var macroMatchInfo = mentioUtil.getMacroMatch(scope.context(), scope.macros);
if (macroMatchInfo !== undefined) {
scope.targetElement = macroMatchInfo.macroSelectedElement;
scope.targetElementPath = macroMatchInfo.macroSelectedPath;
scope.targetElementSelectedOffset = macroMatchInfo.macroSelectedOffset;
scope.replaceMacro(macroMatchInfo.macroText, macroMatchInfo.macroHasTrailingSpace);
} else if (scope.selectNotFound && currentTypedTerm && currentTypedTerm !== '') {
var lastScope = scope.triggerCharMap[scope.currentMentionTriggerChar];
if (lastScope) {
var text = lastScope.select({
item: {label: currentTypedTerm}
});
if (typeof text.then === 'function') {
text.then(scope.replaceText);
} else {
scope.replaceText(text, true);
}
}
}
}
}
);
}
};
}])
.directive('mentioMenu', ['mentioUtil', '$rootScope', '$log', '$window', '$document', '$timeout',
function (mentioUtil, $rootScope, $log, $window, $document, $timeout) {
return {
restrict: 'E',
scope: {
search: '&mentioSearch',
select: '&mentioSelect',
items: '=mentioItems',
triggerChar: '=mentioTriggerChar',
forElem: '=mentioFor',
parentScope: '=mentioParentScope'
},
templateUrl: function(tElement, tAttrs) {
return tAttrs.mentioTemplateUrl !== undefined ? tAttrs.mentioTemplateUrl : 'mentio-menu.tpl.html';
},
controller: ["$scope", function ($scope) {
$scope.visible = false;
this.activate = $scope.activate = function (item) {
$scope.activeItem = item;
};
this.isActive = $scope.isActive = function (item) {
return $scope.activeItem === item;
};
this.selectItem = $scope.selectItem = function (item) {
if (item.termLengthIsZero) {
item.name = $scope.triggerChar + $scope.typedTerm
}
var text = $scope.select({
item: item
});
if (typeof text.then === 'function') {
text.then($scope.parentMentio.replaceText);
} else {
$scope.parentMentio.replaceText(text);
}
};
$scope.activateNextItem = function () {
var index = $scope.items.indexOf($scope.activeItem);
this.activate($scope.items[(index + 1) % $scope.items.length]);
};
$scope.activatePreviousItem = function () {
var index = $scope.items.indexOf($scope.activeItem);
this.activate($scope.items[index === 0 ? $scope.items.length - 1 : index - 1]);
};
$scope.isFirstItemActive = function () {
var index = $scope.items.indexOf($scope.activeItem);
return index === 0;
};
$scope.isLastItemActive = function () {
var index = $scope.items.indexOf($scope.activeItem);
return index === ($scope.items.length - 1);
};
$scope.selectActive = function () {
$scope.selectItem($scope.activeItem);
};
$scope.isVisible = function () {
return $scope.visible;
};
$scope.showMenu = function () {
if (!$scope.visible) {
$scope.menuElement.css("visibility", "visible");
$scope.requestVisiblePendingSearch = true;
}
};
$scope.setParent = function (scope) {
$scope.parentMentio = scope;
$scope.targetElement = scope.targetElement;
};
var scopeDuplicate = $scope;
$rootScope.$on('mentio.closeMenu', function () {
scopeDuplicate.hideMenu();
})
}],
link: function (scope, element) {
element[0].parentNode.removeChild(element[0]);
$document[0].body.appendChild(element[0]);
scope.menuElement = element;
scope.menuElement.css("visibility", "hidden");
if (scope.parentScope) {
scope.parentScope.addMenu(scope);
} else {
if (!scope.forElem) {
$log.error('mentio-menu requires a target element in tbe mentio-for attribute');
return;
}
if (!scope.triggerChar) {
$log.error('mentio-menu requires a trigger char');
return;
}
$rootScope.$broadcast('menuCreated',
{
targetElement : scope.forElem,
scope : scope
});
}
angular.element($window).bind(
'resize', function () {
if (scope.isVisible()) {
var triggerCharSet = [];
triggerCharSet.push(scope.triggerChar);
mentioUtil.popUnderMention(scope.parentMentio.context(),
triggerCharSet, element, scope.requireLeadingSpace);
}
}
);
scope.$watch('items', function (items) {
if (items && items.length > 0) {
scope.activate(items[0]);
if (!scope.visible && scope.requestVisiblePendingSearch) {
scope.visible = true;
scope.requestVisiblePendingSearch = false;
}
$timeout(function() {
var menu = element.find(".dropdown-menu");
if(menu.length > 0 && menu.offset().top < 0)
menu.addClass("reverse");
}, 0, false);
} else {
scope.activate({
termLengthIsZero: true
});
}
});
scope.$watch('isVisible()', function (visible) {
if (visible) {
var triggerCharSet = [];
triggerCharSet.push(scope.triggerChar);
mentioUtil.popUnderMention(scope.parentMentio.context(),
triggerCharSet, element, scope.requireLeadingSpace);
} else {
element.find(".dropdown-menu").removeClass("reverse");
}
});
var prevScroll;
scope.parentMentio.scrollBarParents.each(function() {
angular.element(this).on("scroll.mentio", function() {
if (!prevScroll)
prevScroll = this.scrollTop;
var scrollDiff = prevScroll - this.scrollTop;
prevScroll = this.scrollTop;
if (element[0].style["position"] === "absolute") {
element[0].style["z-index"] = 9;
element[0].style.top = (parseInt(element[0].style.top) + scrollDiff) + "px";
}
});
});
scope.parentMentio.$on('$destroy', function () {
element.remove();
});
scope.hideMenu = function () {
scope.visible = false;
element.css('display', 'none');
};
scope.adjustScroll = function (direction) {
var menuEl = element[0];
var menuItemsList = menuEl.querySelector('ul');
var menuItem = menuEl.querySelector('[mentio-menu-item].active');
if (scope.isFirstItemActive()) {
return menuItemsList.scrollTop = 0;
} else if(scope.isLastItemActive()) {
return menuItemsList.scrollTop = menuItemsList.scrollHeight;
}
if (direction === 1) {
menuItemsList.scrollTop += menuItem.offsetHeight;
} else {
menuItemsList.scrollTop -= menuItem.offsetHeight;
}
};
}
};
}])
.directive('mentioMenuItem', function () {
return {
restrict: 'A',
scope: {
item: '=mentioMenuItem'
},
require: '^mentioMenu',
link: function (scope, element, attrs, controller) {
scope.$watch(function () {
return controller.isActive(scope.item);
}, function (active) {
if (active) {
element.addClass('active');
} else {
element.removeClass('active');
}
});
element.bind('mouseenter', function () {
scope.$apply(function () {
controller.activate(scope.item);
});
});
element.bind('click', function () {
controller.selectItem(scope.item);
return false;
});
}
};
})
.filter('unsafe', ["$sce", function($sce) {
return function (val) {
return $sce.trustAsHtml(val);
};
}])
.filter('mentioHighlight', function() {
function escapeRegexp (queryToEscape) {
return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
}
return function (matchItem, query, hightlightClass) {
if (query) {
var replaceText = hightlightClass ?
'<span class="' + hightlightClass + '">$&</span>' :
'<strong>$&</strong>';
return ('' + matchItem).replace(new RegExp(escapeRegexp(query), 'gi'), replaceText);
} else {
return matchItem;
}
};
});
'use strict';
angular.module('mentio')
.factory('mentioUtil', ["$window", "$location", "$anchorScroll", "$timeout", function ($window, $location, $anchorScroll, $timeout) {
function popUnderMention (ctx, triggerCharSet, selectionEl, requireLeadingSpace) {
var coordinates;
var mentionInfo = getTriggerInfo(ctx, triggerCharSet, requireLeadingSpace, false);
if (mentionInfo !== undefined) {
if (selectedElementIsTextAreaOrInput(ctx)) {
coordinates = getTextAreaOrInputUnderlinePosition(ctx, getDocument(ctx).activeElement,
mentionInfo.mentionPosition);
} else {
coordinates = getContentEditableCaretPosition(ctx, mentionInfo.mentionPosition);
}
selectionEl.css({
top: coordinates.top + 'px',
left: coordinates.left + 'px',
position: 'absolute',
zIndex: 5000,
display: 'block'
});
$timeout(function(){
scrollIntoView(ctx, selectionEl);
},0);
} else {
selectionEl.css({
display: 'none'
});
}
}
function scrollIntoView(ctx, elem)
{
var reasonableBuffer = 20;
var maxScrollDisplacement = 100;
var clientRect;
var e = elem[0];
while (clientRect === undefined || clientRect.height === 0) {
clientRect = e.getBoundingClientRect();
if (clientRect.height === 0) {
e = e.childNodes[0];
if (e === undefined || !e.getBoundingClientRect) {
return;
}
}
}
var elemTop = clientRect.top;
var elemBottom = elemTop + clientRect.height;
if(elemTop < 0) {
$window.scrollTo(0, $window.pageYOffset + clientRect.top - reasonableBuffer);
} else if (elemBottom > $window.innerHeight) {
var maxY = $window.pageYOffset + clientRect.top - reasonableBuffer;
if (maxY - $window.pageYOffset > maxScrollDisplacement) {
maxY = $window.pageYOffset + maxScrollDisplacement;
}
var targetY = $window.pageYOffset - ($window.innerHeight - elemBottom);
if (targetY > maxY) {
targetY = maxY;
}
$window.scrollTo(0, targetY);
}
}
function selectedElementIsTextAreaOrInput (ctx) {
var element = getDocument(ctx).activeElement;
if (element !== null) {
var nodeName = element.nodeName;
var type = element.getAttribute('type');
return (nodeName === 'INPUT' && type === 'text') || nodeName === 'TEXTAREA';
}
return false;
}
function selectElement (ctx, targetElement, path, offset) {
var range;
var elem = targetElement;
if (path) {
for (var i = 0; i < path.length; i++) {
elem = elem.childNodes[path[i]];
if (elem === undefined) {
return;
}
while (elem.length < offset) {
offset -= elem.length;
elem = elem.nextSibling;
}
if (elem.childNodes.length === 0 && !elem.length) {
elem = elem.previousSibling;
}
}
}
var sel = getWindowSelection(ctx);
range = getDocument(ctx).createRange();
range.setStart(elem, offset);
range.setEnd(elem, offset);
range.collapse(true);
try{sel.removeAllRanges();}catch(error){}
sel.addRange(range);
targetElement.focus();
}
function pasteHtml (ctx, html, startPos, endPos) {
var range, sel;
sel = getWindowSelection(ctx);
range = getDocument(ctx).createRange();
range.setStart(sel.anchorNode, startPos);
range.setEnd(sel.anchorNode, endPos);
range.deleteContents();
var el = getDocument(ctx).createElement('div');
el.innerHTML = html;
var frag = getDocument(ctx).createDocumentFragment(),
node, lastNode;
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node);
}
range.insertNode(frag);
if (lastNode) {
range = range.cloneRange();
range.setStartAfter(lastNode);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
}
}
function resetSelection (ctx, targetElement, path, offset) {
var nodeName = targetElement.nodeName;
if (nodeName === 'INPUT' || nodeName === 'TEXTAREA') {
if (targetElement !== getDocument(ctx).activeElement) {
targetElement.focus();
}
} else {
selectElement(ctx, targetElement, path, offset);
}
}
function replaceMacroText (ctx, targetElement, path, offset, macros, text) {
resetSelection(ctx, targetElement, path, offset);
var macroMatchInfo = getMacroMatch(ctx, macros);
if (macroMatchInfo.macroHasTrailingSpace) {
macroMatchInfo.macroText = macroMatchInfo.macroText + '\xA0';
text = text + '\xA0';
}
if (macroMatchInfo !== undefined) {
var element = getDocument(ctx).activeElement;
if (selectedElementIsTextAreaOrInput(ctx)) {
var startPos = macroMatchInfo.macroPosition;
var endPos = macroMatchInfo.macroPosition + macroMatchInfo.macroText.length;
element.value = element.value.substring(0, startPos) + text +
element.value.substring(endPos, element.value.length);
element.selectionStart = startPos + text.length;
element.selectionEnd = startPos + text.length;
} else {
pasteHtml(ctx, text, macroMatchInfo.macroPosition,
macroMatchInfo.macroPosition + macroMatchInfo.macroText.length);
}
}
}
function replaceTriggerText (ctx, targetElement, path, offset, triggerCharSet,
text, requireLeadingSpace, hasTrailingSpace, suppressTrailingSpace) {
resetSelection(ctx, targetElement, path, offset);
var mentionInfo = getTriggerInfo(ctx, triggerCharSet, requireLeadingSpace, true, hasTrailingSpace);
if (mentionInfo !== undefined) {
if (selectedElementIsTextAreaOrInput()) {
var myField = getDocument(ctx).activeElement;
if (!suppressTrailingSpace) {
text = text + ' ';
}
var startPos = mentionInfo.mentionPosition;
var endPos = mentionInfo.mentionPosition + mentionInfo.mentionText.length + 1;
myField.value = myField.value.substring(0, startPos) + text +
myField.value.substring(endPos, myField.value.length);
myField.selectionStart = startPos + text.length;
myField.selectionEnd = startPos + text.length;
} else {
if (!suppressTrailingSpace) {
text = text + '\xA0';
}
pasteHtml(ctx, text, mentionInfo.mentionPosition,
mentionInfo.mentionPosition + mentionInfo.mentionText.length + 1);
}
}
}
function getNodePositionInParent (ctx, elem) {
if (elem.parentNode === null) {
return 0;
}
for (var i = 0; i < elem.parentNode.childNodes.length; i++) {
var node = elem.parentNode.childNodes[i];
if (node === elem) {
return i;
}
}
}
function getMacroMatch (ctx, macros) {
var selected, path = [], offset;
if (selectedElementIsTextAreaOrInput(ctx)) {
selected = getDocument(ctx).activeElement;
} else {
var selectionInfo = getContentEditableSelectedPath(ctx);
if (selectionInfo) {
selected = selectionInfo.selected;
path = selectionInfo.path;
offset = selectionInfo.offset;
}
}
var effectiveRange = getTextPrecedingCurrentSelection(ctx);
if (effectiveRange !== undefined && effectiveRange !== null) {
var matchInfo;
var hasTrailingSpace = false;
if (effectiveRange.length > 0 &&
(effectiveRange.charAt(effectiveRange.length - 1) === '\xA0' ||
effectiveRange.charAt(effectiveRange.length - 1) === ' ')) {
hasTrailingSpace = true;
effectiveRange = effectiveRange.substring(0, effectiveRange.length-1);
}
angular.forEach(macros, function (macro, c) {
var idx = effectiveRange.toUpperCase().lastIndexOf(c.toUpperCase());
if (idx >= 0 && c.length + idx === effectiveRange.length) {
var prevCharPos = idx - 1;
if (idx === 0 || effectiveRange.charAt(prevCharPos) === '\xA0' ||
effectiveRange.charAt(prevCharPos) === ' ' ) {
matchInfo = {
macroPosition: idx,
macroText: c,
macroSelectedElement: selected,
macroSelectedPath: path,
macroSelectedOffset: offset,
macroHasTrailingSpace: hasTrailingSpace
};
}
}
});
if (matchInfo) {
return matchInfo;
}
}
}
function getContentEditableSelectedPath(ctx) {
var sel = getWindowSelection(ctx);
var selected = sel.anchorNode;
var path = [];
var offset;
if (selected != null) {
var i;
var ce = selected.contentEditable;
while (selected !== null && ce !== 'true') {
i = getNodePositionInParent(ctx, selected);
path.push(i);
selected = selected.parentNode;
if (selected !== null) {
ce = selected.contentEditable;
}
}
path.reverse();
offset = sel.getRangeAt(0).startOffset;
return {
selected: selected,
path: path,
offset: offset
};
}
}
function getTriggerInfo (ctx, triggerCharSet, requireLeadingSpace, menuAlreadyActive, hasTrailingSpace) {
var selected, path, offset;
if (selectedElementIsTextAreaOrInput(ctx)) {
selected = getDocument(ctx).activeElement;
} else {
var selectionInfo = getContentEditableSelectedPath(ctx);
if (selectionInfo) {
selected = selectionInfo.selected;
path = selectionInfo.path;
offset = selectionInfo.offset;
}
}
var effectiveRange = getTextPrecedingCurrentSelection(ctx);
if (effectiveRange !== undefined && effectiveRange !== null) {
var mostRecentTriggerCharPos = -1;
var triggerChar;
triggerCharSet.forEach(function(c) {
var idx = effectiveRange.lastIndexOf(c);
if (idx > mostRecentTriggerCharPos) {
mostRecentTriggerCharPos = idx;
triggerChar = c;
}
});
if (mostRecentTriggerCharPos >= 0 &&
(
mostRecentTriggerCharPos === 0 ||
!requireLeadingSpace ||
/[\xA0\s]/g.test
(
effectiveRange.substring(
mostRecentTriggerCharPos - 1,
mostRecentTriggerCharPos)
)
)
)
{
var currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + 1,
effectiveRange.length);
triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos+1);
var firstSnippetChar = currentTriggerSnippet.substring(0,1);
var leadingSpace = currentTriggerSnippet.length > 0 &&
(
firstSnippetChar === ' ' ||
firstSnippetChar === '\xA0'
);
if (hasTrailingSpace) {
currentTriggerSnippet = currentTriggerSnippet.trim();
}
if (!leadingSpace && (menuAlreadyActive || !(/[\xA0\s]/g.test(currentTriggerSnippet)))) {
return {
mentionPosition: mostRecentTriggerCharPos,
mentionText: currentTriggerSnippet,
mentionSelectedElement: selected,
mentionSelectedPath: path,
mentionSelectedOffset: offset,
mentionTriggerChar: triggerChar
};
}
}
}
}
function getWindowSelection(ctx) {
if (!ctx) {
return window.getSelection();
} else {
return ctx.iframe.contentWindow.getSelection();
}
}
function getDocument(ctx) {
if (!ctx) {
return document;
} else {
return ctx.iframe.contentWindow.document;
}
}
function getTextPrecedingCurrentSelection (ctx) {
var text;
if (selectedElementIsTextAreaOrInput(ctx)) {
var textComponent = getDocument(ctx).activeElement;
var startPos = textComponent.selectionStart;
text = textComponent.value.substring(0, startPos);
} else {
var selectedElem = getWindowSelection(ctx).anchorNode;
if (selectedElem != null) {
var workingNodeContent = selectedElem.textContent;
var selectStartOffset = getWindowSelection(ctx).getRangeAt(0).startOffset;
if (selectStartOffset >= 0) {
text = workingNodeContent.substring(0, selectStartOffset);
}
}
}
return text;
}
function getContentEditableCaretPosition (ctx, selectedNodePosition) {
var markerTextChar = '\ufeff';
var markerEl, markerId = 'sel_' + new Date().getTime() + '_' + Math.random().toString().substr(2);
var range;
var sel = getWindowSelection(ctx);
var prevRange = sel.getRangeAt(0);
range = getDocument(ctx).createRange();
range.setStart(sel.anchorNode, selectedNodePosition);
range.setEnd(sel.anchorNode, selectedNodePosition);
range.collapse(false);
markerEl = getDocument(ctx).createElement('span');
markerEl.id = markerId;
markerEl.appendChild(getDocument(ctx).createTextNode(markerTextChar));
range.insertNode(markerEl);
sel.removeAllRanges();
sel.addRange(prevRange);
var coordinates = {
left: 0,
top: markerEl.offsetHeight
};
localToGlobalCoordinates(ctx, markerEl, coordinates);
markerEl.parentNode.removeChild(markerEl);
return coordinates;
}
function localToGlobalCoordinates(ctx, element, coordinates) {
var obj = element;
var iframe = ctx ? ctx.iframe : null;
while(obj) {
coordinates.left += obj.offsetLeft;
coordinates.top += obj.offsetTop;
if (obj !== getDocument().body) {
coordinates.top -= obj.scrollTop;
coordinates.left -= obj.scrollLeft;
}
obj = obj.offsetParent;
if (!obj && iframe) {
obj = iframe;
iframe = null;
}
}
}
function getTextAreaOrInputUnderlinePosition (ctx, element, position) {
var properties = [
'direction',
'boxSizing',
'width',
'height',
'overflowX',
'overflowY',
'borderTopWidth',
'borderRightWidth',
'borderBottomWidth',
'borderLeftWidth',
'paddingTop',
'paddingRight',
'paddingBottom',
'paddingLeft',
'fontStyle',
'fontVariant',
'fontWeight',
'fontStretch',
'fontSize',
'fontSizeAdjust',
'lineHeight',
'fontFamily',
'textAlign',
'textTransform',
'textIndent',
'textDecoration',
'letterSpacing',
'wordSpacing'
];
var isFirefox = (window.mozInnerScreenX !== null);
var div = getDocument(ctx).createElement('div');
div.id = 'input-textarea-caret-position-mirror-div';
getDocument(ctx).body.appendChild(div);
var style = div.style;
var computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle;
style.whiteSpace = 'pre-wrap';
if (element.nodeName !== 'INPUT') {
style.wordWrap = 'break-word';
}
style.position = 'absolute';
style.visibility = 'hidden';
properties.forEach(function (prop) {
style[prop] = computed[prop];
});
if (isFirefox) {
style.width = (parseInt(computed.width) - 2) + 'px';
if (element.scrollHeight > parseInt(computed.height))
style.overflowY = 'scroll';
} else {
style.overflow = 'hidden';
}
div.textContent = element.value.substring(0, position);
if (element.nodeName === 'INPUT') {
div.textContent = div.textContent.replace(/\s/g, '\u00a0');
}
var span = getDocument(ctx).createElement('span');
span.textContent = element.value.substring(position) || '.';
div.appendChild(span);
var coordinates = {
top: span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize),
left: span.offsetLeft + parseInt(computed.borderLeftWidth)
};
localToGlobalCoordinates(ctx, element, coordinates);
getDocument(ctx).body.removeChild(div);
return coordinates;
}
return {
popUnderMention: popUnderMention,
replaceMacroText: replaceMacroText,
replaceTriggerText: replaceTriggerText,
getMacroMatch: getMacroMatch,
getTriggerInfo: getTriggerInfo,
selectElement: selectElement,
getTextAreaOrInputUnderlinePosition: getTextAreaOrInputUnderlinePosition,
getTextPrecedingCurrentSelection: getTextPrecedingCurrentSelection,
getContentEditableSelectedPath: getContentEditableSelectedPath,
getNodePositionInParent: getNodePositionInParent,
getContentEditableCaretPosition: getContentEditableCaretPosition,
pasteHtml: pasteHtml,
resetSelection: resetSelection,
scrollIntoView: scrollIntoView
};
}]);
angular.module("mentio").run(["$templateCache", function($templateCache) {$templateCache.put("mentio-menu.tpl.html","<style>\n.scrollable-menu {\n    height: auto;\n    max-height: 300px;\n    overflow: auto;\n}\n\n.menu-highlighted {\n    font-weight: bold;\n}\n</style>\n<ul class=\"dropdown-menu scrollable-menu\" style=\"display:block\">\n    <li mentio-menu-item=\"item\" ng-repeat=\"item in items track by $index\">\n        <a class=\"text-primary\" ng-bind-html=\"item.label | mentioHighlight:typedTerm:\'menu-highlighted\' | unsafe\"></a>\n    </li>\n</ul>");}]);
})();
;
/*! RESOURCE: /scripts/sn/common/stream/_module.js */
(function() {
var moduleDeps = [ 'sn.base', 'ng.amb', 'sn.messaging', 'sn.common.glide', 'ngSanitize',
'sn.common.avatar', 'sn.common.ui.popover', 'mentio', 'sn.common.controls', 'sn.common.user_profile',
'sn.common.datetime', 'sn.common.mention', 'sn.common.ui', 'sn.common.dynamicTranslation'];
if (angular.version.major == 1 && angular.version.minor >= 3)
moduleDeps.push('ngAria');
angular.module("sn.common.stream", moduleDeps);
angular.module("sn.stream.direct", [ 'sn.common.stream']);
})();
;
/*! RESOURCE: /scripts/sn/common/stream/controller.Stream.js */
angular.module("sn.common.stream").controller("Stream", function($rootScope, $scope, snRecordWatcher, $timeout) {
var isForm = NOW.sysId.length > 0;
$scope.showCommentsAndWorkNotes = isForm;
$scope.sessions = {};
$scope.recordStreamOpen = false;
$scope.streamHidden = true;
$scope.recordSysId = '';
$scope.recordDisplayValue = '';
$rootScope.$on('sn.sessions', onSessions);
$timeout(function() {
var query = isForm
? "sys_id=" + NOW.sysId
: NOW.tableQuery || "sys_idISNOTEMPTY";
snRecordWatcher.initChannel(NOW.targetTable, query, function(message) {
$rootScope.$broadcast("sn.stream.tap", message.data);
});
}, 100);
$scope.controls = {
showRecord : function($event, entry, sysId) {
if (sysId !== '')
return;
if ($event.currentTarget != $event.target && $event.target.tagName == 'A')
return;
$scope.recordSysId = entry.document_id;
$scope.recordDisplayValue = entry.display_value;
$scope.recordStreamOpen = true;
$scope.streamHidden = true;
},
openRecord : function() {
var targetFrame = window.self;
var url = NOW.targetTable + ".do?sys_id=" + $scope.recordSysId;
if (NOW.linkTarget == 'form_pane') {
url += "&sysparm_clear_stack=true";
window.parent.CustomEvent.fireTop(
"glide:nav_open_url", {
url : url,
openInForm : true
});
return;
}
if (NOW.streamLinkTarget == 'parent' || NOW.concourse == 'true')
targetFrame = window.parent;
targetFrame.location = url;
}
};
$scope.sessionCount = function() {
$scope.sessions.length = Object.keys($scope.sessions.data).length;
return $scope.sessions.length;
};
function onSessions(name, sessions) {
$scope.sessions.data = sessions;
$scope.sessionCount();
}
$scope.toggleEmailIframe = function(email, event){
email.expanded = !email.expanded;
event.preventDefault();
};
$scope.showListStream = function () {
$scope.recordStreamOpen = false;
$scope.recordHidden = false;
$scope.streamHidden = false;
angular.element('div.list-stream-record').velocity('snTransition.streamSlideRight', {
duration: 400
});
angular.element('[streamType="list"]').velocity('snTransition.slideIn', {
duration: 400,
complete: function (element) {
angular.element(element).css({display: 'block'});
}
});
};
$scope.$watch(function () {
return angular.element('div.list-stream-record').length
}, function (newValue, oldValue) {
if (newValue == 1) {
angular.element('div.list-stream-record').delay(100).velocity('snTransition.streamSlideLeft', {
begin: function (element) {
angular.element(element).css({visibility: 'visible'});
angular.element('.list-stream-record-header').css({visibility: 'visible'});
},
duration: 400,
complete: function (element) {
angular.element(element).css({transform: "translateX(0)"});
angular.element(element).scrollTop(0);
angular.element(element).css({transform: "initial"});
angular.element('.return-to-stream').focus();
}
});
}
});
});
;
/*! RESOURCE: /scripts/sn/common/stream/controller.snStream.js */
angular.module("sn.common.stream").controller("snStream", function($rootScope, $scope, $attrs, $http, nowStream, snRecordPresence, snCustomEvent, userPreferences, $window, $q, $timeout, $sce, snMention, i18n, getTemplateUrl, $injector, dynamicTranslation) {
"use strict";
if (angular.isDefined($attrs.isInline)) {
bindInlineStreamAttributes();
}
var globalMembers = NOW.recordMembers || {};
function putGlobalMember(sysId, name, initials, avatar) {
if (!sysId || !name || !initials)
return;
if (!globalMembers[sysId]) {
globalMembers[sysId] = {
"name": name,
"initials": initials,
"sys_id": sysId,
"record_is_visible": true,
"avatar": avatar
};
return;
}
if ((globalMembers[sysId].avatar === undefined || globalMembers[sysId].avatar === "") && avatar)
globalMembers[sysId].avatar = avatar;
}
function getMembersFromPageContext(members, term) {
var matching = [], matchingSysIds = [];
var memberKeys = Object.keys(globalMembers);
term = term.toLowerCase().trim();
memberKeys.forEach(function(sysId) {
var member = globalMembers[sysId];
if ((typeof member.name !== "undefined" && member.name.toLowerCase().indexOf(term) == 0) || (typeof member.last_name !== "undefined" && member.last_name.toLowerCase().indexOf(term) == 0)) {
matching.push(member);
matchingSysIds.push(sysId);
}
});
members.forEach(function(member) {
if (globalMembers[member.sys_id] && globalMembers[member.sys_id].avatar === undefined)
globalMembers[member.sys_id].avatar = member.avatar;
if (matchingSysIds.indexOf(member.sys_id) === -1)
matching.push(member);
});
return matching;
}
function bindInlineStreamAttributes() {
var streamAttributes = {};
if ($attrs.table) {
streamAttributes.table = $attrs.table;
}
if ($attrs.query) {
streamAttributes.query = $attrs.query;
}
if ($attrs.sysId) {
streamAttributes.sysId = $attrs.sysId;
}
if ($attrs.active) {
streamAttributes.active = ($attrs.active == "true");
}
if ($attrs.template) {
streamAttributes.template = $attrs.template;
}
if ($attrs.preferredInput) {
streamAttributes.preferredInput = $attrs.preferredInput;
}
if ($attrs.useMultipleInputs) {
streamAttributes.useMultipleInputs = ($attrs.useMultipleInputs == "true");
}
if ($attrs.expandEntries) {
streamAttributes.expandEntries = ($attrs.expandEntries == "true");
}
if ($attrs.pageSize) {
streamAttributes.pageSize = parseInt($attrs.pageSize, 10);
}
if ($attrs.truncate) {
streamAttributes.truncate = ($attrs.truncate == "true");
}
if ($attrs.attachments) {
streamAttributes.attachments = ($attrs.attachments == "true");
}
if ($attrs.showCommentsAndWorkNotes) {
streamAttributes.attachments = ($attrs.showCommentsAndWorkNotes == "true");
}
angular.extend($scope, streamAttributes)
}
var stream;
var processor = $attrs.processor || "list_history";
var interval;
var FROM_LIST = 'from_list';
var FROM_FORM = 'from_form';
var source = $scope.sysId ? FROM_FORM : FROM_LIST;
var _firstPoll = true;
var _firstPollTimeout;
var fieldsInitialized = false;
var primaryJournalFieldOrder = ["comments", "work_notes"];
var primaryJournalField = null;
$scope.defaultShowCommentsAndWorkNotes = ($scope.sysId != null && !angular.isUndefined($scope.sysId) && $scope.sysId.length > 0);
$scope.canWriteWorkNotes = false;
$scope.inputTypeValue = "";
$scope.entryTemplate = getTemplateUrl($attrs.template || "list_stream_entry");
$scope.isFormStream = $attrs.template === "record_stream_entry.xml";
$scope.allFields = null;
$scope.fields = {};
$scope.fieldColor = "transparent";
$scope.multipleInputs = $scope.useMultipleInputs;
$scope.checkbox = {};
$scope.attachmentAdviceRequired = $window.NOW.attachmentAdviceRequired;
var infectedAttachmnentMsg = "The file {0} did not pass security scan and cannot be downloaded";
i18n.getMessage(infectedAttachmnentMsg, function(message) {
infectedAttachmnentMsg = message;
});
var typing = '{0} is typing', viewing = '{0} is viewing', entered = '{0} has entered';
var probablyLeft = '{0} has probably left', exited = '{0} has exited', offline = '{0} is offline', auditMessage = '{0} was {1}', was ="was";
i18n.getMessages(
[
typing,
viewing,
entered,
probablyLeft,
exited,
offline,
was,
auditMessage
],
function (results) {
typing = results[typing];
viewing = results[viewing];
entered = results[entered];
probablyLeft = results[probablyLeft];
exited = results[exited];
offline = results[offline];
was = results[was];
$scope.auditMessageParts = buildAuditMessageParts(results[auditMessage],was);
}
);
function buildAuditMessageParts(auditMessage, was) {
var tMessagePattern = /^([^{]*)\{([01])\}([^{]*)\{([01])\}(.*)$/;
var messageParts = tMessagePattern.exec(auditMessage);
var auditMessageParts = messageParts ?
{
prefix: messageParts[1].trim(),
newValPosition: messageParts[2],
middle: messageParts[3].trim(),
oldValPosition: messageParts[4],
postfix: messageParts[5].trim()
} :
{
prefix: '',
newValPosition: "0",
middle: was,
oldValPosition: "1",
postfix: ''
};
return auditMessageParts;
}
$scope.parsePresence = function (sessionData) {
var status = sessionData.status;
var name = sessionData.user_display_name;
switch (status) {
case 'typing':
return i18n.format(typing, name);
case 'viewing':
return i18n.format(viewing, name);
case 'entered':
return i18n.format(entered, name);
case 'probably left':
return i18n.format(probablyLeft, name);
case 'exited':
return i18n.format(exited, name);
case 'offline':
return i18n.format(offline, name);
default:
return '';
}
};
$scope.members = [];
$scope.members.loading = true;
var mentionMap = {};
$scope.selectAtMention = function(item) {
if(item.termLengthIsZero)
return (item.name || "") + "\n";
mentionMap[item.name] = item.sys_id;
return "@[" + item.name + "]";
};
var typingTimer;
$scope.searchMembersAsync = function(term) {
$scope.members = getMembersFromPageContext([], term);
$scope.members.loading = true;
$timeout.cancel(typingTimer);
if (term.length === 0) {
$scope.members = [{
termLengthIsZero: true
}];
$scope.members.loading = false;
} else {
typingTimer = $timeout(function() {
snMention.retrieveMembers($scope.table, $scope.sysId, term).then(function(members) {
$scope.members = getMembersFromPageContext(members, term);
$scope.members.loading = false;
}, function () {
$scope.members = getMembersFromPageContext([{
termLengthIsZero: true
}], term);
$scope.members.loading = false;
});
}, 500);
}
};
$scope.expandMentions = function(text) {
return stream.expandMentions(text, mentionMap)
};
$scope.reduceMentions = function(text) {
if(!text)
return text;
var regexMentionParts = /[@\w\d\s/\']+/gi;
text = text.replace(/@\[[\w\d\s]+:[@\w\d\s/\']+\]/gi, function (mention) {
var mentionParts = mention.match(regexMentionParts);
if (mentionParts.length === 3) {
var name = mentionParts[2];
mentionMap[name] = mentionParts[1];
return "@[" + name + "]";
}
return mentionParts;
});
return text;
};
$scope.parseMentions = function(entry) {
var regexMentionParts = /[\w\d\s/\']+/gi;
entry = entry.replace(/@\[[\w\d\s]+:[\w\d\s/\']+\]/gi, function (mention) {
var mentionParts = mention.match(regexMentionParts);
if (mentionParts.length === 2) {
return '<a class="at-mention at-mention-user-' + mentionParts[0] + '">@' + mentionParts[1] + '</a>';
}
return mentionParts;
});
return entry;
};
$scope.parseLinks = function(text) {
var regexLinks = /@L\[([^|]+?)\|([^\]]*)]/gi;
return text.replace(regexLinks, "<a href='$1' target='_blank'>$2</a>");
};
$scope.trustAsHtml = function(text) {
return $sce.trustAsHtml(text);
};
$scope.parseSpecial = function(text) {
var parsedText = $scope.parseLinks(text);
parsedText = $scope.parseMentions(parsedText);
return $scope.trustAsHtml(parsedText);
};
$scope.containsHTML = function(text) {
return /<([a-z][a-z0-9]*)\b[^>]*>[\s\S]*<\/\1>/mi.test(text);
};
$scope.isHTMLField = function(change) {
return change.field_type === 'html' || change.field_type === 'translated_html';
};
$scope.shouldEncapsulate = function(journal) {
return $scope.isHTMLField(journal) || $scope.containsHTML(journal.sanitized_new_value)
};
$scope.getFullEntryValue = function(entry, event) {
event.stopPropagation();
var index = getEntryIndex(entry);
var journal = $scope.entries[index].entries.journal[0];
journal.loading = true;
$http.get('/api/now/ui/stream_entry/full_entry', {
params: {
sysparm_sys_id: journal.sys_id
}
}).then(function (response) {
journal.sanitized_new_value = journal.new_value = response.data.result.replace(/\n/g, '<br/>');
journal.is_truncated = false;
journal.loading = false;
journal.showMore = true;
});
};
function getEntryIndex(entry) {
for (var i = 0, l = $scope.entries.length; i < l; i++) {
if (entry === $scope.entries[i]) {
return i;
}
}
}
$scope.$watch('active', function(n, o) {
if (n === o)
return;
if ($scope.active)
startPolling();
else
cancelStream();
});
$scope.defaultControls = {
getTitle: function(entry) {
if(entry && entry.short_description) {
return entry.short_description;
} else if(entry && entry.shortDescription) {
return entry.shortDescription;
}
},
showCreatedBy: function() {
return true;
},
hideCommentLabel: function() {
return false;
},
showRecord: function($event, entry) {
},
showRecordLink: function() {
return true;
}
};
if ($scope.controls) {
for (var attr in $scope.controls)
$scope.defaultControls[attr] = $scope.controls[attr];
}
$scope.controls = $scope.defaultControls;
if ($scope.showCommentsAndWorkNotes === undefined) {
$scope.showCommentsAndWorkNotes = $scope.defaultShowCommentsAndWorkNotes;
}
snCustomEvent.observe('sn.stream.change_input_display', function(table, display) {
if (table != $scope.table)
return;
$scope.showCommentsAndWorkNotes = display;
$scope.$apply();
});
snCustomEvent.observe('sn.stream.attachment_state_updated', function(entry) {
$scope.entries.forEach(function(e) {
if (e.attachment && e.attachment.sys_id === entry.attachment.sys_id) {
e.attachment.state = entry.attachment.state;
}
});
});
$scope.$on("$destroy", function() {
cancelStream();
});
$scope.$on('sn.stream.interval', function($event, time) {
interval = time;
reschedulePoll();
});
$scope.$on("sn.stream.tap", function() {
if (stream)
stream.tap();
else
startPolling();
});
$scope.$on('window_visibility_change', function($event, hidden) {
interval = (hidden) ? 120000 : undefined;
reschedulePoll();
});
snCustomEvent.observe('sn.stream.clearOnSilentSubmit', function(){
clearInputs();
});
$scope.$on("sn.stream.refresh", function(event, data) {
stream._successCallback(data.response);
});
$scope.$on("sn.stream.reload", function() {
startPolling();
});
snCustomEvent.observe('sn.stream.toggle_multiple_inputs', function() {
$scope.useMultipleInputs = true;
});
$scope.$on('sn.stream.input_value', function(otherScope, type, value) {
setMultipleInputs();
if(!$scope.multipleInputs) {
$scope.inputType = type;
$scope.inputTypeValue = value;
}
});
$scope.$watchCollection('[table, query, sysId]', startPolling);
$scope.changeInputType = function(field) {
if (!primaryJournalField){
angular.forEach($scope.fields, function(item) {
if (item.isPrimary)
primaryJournalField = item.name;
});
}
$scope.inputType = field.checked ? field.name : primaryJournalField;
userPreferences.setPreference('glide.ui.' + $scope.table + '.stream_input', $scope.inputType);
};
$scope.selectedInputType = function(value) {
if (angular.isDefined(value)) {
$scope.inputType = value;
userPreferences.setPreference('glide.ui.' + $scope.table + '.stream_input', $scope.inputType);
}
return $scope.inputType;
};
$scope.$watch('inputType', function() {
if (!$scope.inputType || !$scope.preferredInput)
return;
$scope.preferredInput = $scope.inputType;
});
$scope.submitCheck = function(event){
var key = event.keyCode || event.which;
if (key === 13) {
$scope.postJournalEntryForCurrent(event);
}
};
$scope.postJournalEntry = function(type, entry, event) {
type = type || primaryJournalFieldOrder[0];
event.stopPropagation();
var requestTable = $scope.table || "board:" + $scope.board.sys_id;
stream.insertForEntry(type, entry.journalText, requestTable, entry.document_id);
entry.journalText = "";
entry.commentBoxVisible = false;
snRecordPresence.termPresence();
};
$scope.postJournalEntryForCurrent = function(event) {
event.stopPropagation();
var entries = [];
if ($scope.multipleInputs) {
angular.forEach($scope.fields, function(item) {
if (!item.value)
return;
entries.push({
field: item.name,
text: item.value
});
})
} else {
entries.push({
field: $scope.inputType,
text: $scope.inputTypeValue
})
}
var request = stream.insertEntries(entries, $scope.table, $scope.sysId, mentionMap);
if (request) {
request.then(function () {
for (var i = 0; i < entries.length; i++) {
fireClearEvent(entries[i].field);
}
});
}
clearInputs();
return false;
};
$scope.doesFormHasMandatoryJournalFields = function() {
if (window.g_form) {
var fields = Object.values($scope.fields);
for (var index = 0; index < fields.length; index++) {
if (fields[index].mandatory)
return true;
}
}
return false;
};
function fireInsertEvent(name, value) {
snCustomEvent.fire('sn.stream.insert', name, value);
}
function fireClearEvent(name) {
snCustomEvent.fire('sn.stream.clear', name);
}
function clearInputs() {
$scope.inputTypeValue = "";
angular.forEach($scope.fields, function(item) {
if (item.value)
item.filled = true;
item.value = "";
});
}
$scope.showCommentBox = function(entry, event) {
event.stopPropagation();
if (entry !== $scope.selectedEntry)
$scope.closeEntry();
$scope.selectedEntry = entry;
entry.commentBoxVisible = !entry.commentBoxVisible;
if (entry.commentBoxVisible) {
snRecordPresence.initPresence($scope.table, entry.document_id);
}
};
$scope.showMore = function(journal, event) {
event.stopPropagation();
journal.showMore = true;
};
$scope.showLess = function(journal, event) {
event.stopPropagation();
journal.showMore = false;
};
$scope.closeEntry = function() {
if ($scope.selectedEntry)
$scope.selectedEntry.commentBoxVisible = false;
};
$scope.handleListASAttachmentClick  = function(evt, entry) {
evt.stopPropagation();
$scope.handleASAttachmentClick(evt, entry);
};
$scope.handleListASAttachmentKeydown = function(evt, entry) {
if (evt.keyCode === 13 || evt.keyCode === 32) {
evt.stopPropagation();
$scope.handleASAttachmentClick(evt, entry);
}
}
$scope.handleASAttachmentClick = function(evt, entry) {
var attachment = entry.attachment;
if (attachment.state === 'available' || !$scope.attachmentAdviceRequired) {
previewOrDownloadAttachment(evt, entry, false);
} else if (attachment.state === 'not_available') {
evt.preventDefault();
$scope.showAttachmentUnAvailabilityMessage(attachment.file_name);
} else {
evt.preventDefault();
getAttachmentAvailability(attachment.sys_id)
.then(function(res) {
entry.attachment.state = res.state;
previewOrDownloadAttachment(evt, entry, true);
}, function(res) {
entry.attachment.state = res.state;
if (res.forceDownload) {
downloadAttachment(evt.currentTarget);
} else {
$scope.showAttachmentUnAvailabilityMessage(attachment.file_name, res.message);
}
});
}
};
function getAttachmentAvailability(attachmentSysId) {
var deferred = $q.defer();
$http.get('/api/now/as_attachment/getAvailability/' + attachmentSysId)
.then(function (response) {
var _res = response.data.result;
if (_res && _res.availability) {
if (_res.availability === 'available') {
deferred.resolve({state : _res.availability});
} else {
deferred.reject({
state : _res.availability,
message : _res.message
});
}
} else {
deferred.reject({ state: "", forceDownload : true});
}
}, function() {
deferred.reject({ state: "", forceDownload : true});
});
return deferred.promise;
}
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
$scope.showAttachmentUnAvailabilityMessage = function(fileName, customMsg) {
var errMsg = customMsg || i18n.format(infectedAttachmnentMsg, escapeHtml(fileName));
if (typeof g_form !== "undefined") {
g_form.addErrorMessage(errMsg);
} else if (typeof window.parent.GlideUI !== "undefined") {
var topWindow = window.parent;
topWindow.CustomEvent.fireTop(topWindow.GlideUI.UI_NOTIFICATION + '.error',
new topWindow.GlideUINotification({type : 'error',text : errMsg }));
} else if (window.NOW && window.NOW.CustomEvent) {
window.NOW.CustomEvent.fire('stream.attachment.unavailable', errMsg);
}
};
function downloadAttachment(ele) {
var link = document.createElement('a');
link.href = ele.getAttribute('href');
link.download = ele.getAttribute('file-name');
var event = (typeof window.MouseEvent === "function")
? new MouseEvent("click")
: document.createEvent('Event');
event.initEvent('click', true, true);
link.dispatchEvent(event);
}
function previewOrDownloadAttachment(evt, entry, isAsync) {
if (!$scope.isFormStream) {
evt.preventDefault();
if (isAsync && entry.type === 'attachment-image')
return;
openAttachment(entry.attachment.sys_id);
return;
}
if (entry.type === 'attachment-image') {
if (snCustomEvent.events['sn.attachment.preview'] && !isAsync) {
snCustomEvent.fire('sn.attachment.preview', evt, entry.attachment);
}
} else if((entry.attachment.extension === 'mp4' || entry.attachment.extension === 'webm') && typeof GlideVideoPlayer !== "undefined") {
evt.preventDefault();
entry.attachment.playVideo = true;
} else if (isAsync) {
downloadAttachment(evt.currentTarget);
}
}
function openAttachment(sysId) {
var url = "/sys_attachment.do?view=true&sys_id=" + sysId;
var newTab = window.open(url, '_blank');
newTab.focus();
}
$rootScope.$on('sn.sessions', function(someOtherScope, sessions) {
if ($scope.selectedEntry && $scope.selectedEntry.commentBoxVisible)
$scope.selectedEntry.sessions = sessions;
});
$scope.$watch("inputTypeValue", function(n, o) {
if (n !== o) {
emitTyping($scope.inputTypeValue);
}
});
$scope.$watch("selectedEntry.journalText", function(newValue) {
if ($scope.selectedEntry)
emitTyping(newValue || "");
});
var multipleInputWatcher = function(){};
$scope.$watch('useMultipleInputs', function() {
if($scope.useMultipleInputs) {
multipleInputWatcher = $scope.$watch("fields", function(n, o, s) {
if (n !== o) {
var strVal = "";
angular.forEach($scope.fields, function(item) {
if (item.value)
strVal = item.value;
});
emitTyping(strVal);
}
}, true);
} else {
multipleInputWatcher();
}
setMultipleInputs();
});
function emitTyping(inputValue) {
if (!angular.isDefined(inputValue)){
return;
}
var status = inputValue.length ? "typing" : "viewing";
$scope.$emit("record.typing", {status: status, value: inputValue, field_type: $scope.inputType, table: $scope.table, sys_id: $scope.sys_id});
}
function preloadedData() {
if (typeof window.NOW.snActivityStreamData === 'object'
&& window.NOW.snActivityStreamData[$scope.table + '_' + $scope.sysId]) {
_firstPoll = false;
var data = window.NOW.snActivityStreamData[$scope.table + '_' + $scope.sysId];
stream = nowStream.create($scope.table, $scope.query, $scope.sysId,
processor, interval, source, $scope.attachments);
stream.callback = onPoll;
stream.preRequestCallback = beforePoll;
stream.lastTimestamp = data.sys_timestamp;
if (data.entries && data.entries.length) {
stream.lastEntry = angular.copy(data.entries[0]);
}
_firstPollTimeout = setTimeout(function() {
stream.poll(onPoll, beforePoll);
_firstPollTimeout = false;
}, 20000);
beforePoll();
onPoll(data);
return true;
}
return false;
}
function scheduleNewPoll(lastTimestamp) {
cancelStream();
stream = nowStream.create($scope.table, $scope.query, $scope.sysId,
processor, interval, source, $scope.attachments);
stream.lastTimestamp = lastTimestamp;
stream.poll(onPoll, beforePoll);
}
function reschedulePoll() {
var lastTimestamp = stream ? stream.lastTimestamp : 0;
if (cancelStream()) {
scheduleNewPoll(lastTimestamp);
}
}
function reset() {
removeInlineStream();
$scope.loaded = false;
startPolling();
}
function emitFilterChange() {
$scope.$emit('sn.stream.is_filtered_change', $scope.isFiltered);
}
function startPolling() {
if ($scope.loading && !$scope.loaded)
return;
if (!$scope.active)
return;
$scope.entries = [];
$scope.allEntries = [];
$scope.showAllEntriesButton = false;
$scope.loaded = false;
$scope.loading = true;
if (_firstPoll && preloadedData()) {
return;
}
scheduleNewPoll();
$scope.$emit('sn.stream.entries_change', $scope.entries);
}
function onPoll(response) {
$scope.loading = false;
if (response.primary_fields)
primaryJournalFieldOrder = response.primary_fields;
if (!fieldsInitialized)
processFields(response.fields);
processEntries(response.entries);
if (response.inlineStreamLoaded) {
$scope.inlineStreamLoaded = true;
addInlineStreamEntryClass();
}
if (!$scope.loaded) {
$scope.loaded = true;
$scope.$emit("sn.stream.loaded", response);
}
}
function beforePoll() {
$scope.$emit("sn.stream.requested");
}
function processFields(fields) {
if(!fields || !fields.length)
return;
fieldsInitialized = true;
$scope.allFields = fields;
setShowAllFields();
$scope.fieldsVisible = 0;
var i = 0;
angular.forEach(fields, function(field) {
if (!field.isJournal)
return;
if (i==0)
$scope.firstJournal = field.name;
i++;
if ($scope.fields[field.name]) {
angular.extend($scope.fields[field.name], field);
} else {
$scope.fields[field.name] = field;
}
$scope.fields[field.name].visible = !$scope.formJournalFields && $scope.fields[field.name].canWrite;
if ($scope.fields[field.name].visible)
$scope.fieldsVisible++;
var fieldColor = field.color;
if (fieldColor)
fieldColor = field.color.replace(/background-color: /, '');
if (!fieldColor || fieldColor == 'transparent')
fieldColor = null;
$scope.fields[field.name].color = fieldColor;
});
setFieldVisibility();
setPrimaryJournalField();
setMultipleInputs();
}
$scope.$watch('formJournalFields', function() {
setFieldVisibility();
setPrimaryJournalField();
setMultipleInputs();
}, true);
function setFieldVisibility() {
if (!$scope.formJournalFields || !$scope.fields || !$scope.showCommentsAndWorkNotes)
return;
$scope.fieldsVisible = 0;
angular.forEach($scope.formJournalFields, function(formField) {
if (!$scope.fields[formField.name])
return;
var formValue = angular.element('#' + $scope.table + '\\.' + formField.name).val();
if (formValue && formValue.indexOf($window.NOW.STREAM_VALUE_KEY) !== 0) {
$scope.fields[formField.name].value = $scope.reduceMentions(formField.value);
} else if (formValue === '') {
$scope.fields[formField.name].value = '';
}
$scope.fields[formField.name].mandatory = formField.mandatory;
$scope.fields[formField.name].label = formField.label;
$scope.fields[formField.name].messages = formField.messages;
$scope.fields[formField.name].visible = formField.visible && !formField.readonly;
if ($scope.fields[formField.name].visible)
$scope.fieldsVisible++;
});
}
$scope.getStubbedFieldModel = function(fieldName) {
if ($scope.fields[fieldName])
return $scope.fields[fieldName];
$scope.fields[fieldName] = {
name: fieldName
};
return $scope.fields[fieldName];
};
function setPrimaryJournalField() {
if (!$scope.fields || !$scope.showCommentsAndWorkNotes)
return;
angular.forEach($scope.fields, function(item) {
item.isPrimary = false;
item.checked = false;
});
var visibleFields = Object.keys($scope.fields).filter(function(item) {
return $scope.fields[item].visible;
});
if (visibleFields.indexOf($scope.preferredInput) != -1) {
var field = $scope.fields[$scope.preferredInput];
field.checked = true;
field.isPrimary = true;
$scope.inputType = $scope.preferredInput;
primaryJournalField = $scope.preferredInput;
} else {
for (var i = 0; i < primaryJournalFieldOrder.length; i++) {
var fieldName = primaryJournalFieldOrder[i];
if (visibleFields.indexOf(fieldName) != -1) {
$scope.fields[fieldName].isPrimary = true;
primaryJournalField = fieldName;
$scope.inputType = fieldName;
$scope.inputTypeValue = $scope.fields[fieldName].value;
break;
}
}
}
if(visibleFields.length === 0) {
primaryJournalField = '';
$scope.inputType = primaryJournalField;
} else if (!$scope.inputType && visibleFields.length > 0) {
primaryJournalField = visibleFields[0];
$scope.inputType = primaryJournalField;
$scope.fields[primaryJournalField].isPrimary = true;
}
if ($scope.fields && visibleFields.indexOf(primaryJournalField) == -1) {
var keys = Object.keys($scope.fields);
if (keys.length)
$scope.fields[keys[0]].isPrimary = true;
}
}
function safeArialiveAssertive(message) {
if (window.NOW && window.NOW.accessibility && window.NOW.accessibility.ariaLiveAssertive) {
window.NOW.accessibility.ariaLiveAssertive(message);
}
}
function setShowAllFields() {
var ariaLiveAllActivities = '';
$scope.checkbox.showAllFields = $scope.showAllFields = $scope.allFields && !$scope.allFields.some(function(item) {
return !item.isActive;
});
$scope.hideAllFields = !$scope.allFields || !$scope.allFields.some(function(item) {
return item.isActive;
});
$scope.isFiltered = !$scope.showAllFields || $scope.allFields.some(function(item) {
return !item.isActive;
});
if ($scope.checkbox.showAllFields)
ariaLiveAllActivities = 'All activities are displayed';
else if ($scope.hideAllFields)
ariaLiveAllActivities = 'All activities are hidden';
safeArialiveAssertive(ariaLiveAllActivities);
}
$scope.setPrimary = function(entry) {
angular.forEach($scope.fields, function(item) {
item.checked = false;
});
for (var i = 0; i < primaryJournalFieldOrder.length; i++) {
var fieldName = primaryJournalFieldOrder[i];
if (entry.writable_journal_fields.indexOf(fieldName) != -1) {
entry.primaryJournalField = fieldName;
entry.inputType = fieldName;
return;
}
}
if (!entry.inputType) {
var primaryField = entry.writable_journal_fields[0];
entry.primaryJournalField = primaryField;
entry.inputType = primaryField;
}
};
$scope.updateFieldVisibilityAll = function() {
$scope.showAllFields = !$scope.showAllFields;
angular.forEach($scope.allFields, function(item) {
item.isActive = $scope.showAllFields;
});
$scope.updateFieldVisibility();
};
$scope.updateFieldVisibility = function() {
var activeFields = $scope.allFields.map(function(item) {
return item.name + ',' + item.isActive;
});
setShowAllFields();
emitFilterChange();
userPreferences
.setPreference($scope.table + '.activity.filter', activeFields.join(';'))
.then(function() {
reset();
});
};
$scope.configureAvailableFields = function() {
$window.personalizer($scope.table, 'activity', $scope.sysId);
};
function handleFieldInputsOnToggle(){
angular.forEach($scope.fields, function(item){
var itemIsInput = ($scope.inputType == item.name) ? true : false;
if (!itemIsInput)
item.value = '';
else if ($scope.multipleInputs)
item.value = $scope.inputTypeValue;
else
$scope.inputTypeValue = item.value;
});
}
$scope.isInForm = function() {
return typeof g_form !== 'undefined';
}
function shouldJournalFieldsToggle(){
var toggle = true;
if (!$scope.multipleInputs)
return toggle;
angular.forEach($scope.fields, function(item){
if(($scope.inputType != item.name) && item.value)
toggle = false;
});
return toggle;
}
$scope.toggleMultipleInputs = function(val, evt) {
if (evt && evt.type === "keydown" && evt.keyCode !== 13 && evt.keyCode !== 32) return;
if (!shouldJournalFieldsToggle())
return;
userPreferences.setPreference('glide.ui.activity_stream.multiple_inputs', val ? 'true' : 'false')
.then(function() {
$scope.useMultipleInputs = val;
setMultipleInputs();
if ($scope.multipleInputs === val)
handleFieldInputsOnToggle();
});
};
$scope.changeEntryInputType = function(fieldName, entry) {
var checked = $scope.fields[fieldName].checked;
entry.inputType = checked ? fieldName : entry.primaryJournalField;
};
function processEntries(entries) {
if (!entries || !entries.length)
return;
entries = entries.reverse();
var newEntries = [];
angular.forEach(entries, function (entry) {
var entriesToAdd = [entry];
if (entry.attachment) {
entry.type = getAttachmentType(entry.attachment);
entry.attachment.extension = getAttachmentExt(entry.attachment);
} else if (entry.is_email === true){
entry.email = {};
var allFields = entry.entries.custom;
for(var i = 0; i < allFields.length; i++){
entry.email[allFields[i].field_name] = {
label: allFields[i]['field_label'],
displayValue: allFields[i]['new_value']
};
entry.email['is_translation_enabled'] = allFields[i]['is_translation_enabled'];
}
entry['entries'].custom = [];
} else if ($scope.sysId) {
entriesToAdd = extractJournalEntries(entry);
} else {
entriesToAdd = handleJournalEntriesWithoutExtraction(entry);
}
putGlobalMember(entry['user_id'], entry['sys_created_by'], entry['initials'], entry['user_image']);
if (entriesToAdd instanceof Array) {
entriesToAdd.forEach(function (e) {
$scope.entries.unshift(e);
newEntries.unshift(e);
});
}
else {
$scope.entries.unshift(entriesToAdd);
newEntries.unshift(entriesToAdd)
}
if (source != FROM_FORM)
$scope.entries = $scope.entries.slice(0, 49);
if ($scope.maxEntries != undefined) {
var maxNumEntries = parseInt($scope.maxEntries, 10);
$scope.entries = $scope.entries.slice(0, maxNumEntries);
}
});
if ($scope.inlineStreamLoaded) {
if ($scope.entries.length > 0) {
removeInlineStreamEntryClass();
}
}
if ($scope.loaded) {
$scope.$emit("sn.stream.new_entries", newEntries);
triggerResize();
}
else if ($scope.pageSize && $scope.entries.length > $scope.pageSize) {
setUpPaging();
}
$timeout(function() {
$scope.$emit('sn.stream.entries_change', $scope.entries);
});
}
function removeInlineStream() {
angular.element(document).find('#sn_form_inline_stream_container').hide().remove();
}
function removeInlineStreamEntryClass() {
angular.element(document).find('#sn_form_inline_stream_entries').removeClass('sn-form-inline-stream-entries-only');
}
function addInlineStreamEntryClass() {
angular.element(document).find('#sn_form_inline_stream_entries').addClass('sn-form-inline-stream-entries-only');
}
function setUpPaging() {
$scope.showAllEntriesButton = true;
$scope.allEntries = $scope.entries;
$scope.entries = [];
loadEntries(0, $scope.pageSize);
}
$scope.loadMore = function() {
if ($scope.entries.length + $scope.pageSize > $scope.allEntries.length) {
$scope.loadAll();
return;
}
loadEntries($scope.loadedEntries, $scope.loadedEntries + $scope.pageSize);
};
$scope.loadAll = function() {
$scope.showAllEntriesButton = false;
loadEntries($scope.loadedEntries, $scope.allEntries.length);
};
$scope.translateStreamEntryClick = function(entry, isRetry) {
getTranslationDetails(entry, isRetry);
};
$scope.translateStreamEntryKeypress = function(event, entry, isRetry) {
var key = event.keyCode || event.which;
if (key === 32) {
event.preventDefault();
getTranslationDetails(entry, isRetry);
}
};
function getTranslationDetails(entry, isRetry) {
if ($injector.has('translateStream')) {
var handler = $injector.get('translateStream');
handler.getTranslatedContent(entry, isRetry);
}
};
$scope.translationToggleClick = function(entry) {
toggleTranslationLink(entry);
};
$scope.translationToggleKeypress = function(event, entry) {
var key = event.keyCode || event.which;
if (key === 32) {
event.preventDefault();
toggleTranslationLink(entry);
}
};
function toggleTranslationLink(entry) {
if ($injector.has('translateStream')) {
var handler = $injector.get('translateStream');
handler.toggleTranslation(entry);
}
};
$scope.$on('sn.stream.translation_successful', function(event, data) {
data.entry.translatedText = $scope.parseSpecial(data.translatedText);
});
function loadEntries(start, end) {
$scope.entries = $scope.entries.concat($scope.allEntries.slice(start, end));
$scope.loadedEntries = $scope.entries.length;
$scope.$emit('sn.stream.entries_change', $scope.entries);
}
function getAttachmentType(attachment) {
if (attachment.content_type.startsWith('image/') && attachment.content_type.indexOf("tiff") < 0
&& attachment.size_bytes < 5 * 1024 * 1024 && attachment.path.indexOf(attachment.sys_id) == 0)
return 'attachment-image';
return 'attachment';
}
function getAttachmentExt(attachment) {
var filename = attachment.file_name;
return filename.substring(filename.lastIndexOf('.') + 1);
}
function handleJournalEntriesWithoutExtraction(oneLargeEntry) {
if (oneLargeEntry.entries.journal.length === 0)
return oneLargeEntry;
for (var i = 0; i < oneLargeEntry.entries.journal.length; i++) {
newLinesToBR(oneLargeEntry.entries.journal);
}
return oneLargeEntry;
}
function extractJournalEntries(oneLargeEntry) {
var smallerEntries = [];
if (oneLargeEntry.entries.journal.length === 0)
return oneLargeEntry;
for (var i = 0; i < oneLargeEntry.entries.journal.length; i++) {
var journalEntry = angular.copy(oneLargeEntry);
journalEntry.entries.journal = journalEntry.entries.journal.slice(i, i + 1);
newLinesToBR(journalEntry.entries.journal);
journalEntry.entries.changes = [];
journalEntry.type = 'journal';
smallerEntries.unshift(journalEntry);
}
oneLargeEntry.entries.journal = [];
oneLargeEntry.type = 'changes';
if (oneLargeEntry.entries.changes.length > 0)
smallerEntries.unshift(oneLargeEntry);
return smallerEntries;
}
function newLinesToBR(entries) {
angular.forEach(entries, function(item) {
if (item.new_value) {
item.new_value = item.new_value.replace(/\n/g, '<br/>');
}
if (item.sanitized_new_value) {
item.sanitized_new_value = item.sanitized_new_value.replace(/\n/g, '<br/>');
}
});
}
function cancelStream() {
if (_firstPollTimeout) {
clearTimeout(_firstPollTimeout);
_firstPollTimeout = false;
}
if (!stream)
return false;
stream.cancel();
stream = null;
return true; 
}
function setMultipleInputs() {
$scope.multipleInputs = $scope.useMultipleInputs;
if ($scope.useMultipleInputs === true || !$scope.formJournalFields) {
return;
}
var numAffectedFields = 0;
angular.forEach($scope.formJournalFields, function(item) {
if (item.mandatory || item.value)
numAffectedFields++;
});
if (numAffectedFields > 0)
$scope.multipleInputs = true;
}
function triggerResize() {
if (window._frameChanged)
setTimeout(_frameChanged, 0);
}
var filterPopoverButton = angular.element("#activity_field_filter_button");
var filterPopoverContents = angular.element("#activity_field_filter_popover");
var filterFocusTrap;
var scrollingContainer;
var screenSize;
$scope.filterOpen = false;
filterPopoverButton.on("shown.bs.popover", function() {
$scope.$apply(function () {
$scope.filterOpen = true;
filterPopoverContents.parent().parent().attr("role", "presentation");
markListBoxAsFocused('activity_filter_all', false);
});
filterFocusTrap = $window.focusTrap(filterPopoverContents[0], {
clickOutsideDeactivates:true,
initialFocus: '#activity_filter_all'
});
filterFocusTrap.activate();
});
filterPopoverButton.on("hidden.bs.popover", function() {
$scope.$apply(function () {
$scope.filterOpen = false;
});
filterFocusTrap.deactivate();
});
filterPopoverButton.on('keydown', function(evt) {
if (!$scope.filterOpen && evt.keyCode === 13) {
filterPopoverButton.popover('show');
}
});
filterPopoverContents.on('keydown', function(evt) {
if (evt.keyCode === 38 || (evt.shiftKey && evt.keyCode === 9)) {
evt.preventDefault();
var focusedElement = getFocusedElement();
if (!focusedElement)
return;
var previousElementParent = (focusedElement.tagName === 'INPUT') ? focusedElement.parentElement.previousElementSibling : focusedElement.previousElementSibling;
if (!previousElementParent)
return;
focusedElement.removeAttribute('focused');
var previousElementId = (previousElementParent.tagName === 'SPAN') ? previousElementParent.firstElementChild.id : previousElementParent.id;
markListBoxAsFocused(previousElementId, true);
} else if (evt.keyCode === 40 || evt.keyCode === 9) {
evt.preventDefault();
var focusedElement = getFocusedElement();
if (!focusedElement)
return;
var nextElementParent = (focusedElement.tagName === 'INPUT') ? focusedElement.parentElement.nextElementSibling : focusedElement.nextElementSibling;
if (!nextElementParent)
return;
focusedElement.removeAttribute('focused');
var nextElementId = (nextElementParent.tagName === 'SPAN') ? nextElementParent.firstElementChild.id : nextElementParent.id;
markListBoxAsFocused(nextElementId, true);
}
if (evt.keyCode !== 27) {
return;
}
filterPopoverButton.popover('hide');
});
filterPopoverContents.on("click", "input[type=checkbox]", function() {
var focusedElement = getFocusedElement();
if (focusedElement)
focusedElement.removeAttribute("focused");
markListBoxAsFocused(this.id, false);
});
filterPopoverContents.on("focus", "input[type=checkbox]", function() {
if (!scrollingContainer) {
scrollingContainer = filterPopoverContents.parent(".popover-content")[0];
screenSize = scrollingContainer.offsetHeight;
}
var scrollTopPos = scrollingContainer.scrollTop;
var itemSize = this.parentElement.offsetHeight;
var offsetTop = this.parentElement.offsetTop;
var offsetBot = offsetTop + itemSize;
if (this.id == "activity_filter_all") {
scrollingContainer.scrollTop = 0;
}
else if (scrollTopPos > offsetTop) {
scrollingContainer.scrollTop = offsetTop;
}
else if (offsetBot > screenSize + scrollTopPos) {
scrollingContainer.scrollTop = offsetBot - screenSize;
}
});
function getFocusedElement() {
return document.querySelector("#activity_field_filter_listbox [focused]");
}
function markListBoxAsFocused(id, setFocus) {
var filterListBox = document.getElementById('activity_field_filter_listbox');
if (!filterListBox)
return;
filterListBox.setAttribute('aria-activedescendant', id);
var focusedElement = document.getElementById(id);
if (!focusedElement)
return;
focusedElement.setAttribute('focused', '');
if (setFocus)
focusedElement.focus();
}
snCustomEvent.fire("sn.stream.loaded");
}).filter('visibleFields', function() {
return function(fields) {
var obj = {};
angular.forEach(fields, function(field) {
if (field.visible) {
obj[field.name] = field;
}
});
return obj;
}
});
;
/*! RESOURCE: /scripts/sn/common/stream/directive.snStream.js */
angular.module("sn.common.stream").directive("snStream", function(getTemplateUrl, $http, $sce, $sanitize) {
"use strict";
return {
restrict: "E",
replace: true,
scope: {
table: "=",
query: "=?",
sysId: "=?",
active: "=",
controls: "=?",
showCommentsAndWorkNotes: "=?",
previousActivity: "=?",
sessions: "=",
attachments: "=",
board: "=",
formJournalFields: "=",
useMultipleInputs: "=?",
preferredInput: "=",
labels: "=",
subStream: "=",
expandEntries: "=",
scaleAnimatedGifs: "=",
scaleImages :"=",
pageSize: "=",
maxEntries: "@"
},
templateUrl: getTemplateUrl("ng_activity_stream.xml"),
controller: "snStream",
link: function (scope, element) {
element.on("click", ".at-mention", function(evt) {
var userID = angular.element(evt.target).attr('class').substring("at-mention at-mention-user-".length);
$http({
url: '/api/now/form/mention/user/' + userID,
method: "GET"
}).then(function(response) {
scope.showPopover = true;
scope.mentionPopoverProfile = response.data.result;
scope.clickEvent = evt;
}, function () {
$http({
url: '/api/now/live/profiles/' + userID,
method: "GET"
}).then(function(response) {
scope.showPopover = true;
var tempProfile = response.data.result;
tempProfile.userID = tempProfile.sys_id = response.data.result.document;
scope.mentionPopoverProfile = tempProfile;
scope.mentionPopoverProfile.sysID = response.data.result["userID"];
scope.clickEvent = evt;
})
});
});
scope.toggleEmailIframe = function(email, event){
email.expanded = !email.expanded;
event.preventDefault();
};
}
};
});
;
/*! RESOURCE: /scripts/sn/common/stream/directive.formStreamEntry.js */
angular.module('sn.common.stream').directive('formStreamEntry', function(getTemplateUrl) {
return {
restrict: 'A',
templateUrl: getTemplateUrl('record_stream_entry.xml')
}
});
;
/*! RESOURCE: /scripts/sn/common/stream/directive.snExpandedEmail.js */
angular.module("sn.common.stream").directive("snExpandedEmail", function() {
"use strict";
return {
restrict: "E",
replace: true,
scope: {
email: "="
},
template: "<iframe style='width: 100%;' class='card' src='{{::emailBodySrc}}'></iframe>",
controller: function($scope){
$scope.emailBodySrc = "email_display.do?email_id=" + $scope.email.sys_id.displayValue;
},
link: function(scope, element) {
element.load(function(){
var bodyHeight = $j(this).get(0).contentWindow.document.body.scrollHeight + "px";
$j(this).height(bodyHeight);
});
}
};
});
;
/*! RESOURCE: /scripts/app.form_presence/controller.formStream.js */
(function() {
var journalModel = {};
window.journalModel = journalModel;
CustomEvent.observe('sn.form.journal_field.add', function(name, mandatory, readonly, visible, value, label) {
journalModel[name] = {
name: name,
mandatory: mandatory,
readonly: readonly,
visible: visible,
value: value,
label: label,
messages: []
};
});
CustomEvent.observe('sn.form.journal_field.readonly', function(name, readonly) {
modifyJournalAttribute(name, "readonly", readonly);
});
CustomEvent.observe('sn.form.journal_field.value', function(name, value) {
modifyJournalAttribute(name, "value", value);
});
CustomEvent.observe('sn.form.journal_field.mandatory', function(name, mandatory) {
modifyJournalAttribute(name, "mandatory", mandatory);
});
CustomEvent.observe('sn.form.journal_field.visible', function(name, visible) {
modifyJournalAttribute(name, "visible", visible);
});
CustomEvent.observe('sn.form.journal_field.label', function(name, visible) {
modifyJournalAttribute(name, "label", visible);
});
CustomEvent.observe('sn.form.journal_field.show_msg', function(name, message, type) {
var messages = journalModel[name]['messages'].concat([{
type: type,
message: message
}]);
modifyJournalAttribute(name, 'messages', messages);
});
CustomEvent.observe('sn.form.journal_field.hide_msg', function(name, clearAll) {
if (journalModel[name]['messages'].length == 0)
return;
var desiredValue = [];
if (!clearAll)
desiredValue = journalModel[name]['messages'].slice(1);
modifyJournalAttribute(name, 'messages', desiredValue);
});
CustomEvent.observe('sn.form.hide_all_field_msg', function(type) {
var fields = Object.keys(journalModel);
for (var i = 0; i < fields.length; i++) {
var f = fields[i];
if (journalModel[f].messages.length == 0)
continue;
var messages = [];
if (type) {
var oldMessages = angular.copy(journalModel[f].messages);
for (var j = 0; j < oldMessages.length; j++) {
if (oldMessages[j].type != type)
messages.push(oldMessages[j]);
}
}
modifyJournalAttribute(f, 'messages', messages);
}
});
CustomEvent.observe('sn.stream.insert', function(field, text) {
if (typeof window.g_form !== "undefined")
g_form.getControl(field).value = NOW.STREAM_VALUE_KEY + text;
});
CustomEvent.observe('sn.stream.clear', function(field) {
if (window.g_form)
journalModel[field].value = g_form.getControl(field).value = "";
});
function modifyJournalAttribute(field, prop, value) {
if (journalModel[field][prop] === value)
return;
journalModel[field][prop] = value;
CustomEvent.fire('sn.form.journal_field.changed');
}
angular.module('sn.common.stream').controller('formStream', function($scope, snCustomEvent, i18n) {
var isFiltered = !angular.element('.activity-stream-label-filtered').hasClass('hide');
var _inlineTemplateCache;
function renderLabel(count) {
var processedLabel = _getLabel(count);
angular.element('.activity-stream-label-counter').html(processedLabel);
angular.element('.activity-stream-label-filtered').toggleClass('hide', !isFiltered);
}
function _getLabel(count) {
var label = 'Activities: {0}';
return i18n.getMessage(label).withValues([count]);
}
function _getInlineEntries() {
if (_inlineTemplateCache === 0) {
return 0;
}
_inlineTemplateCache = document.querySelectorAll('#sn_form_inline_stream_container ul.activities-form li.h-card_comments').length;
return _inlineTemplateCache;
}
$scope.$on('sn.stream.entries_change', function(evt, entries) {
var inlineTemplateCount = _getInlineEntries();
var count = inlineTemplateCount + entries.length;
renderLabel(count);
});
$scope.$on('sn.stream.is_filtered_change', function(evt, filtered) {
isFiltered = filtered;
});
$scope.formJournalFields = journalModel;
$scope.formJournalFieldsVisible = false;
setUp();
snCustomEvent.observe('sn.form.journal_field.changed', function() {
setUp();
if (!$scope.$$phase)
$scope.$apply();
});
function setUp() {
setInputValue();
}
function setInputValue() {
angular.forEach($scope.formJournalFields, function(item) {
if (typeof window.g_form === "undefined")
return;
item.value = g_form.getValue(item.name);
if (!item.readonly && item.visible && item.value) {
$scope.$broadcast('sn.stream.input_value', item.name, item.value);
}
});
}
})
})();
;
/*! RESOURCE: /scripts/app.form_presence/directive.scroll_form.js */
angular.module('sn.common.stream').directive('scrollFrom', function() {
"use strict";
var SCROLL_TOP_PAD = 10;
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
var target = $attrs.scrollFrom;
$j(target).click(function(evt) {
if (window.g_form) {
var tab = g_form._getTabNameForElement($element);
if (tab)
g_form.activateTab(tab);
}
$element.find('textarea').filter(':visible:first').focus();
var $scrollRoot = $element.closest('.form-group');
if ($scrollRoot.length === 0)
$scrollRoot = $element;
var $scrollParent = $scrollRoot.scrollParent();
var offset = $element.offset().top - $scrollParent.offset().top - SCROLL_TOP_PAD + $scrollParent.scrollTop();
$scrollParent.animate({
scrollTop: offset
}, '500', 'swing');
evt.stopPropagation();
})
}
}
});
;
;
/*! RESOURCE: /scripts/sn/common/dynamicTranslation/js_includes_dynamicTranslation.js */
/*! RESOURCE: /scripts/sn/common/dynamicTranslation/_module.js */
angular.module('sn.common.dynamicTranslation', ['sn.common.i18n']);
;
/*! RESOURCE: /scripts/sn/common/dynamicTranslation/service.dynamicTranslation.js */
angular.module('sn.common.dynamicTranslation').provider('dynamicTranslation', function () {
function getDynamicTranslationRequestConfig() {
return {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
};
}
function setSourceInParms(parms) {
parms = parms || {};
parms.event = parms.event || {};
parms.event.source = 'portalAPI';
return parms;
}
function isNotValidInputText(msg) {
return (typeof msg !== 'string');
}
function isNotValidString(str) {
return ((str == null) || (typeof str !== 'string')) ? true : (str.trim().length === 0);
}
function isNotValidTranslator(translator) {
return ((translator != null) && (typeof translator !== 'string'));
}
function isNotValidTargetLanguages(targetLanguages) {
if (!Array.isArray(targetLanguages) || (targetLanguages.length === 0)) {
return true;
}
for (var index = 0; index < targetLanguages.length; index++) {
if (isNotValidString(targetLanguages[index])) {
return true;
}
}
return false;
}
function isNotValidAdditionalParameters(additionalParameters) {
if (!Array.isArray(additionalParameters) || (additionalParameters.length === 0)) {
return true;
} else {
for (var index = 0; index < additionalParameters.length; index++) {
var additionalParameter = additionalParameters[index];
if (!additionalParameter || (additionalParameter.constructor !== {}.constructor) || (Object.keys(additionalParameter).length !== 2)) {
return true;
}
for (eachkey in additionalParameter) {
if (!(eachkey === 'parameterName' || eachkey === 'parameterValue') || isNotValidString(additionalParameter[eachkey])) {
return true;
}
}
}
}
return false;
}
function isNotValidTexts(texts) {
if (!Array.isArray(texts) || (texts.length === 0)) {
return true;
}
for (var index = 0; index < texts.length; index++) {
if (isNotValidInputText(texts[index])) {
return true;
}
}
return false;
}
var errorHandler = {
rejectErrorMessage: function (response) {
if (this.hasMultipleTexts) {
this.defer.reject({
'code': this.code,
'message': response,
'status': 'Error'
});
} else {
this.defer.reject({
'code': this.code,
'message': response
});
}
}
};
function validateOptionalParameters(parms, defer, i18n, isTranslation, hasMultipleTexts) {
errorHandler['hasMultipleTexts'] = hasMultipleTexts;
errorHandler['defer'] = defer;
if (parms.constructor !== {}.constructor) {
errorHandler['code'] = '40006';
i18n.getMessage("Additional parameters are invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
return false;
}
if (isNotValidTranslator(parms.translator)) {
errorHandler['code'] = '40003';
i18n.getMessage("Translator (\"translator\" field) is invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
return false;
}
if (isTranslation) {
if ((parms.sourceLanguage != null) && isNotValidString(parms.sourceLanguage)) {
errorHandler['code'] = '40008';
i18n.getMessage("Source language (\"sourceLanguage\" field) is invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
return false;
}
if (parms.targetLanguages && isNotValidTargetLanguages(parms.targetLanguages)) {
errorHandler['code'] = '40007';
i18n.getMessage("Target languages (\"targetLanguages\" field) are invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
return false;
}
if (parms.additionalParameters && isNotValidAdditionalParameters(parms.additionalParameters)) {
errorHandler['code'] = '40006';
i18n.getMessage("Additional parameters are invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
return false;
}
}
return true;
}
function handleErrorResponse(response, defer, i18n, hasMultipleTexts) {
errorHandler['hasMultipleTexts'] = hasMultipleTexts;
errorHandler['defer'] = defer;
if (response === 400) {
errorHandler['code'] = '40001';
i18n.getMessage("Dynamic Translation plugin is not installed", errorHandler.rejectErrorMessage.bind(errorHandler));
} else {
errorHandler['code'] = '40051';
i18n.getMessage("Unknown error occurred", errorHandler.rejectErrorMessage.bind(errorHandler));
}
}
this.$get = function ($http, $q, i18n) {
return {
getTranslation: function (textToTranslate, parms) {
var GET_DYNAMIC_TRANSLATION = "/api/sn_dt/v1/dynamic_translation/get_dynamic_translation";
function getOnSuccessResponse(data) {
var successResponse = {
'translations': data.result.translations,
'translator': data.result.translator
};
if (data.result.detectedLanguage) {
successResponse['detectedLanguage'] = data.result.detectedLanguage;
}
return successResponse;
}
function getOnErrorResponse(data) {
return JSON.parse(data.result.errorMessage);
}
var defer = $q.defer();
if (isNotValidInputText(textToTranslate)) {
errorHandler['defer'] = defer;
errorHandler['code'] = '40000';
i18n.getMessage("Text is missing or invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
} else if (!parms || validateOptionalParameters(parms, defer, i18n, true, false)) {
var requestBody = {
'textToTranslate': textToTranslate,
'parms': setSourceInParms(parms)
};
var config = getDynamicTranslationRequestConfig();
$http.post(GET_DYNAMIC_TRANSLATION, requestBody, config).success(function (data) {
if (!data.result.isError)
defer.resolve(getOnSuccessResponse(data));
else
defer.reject(getOnErrorResponse(data));
}).error(function (error, status) {
handleErrorResponse(status, defer, i18n, false);
});
}
return defer.promise;
},
getTranslations: function (textsToTranslate, parms) {
var GET_DYNAMIC_TRANSLATIONS = "/api/sn_dt/v1/dynamic_translation/get_dynamic_translations";
function getOnSuccessResponse(response) {
var successResponse = {
'status': response.result.status,
'translations': response.result.translations,
'translator': response.result.translator
};
return successResponse;
}
function getOnErrorResponse(response) {
var errorDetails = JSON.parse(response.result.errorMessage);
var errorResponse = {
'status': errorDetails.status,
'code': errorDetails.code,
'message': errorDetails.message
};
if (errorDetails['translations']) {
errorResponse['translations'] = errorDetails['translations'];
}
return errorDetails;
}
var defer = $q.defer();
if ((!textsToTranslate) || isNotValidTexts(textsToTranslate)) {
errorHandler['defer'] = defer;
errorHandler['code'] = '40000';
errorHandler['hasMultipleTexts'] = true;
i18n.getMessage("Text is missing or invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
} else if (!parms || validateOptionalParameters(parms, defer, i18n, true, true)) {
var requestBody = {
'textsToTranslate': textsToTranslate,
'parms': setSourceInParms(parms)
};
var config = getDynamicTranslationRequestConfig();
$http.post(GET_DYNAMIC_TRANSLATIONS, requestBody, config).success(function (data) {
if (!data.result.isError)
defer.resolve(getOnSuccessResponse(data));
else
defer.reject(getOnErrorResponse(data));
}).error(function (error, status) {
handleErrorResponse(status, defer, i18n, true);
});
}
return defer.promise;
},
isTranslationEnabled: function (translator) {
var defer = $q.defer();
if ((translator) && (typeof translator !== 'string')) {
i18n.getMessage("Translator (\"translator\" field) is invalid", function (response) {
defer.reject({
'code': '40003',
'message': response
});
});
} else {
var params = {
event: {
eventName: 'isTranslationEnabled'
},
translator: translator
};
this.isEnabled(params).then(
function (data) {
defer.resolve(data.translation);
},
function (data) {
defer.reject(false);
}
);
}
return defer.promise;
},
getDetectedLanguage: function (text, parms) {
var GET_DETECTED_LANGUAGE = '/api/sn_dt/v1/dynamic_translation/get_detected_language';
function getOnSuccessResponse(data) {
return {
'detectedLanguage': data.result.detectedLanguage,
'alternatives': data.result.alternatives,
'translator': data.result.translator
};
}
function getOnErrorResponse(data) {
return JSON.parse(data.result.errorMessage);
}
var defer = $q.defer();
if (isNotValidInputText(text)) {
errorHandler['defer'] = defer;
errorHandler['code'] = '40000';
i18n.getMessage("Text is missing or invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
} else if (!parms || validateOptionalParameters(parms, defer, i18n, false, false)) {
var requestBody = {
'text': text,
'parms': setSourceInParms(parms)
};
var config = getDynamicTranslationRequestConfig();
$http.post(GET_DETECTED_LANGUAGE, requestBody, config).success(function (data) {
if (!data.result.isError)
defer.resolve(getOnSuccessResponse(data));
else
defer.reject(getOnErrorResponse(data));
}).error(function (response, status) {
handleErrorResponse(status, defer, i18n, false);
});
}
return defer.promise;
},
getDetectedLanguages: function (texts, parms) {
var GET_DETECTED_LANGUAGES = '/api/sn_dt/v1/dynamic_translation/get_detected_languages';
function getOnSuccessResponse(response) {
var successResponse = {
'status': response.result.status,
'detections': response.result.detections,
'translator': response.result.translator
};
return successResponse;
}
function getOnErrorResponse(response) {
var errorDetails = JSON.parse(response.result.errorMessage);
var errorResponse = {
'status': errorDetails.status,
'code': errorDetails.code,
'message': errorDetails.message
};
if (errorDetails['detections']) {
errorResponse['detections'] = errorDetails['detections'];
}
return errorDetails;
}
var defer = $q.defer();
if ((!texts) || isNotValidTexts(texts)) {
errorHandler['defer'] = defer;
errorHandler['code'] = '40000';
errorHandler['hasMultipleTexts'] = true;
i18n.getMessage("Text is missing or invalid", errorHandler.rejectErrorMessage.bind(errorHandler));
} else if (!parms || validateOptionalParameters(parms, defer, i18n, false, true)) {
var requestBody = {
'texts': texts,
'parms': setSourceInParms(parms)
};
var config = getDynamicTranslationRequestConfig();
$http.post(GET_DETECTED_LANGUAGES, requestBody, config).success(function (data) {
if (!data.result.isError)
defer.resolve(getOnSuccessResponse(data));
else
defer.reject(getOnErrorResponse(data));
}).error(function (response, status) {
handleErrorResponse(status, defer, i18n, true);
});
}
return defer.promise;
},
isEnabled: function (parms) {
var IS_ENABLED = "/api/sn_dt/v1/dynamic_translation/is_enabled";
function isValidTranslator(translator) {
return (translator && (typeof translator !== 'string')) ? false : true;
}
var defer = $q.defer();
var translator = (parms && (parms.constructor === {}.constructor)) ? parms.translator : parms;
if (isValidTranslator(translator)) {
parms = (typeof parms === 'string') ? {
'translator': translator
} : parms;
var requestBody = {
'parms': setSourceInParms(parms)
};
var config = getDynamicTranslationRequestConfig();
$http.post(IS_ENABLED, requestBody, config).success(function (data) {
defer.resolve(data.result);
}).error(function (response, status) {
defer.resolve({
'translation': false,
'detection': false,
'batchTranslation': false,
'batchDetection': false
});
});
} else {
i18n.getMessage("Translator (\"translator\" field) is invalid", function (response) {
defer.reject({
'code': '40003',
'message': response
});
});
}
return defer.promise;
}
};
};
});
;
;
/*! RESOURCE: /scripts/doctype/GlideWebAnalytics.js */
var GlideWebAnalytics = (function() {
function subscribe() {
window.snWebaConfig = window.snWebaConfig || {};
if (window.snWebaConfig.subscribed && window.snWebaConfig.subscribed == true)
return;
var ambClient = getAMB();
if (ambClient == undefined || ambClient == "")
return;
var webaChannelId = "/weba/config";
var webaCh = ambClient.getChannel(webaChannelId);
webaCh.subscribe(function(response) {
if (window.snWebaConfig == undefined || window.snWebaConfig == null)
window.snWebaConfig = {};
var oldConfig = {
siteId : (window.snWebaConfig.siteId)? window.snWebaConfig.siteId: "0" ,
trackerURL : (window.snWebaConfig.trackerURL)? window.snWebaConfig.trackerURL: ""
};
window.snWebaConfig.siteId = response.data.weba_site_id;
window.snWebaConfig.trackerURL = response.data.weba_rx_url;
window.snWebaConfig.webaScriptPath = response.data.weba_script_path;
handleConfigUpdate(oldConfig, window.snWebaConfig);
});
ambClient.connect();
window.snWebaConfig.subscribed = true;
}
function getAMB(){
var ambClient = window.snWebaConfig.ambClient;
if (ambClient)
return ambClient;
window.snWebaConfig.ambClient = (window.g_ambClient) ? window.g_ambClient : ((window.amb)? window.amb.getClient(): "");
return window.snWebaConfig.ambClient;
}
function handleConfigUpdate(oldConfig, newConfig) {
if (shouldRemoveTracker(oldConfig, newConfig))
removeTracker();
else if (shouldUpdateTracker(oldConfig, newConfig))
updateTracker(oldConfig, newConfig);
else if (shouldInsertTracker(oldConfig, newConfig))
insertTracker(newConfig);
}
function shouldRemoveTracker(oldConfig, newConfig){
if (newConfig.siteId == "0" || newConfig.trackerURL == "")
return true;
return false;
}
function shouldUpdateTracker(oldConfig, newConfig){
if (oldConfig.siteId && oldConfig.siteId != "0" && oldConfig.siteId != newConfig.siteId)
return true;
if (oldConfig.trackerURL && oldConfig.trackerURL != newConfig.trackerURL)
return true;
return false;
}
function shouldInsertTracker(oldConfig, newConfig){
if (oldConfig.siteId == undefined || oldConfig.siteId == "0")
return true;
if (oldConfig.trackerURL == undefined || oldConfig.trackerURL == "")
return true;
return false;
}
function removeTracker() {
if (!trackerExists())
return;
removeWebaTracker();
removeWebaScript();
removeWebaElements();
}
function removeWebaTracker() {
var document =  window.parent.document;
var trackerScriptId = "webaTracker";
var trackEle = document.getElementById(trackerScriptId);
trackEle.parentNode.removeChild(trackEle);
}
function removeWebaScript() {
var document =  window.parent.document;
var asyncTrackEle = document.getElementById('webaScript');
if (asyncTrackEle == undefined)
return;
var src = asyncTrackEle.src;
if (src != undefined && src.indexOf("piwik") > 0)
asyncTrackEle.parentNode.removeChild(asyncTrackEle);
}
function removeWebaElements() {
var document =  window.parent.document;
var webaEle = document.getElementsByClassName("weba");
var webaSize = webaEle.length - 1;
while (webaSize >= 0){
webaEle[webaSize].parentNode.removeChild(webaEle[webaSize]);
webaSize--;
}
}
function updateTracker(oldConfig, newConfig) {
if (!trackerExists())
return;
var document =  window.parent.document;
var head = document.head || document.getElementsByTagName('head')[0];
var updateScript = "_paq.push(['setSiteId', " + newConfig.siteId + "]);" + "_paq.push(['setTrackerUrl', " + "'" + newConfig.trackerURL + "'" + "]);";
var uEle = window.document.createElement("script");
uEle.text = updateScript;
uEle.className = "weba";
head.appendChild(uEle);
}
function insertTracker(newConfig, additionalData) {
var document =  window.parent.document;
var head = document.head || document.getElementsByTagName('head')[0];
if (trackerExists())
return;
if (!isConfigValid(newConfig))
return;
var trackerScript = generateTrackerScript(newConfig, additionalData);
var trackerElement = getOrCreateTracker();
trackerElement.text = trackerScript;
head.appendChild(trackerElement);
}
function applyTracker(additionalData) {
insertTracker(window.snWebaConfig, additionalData);
subscribe();
}
function applyTrackEvent(category, key, value, additionalValue) {
insertEventTracker(category, key, value, additionalValue);
subscribe();
}
function insertEventTracker(category, key, value, additionalValue) {
if (!isConfigValid(window.snWebaConfig))
return;
if (!trackerExists())
insertTracker(window.snWebaConfig);
if (typeof category != "string" || typeof key != "string" || typeof value != "string")
return;
if (additionalValue)
additionalValue = (typeof additionalValue == "number")? additionalValue: 0;
var eventItems = [ "trackEvent", category, key, value, additionalValue ];
var eventScript = "_paq.push(" + JSON.stringify(eventItems) + ");";
var document =  window.parent.document;
var head = document.head || document.getElementsByTagName('head')[0];
var scriptEle = window.document.createElement("script");
scriptEle.className = "weba";
scriptEle.text = eventScript;
head.appendChild(scriptEle);
}
function trackerExists() {
var document =  window.parent.document;
var trackEle = document.getElementById("webaTracker");
if (trackEle)
return true;
return false;
}
function isConfigValid(newConfig) {
var zero = "0";
var webaSiteId = (newConfig && newConfig.siteId) ? newConfig.siteId : zero;
var trackerURL = (newConfig && newConfig.trackerURL) ? newConfig.trackerURL : "";
if (webaSiteId == null || webaSiteId == "")
return false;
if (webaSiteId == zero )
return false;
if (trackerURL == null || trackerURL == "")
return false;
return true;
}
function getOrCreateTracker() {
var trackerScriptId = "webaTracker";
var document = window.parent.document;
var trackEle = document.getElementById(trackerScriptId);
if (trackEle)
return trackEle;
trackEle = document.createElement("script");
trackEle.id = trackerScriptId;
trackEle.type = "text/javascript";
return trackEle;
}
function getUserId(additionalData) {
if (window.NOW && window.NOW.user_id && window.NOW.user_id != "")
return window.NOW.user_id;
else if (additionalData && additionalData.userId){
return additionalData.userId;
}
else if (window.NOW && window.NOW.session_id)
return window.NOW.session_id;
else {
var userObj = (window.NOW)? window.NOW.user: null;
if (userObj && userObj.userID)
return userObj.userID;
}
return "";
}
function generateTrackerScript(webaConfig, additionalData) {
var trackerURL = webaConfig.trackerURL;
if (trackerURL.endsWith("/"))
trackerURL = webaConfig.trackerURL.substring(0, trackerURL.length - 1);
var userId = getUserId(additionalData);
var script = "var _paq = _paq || [];";
if (userId && userId != ""){
script += "_paq.push(['setUserId', '" + userId + "']);";
}
script += "_paq.push(['trackPageView']); _paq.push(['enableLinkTracking']);";
script += "(function() {_paq.push(['setTrackerUrl','" + trackerURL +  "']);"
+ "_paq.push(['setSiteId', " + webaConfig.siteId + "]);"
+ "var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; "
+ "g.defer=true; g.src='" + webaConfig.webaScriptPath + "'; "
+ "g.id='webaScript';s.parentNode.insertBefore(g,s); })();";
return script;
}
var api = {
trackPage: function(additionalData) {
if (window.document.readyState == "complete")
applyTracker(additionalData);
else
window.addEventListener("load", function() {
applyTracker(additionalData);
},	false);
},
trackEvent: function(category, key, value, additionalValue, delayInMs) {
if (delayInMs == undefined)
delayInMs = 3000;
window.setTimeout(function() {
applyTrackEvent(category, key, value, additionalValue);
}, delayInMs);
}
}
return api;
})();
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/js_includes_attachments.js */
/*! RESOURCE: /scripts/angularjs-1.4/thirdparty/angular-file-upload/angular-file-upload-all.js */
(function() {
function patchXHR(fnName, newFn) {
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
}
if (window.XMLHttpRequest && !window.XMLHttpRequest.__isFileAPIShim) {
patchXHR('setRequestHeader', function(orig) {
return function(header, value) {
if (header === '__setXHR_') {
var val = value(this);
if (val instanceof Function) {
val(this);
}
} else {
orig.apply(this, arguments);
}
}
});
}
var angularFileUpload = angular.module('angularFileUpload', []);
angularFileUpload.version = '3.1.2';
angularFileUpload.service('$upload', ['$http', '$q', '$timeout', function($http, $q, $timeout) {
function sendHttp(config) {
config.method = config.method || 'POST';
config.headers = config.headers || {};
config.transformRequest = config.transformRequest || function(data, headersGetter) {
if (window.ArrayBuffer && data instanceof window.ArrayBuffer) {
return data;
}
return $http.defaults.transformRequest[0](data, headersGetter);
};
var deferred = $q.defer();
var promise = deferred.promise;
config.headers['__setXHR_'] = function() {
return function(xhr) {
if (!xhr) return;
config.__XHR = xhr;
config.xhrFn && config.xhrFn(xhr);
xhr.upload.addEventListener('progress', function(e) {
e.config = config;
deferred.notify ? deferred.notify(e) : promise.progress_fn && $timeout(function(){promise.progress_fn(e)});
}, false);
xhr.upload.addEventListener('load', function(e) {
if (e.lengthComputable) {
e.config = config;
deferred.notify ? deferred.notify(e) : promise.progress_fn && $timeout(function(){promise.progress_fn(e)});
}
}, false);
};
};
$http(config).then(function(r){deferred.resolve(r)}, function(e){deferred.reject(e)}, function(n){deferred.notify(n)});
promise.success = function(fn) {
promise.then(function(response) {
fn(response.data, response.status, response.headers, config);
});
return promise;
};
promise.error = function(fn) {
promise.then(null, function(response) {
fn(response.data, response.status, response.headers, config);
});
return promise;
};
promise.progress = function(fn) {
promise.progress_fn = fn;
promise.then(null, null, function(update) {
fn(update);
});
return promise;
};
promise.abort = function() {
if (config.__XHR) {
$timeout(function() {
config.__XHR.abort();
});
}
return promise;
};
promise.xhr = function(fn) {
config.xhrFn = (function(origXhrFn) {
return function() {
origXhrFn && origXhrFn.apply(promise, arguments);
fn.apply(promise, arguments);
}
})(config.xhrFn);
return promise;
};
return promise;
}
this.upload = function(config) {
config.headers = config.headers || {};
config.headers['Content-Type'] = undefined;
var origTransformRequest = config.transformRequest;
config.transformRequest = config.transformRequest ?
(Object.prototype.toString.call(config.transformRequest) === '[object Array]' ?
config.transformRequest : [config.transformRequest]) : [];
config.transformRequest.push(function(data, headerGetter) {
var formData = new FormData();
var allFields = {};
for (var key in config.fields) allFields[key] = config.fields[key];
if (data) allFields['data'] = data;
if (config.formDataAppender) {
for (var key in allFields) {
config.formDataAppender(formData, key, allFields[key]);
}
} else {
for (var key in allFields) {
var val = allFields[key];
if (val !== undefined) {
if (Object.prototype.toString.call(val) === '[object String]') {
formData.append(key, val);
} else {
if (config.sendObjectsAsJsonBlob && typeof val === 'object') {
formData.append(key, new Blob([val], { type: 'application/json' }));
} else {
formData.append(key, JSON.stringify(val));
}
}
}
}
}
if (config.file != null) {
var fileFormName = config.fileFormDataName || 'file';
if (Object.prototype.toString.call(config.file) === '[object Array]') {
var isFileFormNameString = Object.prototype.toString.call(fileFormName) === '[object String]';
for (var i = 0; i < config.file.length; i++) {
formData.append(isFileFormNameString ? fileFormName : fileFormName[i], config.file[i],
(config.fileName && config.fileName[i]) || config.file[i].name);
}
} else {
formData.append(fileFormName, config.file, config.fileName || config.file.name);
}
}
return formData;
});
return sendHttp(config);
};
this.http = function(config) {
return sendHttp(config);
};
}]);
angularFileUpload.directive('ngFileSelect', [ '$parse', '$timeout', '$compile',
function($parse, $timeout, $compile) { return {
restrict: 'AEC',
require:'?ngModel',
link: function(scope, elem, attr, ngModel) {
handleFileSelect(scope, elem, attr, ngModel, $parse, $timeout, $compile);
}
}}]);
function handleFileSelect(scope, elem, attr, ngModel, $parse, $timeout, $compile) {
function isInputTypeFile() {
return elem[0].tagName.toLowerCase() === 'input' && elem.attr('type') && elem.attr('type').toLowerCase() === 'file';
}
var watchers = [];
function watchForRecompile(attrVal) {
$timeout(function() {
if (elem.parent().length) {
watchers.push(scope.$watch(attrVal, function(val, oldVal) {
if (val != oldVal) {
recompileElem();
}
}));
}
});
}
function recompileElem() {
var clone = elem.clone();
if (elem.attr('__afu_gen__')) {
angular.element(document.getElementById(elem.attr('id').substring(1))).remove();
}
if (elem.parent().length) {
for (var i = 0; i < watchers.length; i++) {
watchers[i]();
}
elem.replaceWith(clone);
$compile(clone)(scope);
}
return clone;
}
function bindAttr(bindAttr, attrName) {
if (bindAttr) {
watchForRecompile(bindAttr);
var val = $parse(bindAttr)(scope);
if (val) {
elem.attr(attrName, val);
attr[attrName] = val;
} else {
elem.attr(attrName, null);
delete attr[attrName];
}
}
}
bindAttr(attr.ngMultiple, 'multiple');
bindAttr(attr.ngAccept, 'ng-accept');
bindAttr(attr.ngCapture, 'capture');
if (attr['ngFileSelect'] != '') {
attr.ngFileChange = attr.ngFileSelect;
}
function onChangeFn(evt) {
var files = [], fileList, i;
fileList = evt.__files_ || (evt.target && evt.target.files);
updateModel(fileList, attr, ngModel, scope, evt);
};
var fileElem = elem;
if (!isInputTypeFile()) {
fileElem = angular.element('<input type="file">')
if (elem.attr('multiple')) fileElem.attr('multiple', elem.attr('multiple'));
if (elem.attr('accept')) fileElem.attr('accept', elem.attr('accept'));
if (elem.attr('capture')) fileElem.attr('capture', elem.attr('capture'));
for (var key in attr) {
if (key.indexOf('inputFile') == 0) {
var name = key.substring('inputFile'.length);
name = name[0].toLowerCase() + name.substring(1);
fileElem.attr(name, attr[key]);
}
}
fileElem.css('width', '0px').css('height', '0px').css('position', 'absolute').css('padding', 0).css('margin', 0)
.css('overflow', 'hidden').attr('tabindex', '-1').css('opacity', 0).attr('__afu_gen__', true);
elem.attr('__refElem__', true);
fileElem[0].__refElem__ = elem[0];
elem.parent()[0].insertBefore(fileElem[0], elem[0])
elem.css('overflow', 'hidden');
elem.bind('click', function(e) {
if (!resetAndClick(e)) {
fileElem[0].click();
}
});
} else {
elem.bind('click', resetAndClick);
}
function resetAndClick(evt) {
if (fileElem[0].value != null && fileElem[0].value != '') {
fileElem[0].value = null;
if (navigator.userAgent.indexOf("Trident/7") === -1) {
onChangeFn({target: {files: []}});
}
}
if (!elem.attr('__afu_clone__')) {
if (navigator.appVersion.indexOf("MSIE 10") !== -1 || navigator.userAgent.indexOf("Trident/7") !== -1) {
var clone = recompileElem();
clone.attr('__afu_clone__', true);
clone[0].click();
evt.preventDefault();
evt.stopPropagation();
return true;
}
} else {
elem.attr('__afu_clone__', null);
}
}
fileElem.bind('change', onChangeFn);
elem.on('$destroy', function() {
for (var i = 0; i < watchers.length; i++) {
watchers[i]();
}
if (elem[0] != fileElem[0]) fileElem.remove();
});
watchers.push(scope.$watch(attr.ngModel, function(val, oldVal) {
if (val != oldVal && (val == null || !val.length)) {
if (navigator.appVersion.indexOf("MSIE 10") !== -1) {
recompileElem();
} else {
fileElem[0].value = null;
}
}
}));
function updateModel(fileList, attr, ngModel, scope, evt) {
var files = [], rejFiles = [];
var accept = $parse(attr.ngAccept)(scope);
var regexp = angular.isString(accept) && accept ? new RegExp(globStringToRegex(accept), 'gi') : null;
var acceptFn = regexp ? null : attr.ngAccept;
for (var i = 0; i < fileList.length; i++) {
var file = fileList.item(i);
if ((!regexp || file.type.match(regexp) || (file.name != null && file.name.match(regexp))) &&
(!acceptFn || $parse(acceptFn)(scope, {$file: file, $event: evt}))) {
files.push(file);
} else {
rejFiles.push(file);
}
}
$timeout(function() {
if (ngModel) {
$parse(attr.ngModel).assign(scope, files);
ngModel && ngModel.$setViewValue(files != null && files.length == 0 ? '' : files);
if (attr.ngModelRejected) {
$parse(attr.ngModelRejected).assign(scope, rejFiles);
}
}
if (attr.ngFileChange && attr.ngFileChange != "") {
$parse(attr.ngFileChange)(scope, {
$files: files,
$rejectedFiles: rejFiles,
$event: evt
});
}
});
}
}
angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', '$location', function($parse, $timeout, $location) { return {
restrict: 'AEC',
require:'?ngModel',
link: function(scope, elem, attr, ngModel) {
handleDrop(scope, elem, attr, ngModel, $parse, $timeout, $location);
}
}}]);
angularFileUpload.directive('ngNoFileDrop', function() {
return function(scope, elem, attr) {
if (dropAvailable()) elem.css('display', 'none')
}
});
angularFileUpload.directive('ngFileDropAvailable', [ '$parse', '$timeout', function($parse, $timeout) {
return function(scope, elem, attr) {
if (dropAvailable()) {
var fn = $parse(attr['ngFileDropAvailable']);
$timeout(function() {
fn(scope);
});
}
}
}]);
function handleDrop(scope, elem, attr, ngModel, $parse, $timeout, $location) {
var available = dropAvailable();
if (attr['dropAvailable']) {
$timeout(function() {
scope.dropAvailable ? scope.dropAvailable.value = available : scope.dropAvailable = available;
});
}
if (!available) {
if ($parse(attr.hideOnDropNotAvailable)(scope) != false) {
elem.css('display', 'none');
}
return;
}
var leaveTimeout = null;
var stopPropagation = $parse(attr.stopPropagation)(scope);
var dragOverDelay = 1;
var accept = $parse(attr.ngAccept)(scope) || attr.accept;
var regexp = angular.isString(accept) && accept ? new RegExp(globStringToRegex(accept), 'gi') : null;
var acceptFn = regexp ? null : attr.ngAccept;
var actualDragOverClass;
elem[0].addEventListener('dragover', function(evt) {
evt.preventDefault();
if (stopPropagation) evt.stopPropagation();
if (navigator.userAgent.indexOf("Chrome") > -1) {
var b = evt.dataTransfer.effectAllowed;
evt.dataTransfer.dropEffect = ('move' === b || 'linkMove' === b) ? 'move' : 'copy';
}
$timeout.cancel(leaveTimeout);
if (!scope.actualDragOverClass) {
actualDragOverClass = calculateDragOverClass(scope, attr, evt);
}
elem.addClass(actualDragOverClass);
}, false);
elem[0].addEventListener('dragenter', function(evt) {
evt.preventDefault();
if (stopPropagation) evt.stopPropagation();
}, false);
elem[0].addEventListener('dragleave', function(evt) {
leaveTimeout = $timeout(function() {
elem.removeClass(actualDragOverClass);
actualDragOverClass = null;
}, dragOverDelay || 1);
}, false);
if (attr['ngFileDrop'] != '') {
attr.ngFileChange = attr['ngFileDrop'];
}
elem[0].addEventListener('drop', function(evt) {
evt.preventDefault();
if (stopPropagation) evt.stopPropagation();
elem.removeClass(actualDragOverClass);
actualDragOverClass = null;
extractFiles(evt, function(files, rejFiles) {
$timeout(function() {
if (ngModel) {
$parse(attr.ngModel).assign(scope, files);
ngModel && ngModel.$setViewValue(files != null && files.length == 0 ? '' : files);
}
if (attr['ngModelRejected']) {
if (scope[attr.ngModelRejected]) {
$parse(attr.ngModelRejected).assign(scope, rejFiles);
}
}
});
$timeout(function() {
$parse(attr.ngFileChange)(scope, {
$files: files,
$rejectedFiles: rejFiles,
$event: evt
});
});
}, $parse(attr.allowDir)(scope) != false, attr.multiple || $parse(attr.ngMultiple)(scope));
}, false);
function calculateDragOverClass(scope, attr, evt) {
var valid = true;
if (regexp || acceptFn) {
var items = evt.dataTransfer.items;
if (items != null) {
for (var i = 0 ; i < items.length && valid; i++) {
valid = valid && (items[i].kind == 'file' || items[i].kind == '') &&
((acceptFn && $parse(acceptFn)(scope, {$file: items[i], $event: evt})) ||
(regexp && (items[i].type != null && items[i].type.match(regexp)) ||
(items[i].name != null && items[i].name.match(regexp))));
}
}
}
var clazz = $parse(attr.dragOverClass)(scope, {$event : evt});
if (clazz) {
if (clazz.delay) dragOverDelay = clazz.delay;
if (clazz.accept) clazz = valid ? clazz.accept : clazz.reject;
}
return clazz || attr['dragOverClass'] || 'dragover';
}
function extractFiles(evt, callback, allowDir, multiple) {
var files = [], rejFiles = [], items = evt.dataTransfer.items, processing = 0;
function addFile(file) {
if ((!regexp || file.type.match(regexp) || (file.name != null && file.name.match(regexp))) &&
(!acceptFn || $parse(acceptFn)(scope, {$file: file, $event: evt}))) {
files.push(file);
} else {
rejFiles.push(file);
}
}
if (items && items.length > 0 && $location.protocol() != 'file') {
for (var i = 0; i < items.length; i++) {
if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {
var entry = items[i].webkitGetAsEntry();
if (entry.isDirectory && !allowDir) {
continue;
}
if (entry != null) {
traverseFileTree(files, entry);
}
} else {
var f = items[i].getAsFile();
if (f != null) addFile(f);
}
if (!multiple && files.length > 0) break;
}
} else {
var fileList = evt.dataTransfer.files;
if (fileList != null) {
for (var i = 0; i < fileList.length; i++) {
addFile(fileList.item(i));
if (!multiple && files.length > 0) break;
}
}
}
var delays = 0;
(function waitForProcess(delay) {
$timeout(function() {
if (!processing) {
if (!multiple && files.length > 1) {
var i = 0;
while (files[i].type == 'directory') i++;
files = [files[i]];
}
callback(files, rejFiles);
} else {
if (delays++ * 10 < 20 * 1000) {
waitForProcess(10);
}
}
}, delay || 0)
})();
function traverseFileTree(files, entry, path) {
if (entry != null) {
if (entry.isDirectory) {
var filePath = (path || '') + entry.name;
addFile({name: entry.name, type: 'directory', path: filePath});
var dirReader = entry.createReader();
var entries = [];
processing++;
var readEntries = function() {
dirReader.readEntries(function(results) {
try {
if (!results.length) {
for (var i = 0; i < entries.length; i++) {
traverseFileTree(files, entries[i], (path ? path : '') + entry.name + '/');
}
processing--;
} else {
entries = entries.concat(Array.prototype.slice.call(results || [], 0));
readEntries();
}
} catch (e) {
processing--;
console.error(e);
}
}, function() {
processing--;
});
};
readEntries();
} else {
processing++;
entry.file(function(file) {
try {
processing--;
file.path = (path ? path : '') + file.name;
addFile(file);
} catch (e) {
processing--;
console.error(e);
}
}, function(e) {
processing--;
});
}
}
}
}
}
function dropAvailable() {
var div = document.createElement('div');
return ('draggable' in div) && ('ondrop' in div);
}
function globStringToRegex(str) {
if (str.length > 2 && str[0] === '/' && str[str.length -1] === '/') {
return str.substring(1, str.length - 1);
}
var split = str.split(','), result = '';
if (split.length > 1) {
for (var i = 0; i < split.length; i++) {
result += '(' + globStringToRegex(split[i]) + ')';
if (i < split.length - 1) {
result += '|'
}
}
} else {
if (str.indexOf('.') == 0) {
str= '*' + str;
}
result = '^' + str.replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + '-]', 'g'), '\\$&') + '$';
result = result.replace(/\\\*/g, '.*').replace(/\\\?/g, '.');
}
return result;
}
var ngFileUpload = angular.module('ngFileUpload', []);
for (var key in angularFileUpload) {
ngFileUpload[key] = angularFileUpload[key];
}
})();
(function() {
var hasFlash = function() {
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) return true;
} catch(e) {
if (navigator.mimeTypes['application/x-shockwave-flash'] != undefined) return true;
}
return false;
}
function patchXHR(fnName, newFn) {
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
};
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
var initializeUploadListener = function(xhr) {
if (!xhr.__listeners) {
if (!xhr.upload) xhr.upload = {};
xhr.__listeners = [];
var origAddEventListener = xhr.upload.addEventListener;
xhr.upload.addEventListener = function(t, fn, b) {
xhr.__listeners[t] = fn;
origAddEventListener && origAddEventListener.apply(this, arguments);
};
}
}
patchXHR('open', function(orig) {
return function(m, url, b) {
initializeUploadListener(this);
this.__url = url;
try {
orig.apply(this, [m, url, b]);
} catch (e) {
if (e.message.indexOf('Access is denied') > -1) {
this.__origError = e;
orig.apply(this, [m, '_fix_for_ie_crossdomain__', b]);
}
}
}
});
patchXHR('getResponseHeader', function(orig) {
return function(h) {
return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(h) : (orig == null ? null : orig.apply(this, [h]));
};
});
patchXHR('getAllResponseHeaders', function(orig) {
return function() {
return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : (orig == null ? null : orig.apply(this));
}
});
patchXHR('abort', function(orig) {
return function() {
return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : (orig == null ? null : orig.apply(this));
}
});
patchXHR('setRequestHeader', function(orig) {
return function(header, value) {
if (header === '__setXHR_') {
initializeUploadListener(this);
var val = value(this);
if (val instanceof Function) {
val(this);
}
} else {
this.__requestHeaders = this.__requestHeaders || {};
this.__requestHeaders[header] = value;
orig.apply(this, arguments);
}
}
});
function redefineProp(xhr, prop, fn) {
try {
Object.defineProperty(xhr, prop, {get: fn});
} catch (e) {}
}
patchXHR('send', function(orig) {
return function() {
var xhr = this;
if (arguments[0] && arguments[0].__isFileAPIShim) {
var formData = arguments[0];
var config = {
url: xhr.__url,
jsonp: false,
cache: true,
complete: function(err, fileApiXHR) {
xhr.__completed = true;
if (!err && xhr.__listeners['load'])
xhr.__listeners['load']({type: 'load', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (!err && xhr.__listeners['loadend'])
xhr.__listeners['loadend']({type: 'loadend', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (err === 'abort' && xhr.__listeners['abort'])
xhr.__listeners['abort']({type: 'abort', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (fileApiXHR.status !== undefined) redefineProp(xhr, 'status', function() {return (fileApiXHR.status == 0 && err && err !== 'abort') ? 500 : fileApiXHR.status});
if (fileApiXHR.statusText !== undefined) redefineProp(xhr, 'statusText', function() {return fileApiXHR.statusText});
redefineProp(xhr, 'readyState', function() {return 4});
if (fileApiXHR.response !== undefined) redefineProp(xhr, 'response', function() {return fileApiXHR.response});
var resp = fileApiXHR.responseText || (err && fileApiXHR.status == 0 && err !== 'abort' ? err : undefined);
redefineProp(xhr, 'responseText', function() {return resp});
redefineProp(xhr, 'response', function() {return resp});
if (err) redefineProp(xhr, 'err', function() {return err});
xhr.__fileApiXHR = fileApiXHR;
if (xhr.onreadystatechange) xhr.onreadystatechange();
if (xhr.onload) xhr.onload();
},
fileprogress: function(e) {
e.target = xhr;
xhr.__listeners['progress'] && xhr.__listeners['progress'](e);
xhr.__total = e.total;
xhr.__loaded = e.loaded;
if (e.total === e.loaded) {
var _this = this
setTimeout(function() {
if (!xhr.__completed) {
xhr.getAllResponseHeaders = function(){};
_this.complete(null, {status: 204, statusText: 'No Content'});
}
}, FileAPI.noContentTimeout || 10000);
}
},
headers: xhr.__requestHeaders
}
config.data = {};
config.files = {}
for (var i = 0; i < formData.data.length; i++) {
var item = formData.data[i];
if (item.val != null && item.val.name != null && item.val.size != null && item.val.type != null) {
config.files[item.key] = item.val;
} else {
config.data[item.key] = item.val;
}
}
setTimeout(function() {
if (!hasFlash()) {
throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
}
xhr.__fileApiXHR = FileAPI.upload(config);
}, 1);
} else {
if (this.__origError) {
throw this.__origError;
}
orig.apply(xhr, arguments);
}
}
});
window.XMLHttpRequest.__isFileAPIShim = true;
var addFlash = function(elem) {
if (!hasFlash()) {
throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
}
var el = angular.element(elem);
if (!el.attr('disabled')) {
var hasFileSelect = false;
for (var i = 0; i < el[0].attributes.length; i++) {
var attrib = el[0].attributes[i];
if (attrib.name.indexOf('file-select') !== -1) {
hasFileSelect = true;
break;
}
}
if (!el.hasClass('js-fileapi-wrapper') && (hasFileSelect || el.attr('__afu_gen__') != null)) {
el.addClass('js-fileapi-wrapper');
if (el.attr('__afu_gen__') != null) {
var ref = (el[0].__refElem__ && angular.element(el[0].__refElem__)) || el;
while (ref && !ref.attr('__refElem__')) {
ref = angular.element(ref[0].nextSibling);
}
ref.bind('mouseover', function() {
if (el.parent().css('position') === '' || el.parent().css('position') === 'static') {
el.parent().css('position', 'relative');
}
el.css('position', 'absolute').css('top', ref[0].offsetTop + 'px').css('left', ref[0].offsetLeft + 'px')
.css('width', ref[0].offsetWidth + 'px').css('height', ref[0].offsetHeight + 'px')
.css('padding', ref.css('padding')).css('margin', ref.css('margin')).css('filter', 'alpha(opacity=0)');
ref.attr('onclick', '');
el.css('z-index', '1000');
});
}
}
}
};
var changeFnWrapper = function(fn) {
return function(evt) {
var files = FileAPI.getFiles(evt);
for (var i = 0; i < files.length; i++) {
if (files[i].size === undefined) files[i].size = 0;
if (files[i].name === undefined) files[i].name = 'file';
if (files[i].type === undefined) files[i].type = 'undefined';
}
if (!evt.target) {
evt.target = {};
}
evt.target.files = files;
if (evt.target.files != files) {
evt.__files_ = files;
}
(evt.__files_ || evt.target.files).item = function(i) {
return (evt.__files_ || evt.target.files)[i] || null;
}
if (fn) fn.apply(this, [evt]);
};
};
var isFileChange = function(elem, e) {
return (e.toLowerCase() === 'change' || e.toLowerCase() === 'onchange') && elem.getAttribute('type') == 'file';
}
if (HTMLInputElement.prototype.addEventListener) {
HTMLInputElement.prototype.addEventListener = (function(origAddEventListener) {
return function(e, fn, b, d) {
if (isFileChange(this, e)) {
addFlash(this);
origAddEventListener.apply(this, [e, changeFnWrapper(fn), b, d]);
} else {
origAddEventListener.apply(this, [e, fn, b, d]);
}
}
})(HTMLInputElement.prototype.addEventListener);
}
if (HTMLInputElement.prototype.attachEvent) {
HTMLInputElement.prototype.attachEvent = (function(origAttachEvent) {
return function(e, fn) {
if (isFileChange(this, e)) {
addFlash(this);
if (window.jQuery) {
angular.element(this).bind('change', changeFnWrapper(null));
} else {
origAttachEvent.apply(this, [e, changeFnWrapper(fn)]);
}
} else {
origAttachEvent.apply(this, [e, fn]);
}
}
})(HTMLInputElement.prototype.attachEvent);
}
window.FormData = FormData = function() {
return {
append: function(key, val, name) {
if (val.__isFileAPIBlobShim) {
val = val.data[0];
}
this.data.push({
key: key,
val: val,
name: name
});
},
data: [],
__isFileAPIShim: true
};
};
window.Blob = Blob = function(b) {
return {
data: b,
__isFileAPIBlobShim: true
};
};
(function () {
if (!window.FileAPI) {
window.FileAPI = {};
}
if (FileAPI.forceLoad) {
FileAPI.html5 = false;
}
if (!FileAPI.upload) {
var jsUrl, basePath, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
if (window.FileAPI.jsUrl) {
jsUrl = window.FileAPI.jsUrl;
} else if (window.FileAPI.jsPath) {
basePath = window.FileAPI.jsPath;
} else {
for (i = 0; i < allScripts.length; i++) {
src = allScripts[i].src;
index = src.search(/\/angular\-file\-upload[\-a-zA-z0-9\.]*\.js/)
if (index > -1) {
basePath = src.substring(0, index + 1);
break;
}
}
}
if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js');
document.getElementsByTagName('head')[0].appendChild(script);
FileAPI.hasFlash = hasFlash();
}
})();
FileAPI.disableFileInput = function(elem, disable) {
if (disable) {
elem.removeClass('js-fileapi-wrapper')
} else {
elem.addClass('js-fileapi-wrapper');
}
}
}
if (!window.FileReader) {
window.FileReader = function() {
var _this = this, loadStarted = false;
this.listeners = {};
this.addEventListener = function(type, fn) {
_this.listeners[type] = _this.listeners[type] || [];
_this.listeners[type].push(fn);
};
this.removeEventListener = function(type, fn) {
_this.listeners[type] && _this.listeners[type].splice(_this.listeners[type].indexOf(fn), 1);
};
this.dispatchEvent = function(evt) {
var list = _this.listeners[evt.type];
if (list) {
for (var i = 0; i < list.length; i++) {
list[i].call(_this, evt);
}
}
};
this.onabort = this.onerror = this.onload = this.onloadstart = this.onloadend = this.onprogress = null;
var constructEvent = function(type, evt) {
var e = {type: type, target: _this, loaded: evt.loaded, total: evt.total, error: evt.error};
if (evt.result != null) e.target.result = evt.result;
return e;
};
var listener = function(evt) {
if (!loadStarted) {
loadStarted = true;
_this.onloadstart && _this.onloadstart(constructEvent('loadstart', evt));
}
if (evt.type === 'load') {
_this.onloadend && _this.onloadend(constructEvent('loadend', evt));
var e = constructEvent('load', evt);
_this.onload && _this.onload(e);
_this.dispatchEvent(e);
} else if (evt.type === 'progress') {
var e = constructEvent('progress', evt);
_this.onprogress && _this.onprogress(e);
_this.dispatchEvent(e);
} else {
var e = constructEvent('error', evt);
_this.onerror && _this.onerror(e);
_this.dispatchEvent(e);
}
};
this.readAsArrayBuffer = function(file) {
FileAPI.readAsBinaryString(file, listener);
}
this.readAsBinaryString = function(file) {
FileAPI.readAsBinaryString(file, listener);
}
this.readAsDataURL = function(file) {
FileAPI.readAsDataURL(file, listener);
}
this.readAsText = function(file) {
FileAPI.readAsText(file, listener);
}
}
}
})();
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/_module.js */
angular.module('sn.common.attachments', [
'angularFileUpload',
'sn.common.util'
]);
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/factory.nowAttachmentHandler.js */
angular.module("sn.common.attachments").factory("nowAttachmentHandler", function($http, nowServer, $upload, $q, $rootScope, $timeout,
snNotification, snAttachmentHandler, i18n) {
"use strict";
$rootScope.$on('attachment.updated', function(evt,options) {
if (options.operation === 'update' && options.state === 'not_available')
snAttachmentHandler.showMessage('error',i18n.getMessage('Upload file scan failed').withValues([options.filename]));
});
return function(setAttachments, appendError) {
var self = this;
self.cardUploading = '';
self.setAttachments = setAttachments;
self.appendError = appendError;
self.encryptionContext = '';
self.ADDED = 'added';
self.DELETED = 'deleted';
self.RENAMED = 'renamed';
self.getAttachmentList = function(action) {
var url = nowServer.getURL('ngk_attachments', {
action: 'list',
sys_id: self.tableId,
table: self.tableName
});
var worker = $http.get;
if (!self.tableId) {
worker = function() {
return $q(function(resolve) {
resolve({data:{files:[]}});
});
};
}
worker(url).then(function(response) {
var attachments = response.data.files || [];
attachments = self.canViewImage(attachments);
self.setAttachments(attachments, action);
if (self.startedUploadingTimeout || self.errorTimeout) {
self.stopAllUploading();
$rootScope.$broadcast('board.uploading.end');
}
});
};
self.canViewImage = function(attachments) {
if (typeof g_attachment_force_download_all_mime_types != "undefined" && typeof g_attachment_force_download_mime_type != "undefined") {
var contentTypes = g_attachment_force_download_mime_type.split(',');
for (var i = 0; i < attachments.length; i++) {
var attachmentFile = attachments[i];
var canDownloadAttachmentFromThumbSrc = g_attachment_force_download_all_mime_types;
if (!canDownloadAttachmentFromThumbSrc) {
if (contentTypes.indexOf(attachmentFile.content_type) != -1)
canDownloadAttachmentFromThumbSrc = true;
}
attachmentFile.viewImage = (attachmentFile.thumbSrc || attachmentFile.thumbnail_path) && !canDownloadAttachmentFromThumbSrc;
}
}
return attachments;
};
self.stopAllUploading = function() {
$timeout.cancel(self.errorTimeout);
$timeout.cancel(self.startedUploadingTimeout);
hideProgressBar();
$rootScope.$broadcast("attachment.upload.stop");
};
self.setEncryptionContext = function(context) {
self.encryptionContext = context;
}
self.manageFocus = function() {
if (self.attachmentAction === self.RENAMED && self.updatedAttachmentSysId) {
$timeout(function() {
var editButton = $('#'+ self.updatedAttachmentSysId + ' button')[0];
if (editButton)
editButton.focus();
delete self.attachmentAction;
delete self.updatedAttachmentSysId;
delete self.editButton;
});
}
}
self.onFileSelect = function($files) {
if(!$files.length)
return;
var url = nowServer.getURL('ngk_attachments', {
sys_id: self.tableId,
table: self.tableName,
action: 'add'
});
self.cardUploading = self.tableId;
self.maxfiles = $files.length;
self.fileCount = 1;
self.filesUploaded = self.maxfiles;
self.startedUploadingTimeout = $timeout(showUploaderDialog, 1500);
for (var i = 0; i < self.maxfiles; i++) {
if (parseInt($files[i].size) > parseInt(self.fileUploadSizeLimit)) {
self.stopAllUploading();
$rootScope.$broadcast('dialog.upload_too_large.show');
return;
}
}
var fields = {
attachments_modified: 'true',
sysparm_table: self.tableName,
sysparm_sys_id: self.tableId,
sysparm_nostack: 'yes',
sysparm_encryption_context: self.encryptionContext,
sysparm_ck: window.g_ck
};
var idx = 0;
var fileNames = [];
var processFile = function() {
$rootScope.$broadcast("attachment.upload.start");
var ff = $files[idx];
self.upload = $upload.upload({
url: url,
fields: fields,
fileFormDataName: 'attachFile',
file: ff
}).progress(function(evt) {
var percent = parseInt(100.0 * evt.loaded / evt.total, 10);
updateProgress(percent);
}).success(function(data, status, headers, config) {
processError(data);
if (!data.error)
fileNames.push(data.file_name);
if (self.filesUploaded <= 0)
self.cardUploading = '';
idx++;
if (idx < $files.length)
processFile();
else {
self.stopAllUploading();
self.getAttachmentList(self.ADDED);
if (fileNames.length)
$rootScope.$broadcast("attachment.upload.success", {names: fileNames.join(",")});
}
});
}
processFile();
};
self.downloadAttachment = function(attachment) {
var url = '/sys_attachment.do?sys_id=' + attachment.sys_id;
window.open(url, '_blank');
};
self.viewAttachment = function($event, attachment) {
var url = window.location.protocol + '//' + window.location.host;
url += '/sys_attachment.do?sysparm_referring_url=tear_off&view=true&sys_id=' + attachment.sys_id;
window.open(url, attachment.sys_id,
"toolbar=no,menubar=no,personalbar=no,width=800,height=600,scrollbars=yes,resizable=yes");
};
self.editAttachment = function($event, attachment) {
self.editButton = $event.currentTarget;
var parent = $(self.editButton).closest('.file-attachment');
var thumbnail = parent.find('.thumbnail');
var input = parent.find('input');
var tools = parent.find('.tools');
var fileName = attachment.file_name;
if (attachment.file_name.indexOf('.') !== -1) {
attachment.ext = fileName.match(/(\.[^\.]+)$/i)[0];
fileName = attachment.file_name.replace(/(\.[^\.]+)$/i, '');
}
input.val(fileName);
var w = input.prev().width();
input.width(w);
input.prev().hide();
input.css('display', 'block');
thumbnail.addClass('state-locked');
tools.find('.delete-edit').hide();
tools.find('.rename-cancel').css('display', 'inline-block');
input.focus();
}
self.onKeyDown = function($event, attachment) {
var keyCode = $event.keyCode;
if (keyCode === 13) {
$event.stopPropagation();
$event.preventDefault();
self.updateAttachment($event, attachment);
}else if (keyCode === 27) {
$event.stopPropagation();
$event.preventDefault();
self.updateAttachment($event);
}
};
self.updateAttachment = function($event, attachment) {
if (self.renameInProgress)
return;
var el = $($event.currentTarget);
var parent = el.closest('.file-attachment');
var thumbnail = parent.find('.thumbnail');
var input = parent.find('input');
var link = parent.find('a');
var tools = parent.find('.tools');
if (attachment) {
var fileName = input.val();
if (fileName.length) {
fileName += attachment.ext;
if (fileName !== attachment.file_name) {
link.text(fileName);
self.renameAttachment(attachment, fileName);
} else
setFocus();
}
}
input.hide();
input.prev().show();
tools.find('.rename-cancel').hide();
thumbnail.removeClass('state-locked');
tools.find('.delete-edit').css('display', 'inline-block');
self.editButton && self.editButton.focus();
};
self.dismissMsg = function($event, $index, errorMessages) {
var msg = $($event.currentTarget);
msg.addClass('remove');
setTimeout(function() {
msg.remove();
errorMessages.splice($index, 1);
}, 500);
};
$rootScope.$on("dialog.comment_form.close", function() {
hideProgressBar();
});
self.openSelector = function($event) {
$event.stopPropagation();
$event.preventDefault();
var target = $($event.currentTarget);
var input = target.parent().find('input[type=file]');
$timeout(function() {
input.click();
});
}
self.deleteAttachment = function (attachment) {
if (attachment && attachment.sys_id) {
$('#' + attachment.sys_id).hide();
var url = nowServer.getURL('ngk_attachments', {
action: 'delete',
sys_id: attachment.sys_id
});
$http.get(url).then(function (response) {
processError(response.data);
self.getAttachmentList(self.DELETED);
if (!response.data.error)
$rootScope.$broadcast("attachment.delete.success");
});
}
};
function setFocus() {
if (self.editButton) {
$(self.editButton).focus();
delete self.editButton;
}
}
self.renameAttachment = function (attachment, newName) {
self.renameInProgress = true;
$http({
url: nowServer.getURL('ngk_attachments'),
method: 'POST',
params: {
action: 'rename',
sys_id: attachment.sys_id,
new_name: newName
}
}).then(function (response) {
processError(response.data);
self.attachmentAction = self.RENAMED;
self.updatedAttachmentSysId = attachment.sys_id;
self.getAttachmentList(self.RENAMED);
self.renameInProgress = false;
if (!response.data.error)
$rootScope.$broadcast("attachment.rename.success");
});
};
self.scanAttachment = function (attachment) {
snAttachmentHandler.scanAttachment(attachment);
};
function showUploaderDialog() {
$rootScope.$broadcast('board.uploading.start', self.tableId);
}
function updateProgress(percent) {
if (self.prevPercent === percent && self.fileCount <= self.maxfiles)
return;
if (self.fileCount <= self.maxfiles) {
if (percent > 99)
self.fileCount++;
if (self.fileCount <= self.maxfiles) {
$timeout.cancel(self.errorTimeout);
self.errorTimeout = $timeout(broadcastError, 15000);
$('.progress-label').text('Uploading file ' + self.fileCount + ' of ' + self.maxfiles);
$('.upload-progress').val(percent);
$('.progress-wrapper').show();
}
}
self.prevPercent = percent;
}
function hideProgressBar() {
try {
$('.progress-wrapper').hide();
} catch(e) {}
}
self.setParams = function(tableName, tableId, fileUploadSizeLimit) {
self.tableName = tableName;
self.tableId = tableId;
self.fileUploadSizeLimit = fileUploadSizeLimit;
};
function broadcastError() {
$rootScope.$broadcast('board.uploading.end');
snNotification.show('error', 'An error occured when trying to upload your file. Please try again.');
self.stopAllUploading();
}
function processError(data) {
if (!data.error)
return;
self.appendError({
msg: data.error,
fileName: ''
});
}
};
});
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/directive.nowAttachmentsList.js */
angular.module('sn.common.attachments').directive('nowAttachmentsList', function(getTemplateUrl) {
'use strict';
function updateTrackByKey(scope) {
if (scope.attachments && scope.attachments.length > 0) {
scope.hasTrackByKey = scope.hasTrackByKey || scope.attachments[0].hasOwnProperty('trackByKey');
if (!scope.hasTrackByKey) {
scope.attachments.forEach(function(attachment) {
attachment.trackByKey = attachment.sys_id + attachment.state + attachment.file_name.replace(/\s/g, '') + attachment.viewImage;
});
}
}
}
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl("attachments_list.xml"),
link: function(scope, elem, attrs, $parse) {
scope.icons = {
preview: attrs.previewIcon,
edit: attrs.editIcon,
delete: attrs.deleteIcon,
ok: attrs.okIcon,
cancel: attrs.cancelIcon
};
scope.hasTrackByKey = false;
updateTrackByKey(scope);
scope.$watch('attachments', function() {
updateTrackByKey(scope);
});
scope.listClass = "list-group";
var inline = scope.$eval(attrs.inline);
if (inline)
scope.listClass = "list-inline";
scope.entryTemplate = getTemplateUrl(attrs.template || "attachment");
}
};
});
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/factory.snAttachmentHandler.js */
angular.module('sn.common.attachments').factory('snAttachmentHandler', function(urlTools, $http, $upload, $window, $q, $rootScope, i18n) {
"use strict";
return {
getViewUrl: getViewUrl,
create: createAttachmentHandler,
deleteAttachment: deleteAttachmentBySysID,
renameAttachment: renameAttachmentBySysID,
showMessage : showMessage,
scanAttachment : scanAttachment
};
function getViewUrl(sysId) {
return '/sys_attachment.do?sys_id=' + sysId;
}
function showMessage(type, message) {
$rootScope.$broadcast("$$uiNotification", {type: type, message: message});
}
function deleteAttachmentBySysID(sysID) {
var url = urlTools.getURL('ngk_attachments', {
action: 'delete',
sys_id: sysID
});
return $http.get(url);
}
function renameAttachmentBySysID(sysID, newName) {
var url = urlTools.getURL('ngk_attachments', {
action: 'rename',
sys_id: sysID,
new_name: newName
});
return $http.post(url);
}
var isAjaxInProgress = false;
function updateState(options) {
this.state = options.state;
$rootScope.$broadcast("sn.attachment.scanned");
if (options.msg)
showMessage(options.type, options.msg);
}
function scanAttachment(attachment) {
if (isAjaxInProgress)
return;
isAjaxInProgress = true;
var updateAttachmentState = updateState.bind(attachment);
var url = '/sys_attachment.do?sys_id=' + attachment.sys_id;
$http({
url: '/xmlhttp.do',
method: 'POST',
params: {
sysparm_processor: 'AntiVirusAttachmentDescriptor',
sysparm_name: 'getAttachmentState',
sysparm_sysid: attachment.sys_id
},
dataType: 'xml'
}).then(function (response) {
var element = (new DOMParser().parseFromString(response.data, 'text/xml')).getElementsByTagName('xml')[0];
var answer = element.getAttribute('answer');
var options = {};
options.state = answer;
if (answer === 'available') {
window.open(url, '_blank');
} else if (answer === 'not_available') {
options.type = 'error';
options.msg = i18n.getMessage('File not available');
} else if (answer === 'pending') {
options.type = 'error';
options.msg = i18n.getMessage('File pending');
}
updateAttachmentState(options);
isAjaxInProgress = false;
});
}
function createAttachmentHandler(tableName, sysID, options) {
var _tableName = tableName;
var _sysID = sysID;
var _files = [];
function getTableName() {
return _tableName;
}
function getSysID() {
return _sysID;
}
function getAttachments() {
var url = urlTools.getURL('ngk_attachments', {
action: 'list',
sys_id: _sysID,
table: _tableName
});
var worker = $http.get;
if (!_sysID) {
worker = function() {
return $q(function(resolve) {
resolve({data:{files:[]}});
});
};
}
return worker(url).then(function(response) {
var files = response.data.files;
if (_files.length == 0) {
files.forEach(function(file) {
if (file && file.sys_id) {
_transformFileResponse(file);
_files.push(file);
}
})
} else {
_files = files;
}
return _files;
});
}
function addAttachment(attachment) {
_files.unshift(attachment);
}
function deleteAttachment(attachment) {
var index = _files.indexOf(attachment);
if (index !== -1) {
return deleteAttachmentBySysID(attachment.sys_id).then(function() {
_files.splice(index, 1);
});
}
}
function uploadAttachments(files, uploadFields) {
var defer = $q.defer();
var promises = [];
var fileData = [];
angular.forEach(files, function(file) {
promises.push(uploadAttachment(file, uploadFields).then(function(response) {
fileData.push(response);
}));
});
$q.all(promises).then(function() {
defer.resolve(fileData);
});
return defer.promise;
}
function uploadAttachment(file, uploadFields, uploadMethods) {
var url = urlTools.getURL('ngk_attachments', {
action: 'add',
sys_id: _sysID,
table: _tableName,
load_attachment_record: 'true'
});
var fields = {
attachments_modified: 'true',
sysparm_table: _tableName,
sysparm_sys_id: _sysID,
sysparm_nostack: 'yes',
sysparm_encryption_context: ''
};
if (typeof $window.g_ck !== 'undefined') {
fields['sysparm_ck'] = $window.g_ck;
}
if (uploadFields) {
angular.extend(fields, uploadFields);
}
var upload = $upload.upload({
url: url,
fields: fields,
fileFormDataName: 'attachFile',
file: file,
fileName : file.file_name || file.name
});
if (uploadMethods !== undefined) {
if (uploadMethods.hasOwnProperty('progress')) {
upload.progress(uploadMethods.progress);
}
if (uploadMethods.hasOwnProperty('success')) {
upload.success(uploadMethods.success);
}
if (uploadMethods.hasOwnProperty('error')) {
upload.error(uploadMethods.error);
}
}
return upload.then(function(response) {
var sysFile = response.data;
if (sysFile.error) {
return $q.reject("Exception when adding attachment: " + sysFile.error);
}
if (typeof sysFile === "object" && sysFile.hasOwnProperty('sys_id')) {
_transformFileResponse(sysFile);
addAttachment(sysFile);
}
if (options && options.onUploadComplete) {
options.onUploadComplete(sysFile);
}
return sysFile;
});
}
function _transformFileResponse(file) {
file.isImage = false;
file.canPreview = false;
if (file.content_type.indexOf('image') !== -1) {
file.isImage = true;
if (!file.thumbSrc) {
} else if (file.thumbSrc[0] !== '/') {
file.thumbSrc = '/' + file.thumbSrc;
}
file.canPreview = file.content_type.indexOf('tiff') === -1;
}
file.viewUrl = getViewUrl(file.sys_id);
}
return {
getSysID: getSysID,
getTableName: getTableName,
getAttachments: getAttachments,
addAttachment: addAttachment,
deleteAttachment: deleteAttachment,
uploadAttachment: uploadAttachment,
uploadAttachments: uploadAttachments
};
}
});
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/directive.snFileUploadInput.js */
angular.module('sn.common.attachments').directive('snFileUploadInput', function(cabrillo, $document) {
'use strict';
return {
restrict: 'E',
scope: {
attachmentHandler: '=',
customClassNames: '@classNames'
},
template: function() {
var inputTemplate;
if (cabrillo.isNative()) {
inputTemplate = '<button class="{{classNames}}" ng-click="showAttachOptions($event)" aria-labelledby="attach-label-{{ ::$id }}"><span class="upload-label" id="attach-label-{{ ::$id }}"><translate key="Add Attachment" /></span></button>';
} else {
inputTemplate = '<button class="{{classNames}}" ng-file-select="onFileSelect($files)" aria-labelledby="attach-label-{{ ::$id }}"><span class="upload-label" id="attach-label-{{ ::$id }}"><translate key="Add Attachment" /></span></button>';
}
return [
'<div class="file-upload-input" role="button" aria-labelledby="attach-label-{{ ::$id }}">',
'<div role="group" class="injected-contents-break-accessibility" aria-hidden="true">',
inputTemplate,
'</div>',
'</div>'
].join('');
},
controller: function($element, $scope) {
var classNames = 'btn btn-icon attachment-btn icon-paperclip';
if ($scope.customClassNames) {
classNames += ' ' + $scope.customClassNames;
}
$scope.classNames = classNames;
$scope.showAttachOptions = function($event) {
var handler = $scope.attachmentHandler;
var target = angular.element($event.currentTarget);
var elRect = target[0].getBoundingClientRect();
var body = $document[0].body;
var rect = {
x: elRect.left + body.scrollLeft,
y: elRect.top + body.scrollTop,
width: elRect.width,
height: elRect.height
};
var options = {sourceRect: rect};
cabrillo.attachments.addFile(
handler.getTableName(),
handler.getSysID(),
null,
options
).then(function(data) {
console.log('Attached new file', data);
handler.addAttachment(data);
}, function() {
console.log('Failed to attach new file');
});
};
$scope.onFileSelect = function($files) {
$scope.attachmentHandler.uploadAttachments($files);
};
$scope.showFileSelector = function($event) {
$event.stopPropagation();
var target = angular.element($event.currentTarget);
var input = target.parent().find('input');
input.triggerHandler('click');
};
}
}
});
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/directive.snPasteFileHandler.js */
angular.module('sn.common.attachments').directive('snPasteFileHandler', function($parse) {
'use strict';
return {
restrict: 'A',
link: function(scope, element, attrs) {
var snPasteFileHandler = $parse(attrs.snPasteFileHandler);
element.bind("paste", function(event) {
event = event.originalEvent || event;
var item = event.clipboardData.items[0];
if (!item)
return;
var file = item.getAsFile();
if (!file)
return;
snPasteFileHandler(scope, {file: file});
event.preventDefault();
event.stopPropagation();
});
}
};
});
;
/*! RESOURCE: /scripts/angularjs-1.4/sn/common/attachments/directive.snAttachmentList.js */
angular.module('sn.common.attachments').directive('snAttachmentList', function(getTemplateUrl, snAttachmentHandler, $rootScope, $window, $timeout, $q) {
'use strict';
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl("sn_attachment_list.xml"),
scope: {
tableName: "=?",
sysID: "=?sysId",
attachmentList: "=?",
uploadFileFn: "&",
deleteFileFn: "=?",
canEdit: "=?",
canRemove: "=?",
canAdd: "=?",
canDownload: "=?",
showHeader: "=?",
clickImageFn: "&?",
confirmDelete: "=?"
},
controller: function($scope) {
$scope.canEdit = $scope.canEdit || false;
$scope.canDownload = $scope.canDownload || false;
$scope.canRemove = $scope.canRemove || false;
$scope.canAdd = $scope.canAdd || false;
$scope.showHeader = $scope.showHeader || false;
$scope.clickImageFn = $scope.clickImageFn || function() {};
$scope.confirmDelete = $scope.confirmDelete || false;
$scope.filesInProgress = {};
$scope.attachmentToDelete = null;
function refreshResources() {
var handler = snAttachmentHandler.create($scope.tableName, $scope.sysID);
handler.getAttachments().then(function(files) {
$scope.attachmentList = files;
});
}
if (!$scope.attachmentList) {
$scope.attachmentList = [];
refreshResources();
}
$scope.$on('attachments_list.update', function(e, tableName, sysID) {
if (tableName === $scope.tableName && sysID === $scope.sysID) {
refreshResources();
}
});
function removeFromFileProgress (fileName) {
delete $scope.filesInProgress[fileName];
}
function updateFileProgress (file) {
if (!$scope.filesInProgress[file.name])
$scope.filesInProgress[file.name] = file;
}
$scope.$on('attachments_list.upload.progress', function (e, file) {
updateFileProgress(file);
});
$scope.$on('attachments_list.upload.success', function (e, file) {
removeFromFileProgress(file.name);
});
$scope.attachFiles = function(files) {
if ($scope.tableName && $scope.sysID) {
var handler = snAttachmentHandler.create($scope.tableName, $scope.sysID);
var promises = [];
files.forEach(function (file) {
var promise = handler.uploadAttachment(file, null , {
progress: function (e) {
var file = e.config.file;
file.progress = 100.0 * event.loaded / event.total;
updateFileProgress(file);
},
success: function (data) {
removeFromFileProgress(data.file_name);
}
});
promises.push(promise);
});
$q.all(promises).then(function() {
refreshResources();
});
} else {
if ($scope.uploadFileFn)
$scope.uploadFileFn({files: files});
}
};
$scope.getProgressStyle = function (fileName) {
return {
'width': $scope.filesInProgress[fileName].progress + '%'
};
};
$scope.openSelector = function($event) {
$event.stopPropagation();
var target = angular.element($event.currentTarget);
$timeout(function() {
target.parent().find('input').click();
});
};
$scope.confirmDeleteAttachment = function (attachment) {
$scope.attachmentToDelete = attachment;
$scope.$broadcast('dialog.confirm-delete.show');
};
$scope.deleteAttachment = function () {
snAttachmentHandler.deleteAttachment($scope.attachmentToDelete.sys_id).then(function () {
var index = $scope.attachmentList.indexOf($scope.attachmentToDelete);
$scope.attachmentList.splice(index, 1);
});
};
}
};
})
.directive('snAttachmentListItem', function(getTemplateUrl, snAttachmentHandler, $rootScope, $window, $timeout, $parse) {
'use strict';
return {
restrict: "E",
replace: true,
templateUrl: getTemplateUrl("sn_attachment_list_item.xml"),
link: function (scope, element, attrs) {
function translateAttachment(att) {
return {
content_type: att.content_type,
file_name: att.file_name,
image: (att.thumbSrc !== undefined),
size_bytes: att.size,
sys_created_by: "",
sys_created_on: "",
sys_id: att.sys_id,
thumb_src: att.thumbSrc
};
}
scope.attachment = ($parse(attrs.attachment.size_bytes)) ?
scope.$eval(attrs.attachment) :
translateAttachment(attrs.attachment);
var fileNameView = element.find('.sn-widget-list-title_view');
var fileNameEdit = element.find('.sn-widget-list-title_edit');
function editFileName() {
fileNameView.hide();
fileNameEdit.show();
element.find('.edit-text-input').focus();
}
function viewFileName() {
fileNameView.show();
fileNameEdit.hide();
}
viewFileName();
scope.editModeToggle = function ($event) {
$event.preventDefault();
$event.stopPropagation();
scope.editMode = !scope.editMode;
if (scope.editMode)
editFileName();
else
viewFileName();
};
scope.updateName = function () {
scope.editMode = false;
viewFileName();
snAttachmentHandler.renameAttachment(scope.attachment.sys_id, scope.attachment.file_name);
};
},
controller: function ($scope, snCustomEvent, i18n, $http) {
$scope.editMode = false;
$scope.buttonFocus = false;
$scope.removeAttachment = function (attachment, index) {
if ($scope.deleteFileFn !== undefined && $scope.deleteFileFn instanceof Function) {
$scope.deleteFileFn.apply(null, arguments);
return;
}
if ($scope.confirmDelete) {
$scope.confirmDeleteAttachment($scope.attachment);
return;
}
snAttachmentHandler.deleteAttachment($scope.attachment.sys_id).then(function () {
$scope.attachmentList.splice($scope.$index, 1);
});
};
var contentTypeMap = {
"application/pdf": "icon-document-pdf",
"text/plain": "icon-document-txt",
"application/zip": "icon-document-zip",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "icon-document-doc",
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "icon-document-ppt",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "icon-document-xls",
"application/vnd.ms-powerpoint": "icon-document-ppt"
};
$scope.getDocumentType = function (contentType) {
return contentTypeMap[contentType] || "icon-document";
};
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
$scope.handleAttachmentClick = function (event) {
if (event.keyCode === 9)
return;
if ($scope.editMode || !$scope.attachment)
return;
switch ($scope.attachment.state) {
case "available":
previewOrDownloadAttachment(true, event);
break;
case "not_available":
var escapedFileName = escapeHtml($scope.attachment.file_name);
var msg = i18n.getMessage('The file {0} did not pass security scan and cannot be downloaded').withValues([escapedFileName]);
attachmentUnavailableMsg(msg);
break;
default:
getAttachmentAvailability(true, event);
}
};
$scope.handleAttachmentDownload = function ($event) {
$event.stopPropagation();
if ($scope.attachment.state !== "available") {
$event.preventDefault();
getAttachmentAvailability(false);
}
};
function getAttachmentAvailability(isPreview, event) {
$http.get('/api/now/as_attachment/getAvailability/' + $scope.attachment.sys_id)
.then(function(response) {
var _res = response.data.result;
if (_res && _res.availability) {
if (_res.availability === 'available')
previewOrDownloadAttachment(isPreview, event);
else
attachmentUnavailableMsg(_res.message);
} else {
previewOrDownloadAttachment(isPreview, event);
}
}, function() {
previewOrDownloadAttachment(isPreview, event);
});
}
function previewOrDownloadAttachment(isPreview, event) {
if (isPreview && $scope.attachment.image) {
if (!$scope.attachment.size)
$scope.attachment.size = $scope.getSize($scope.attachment.size_bytes, 2);
$scope.clickImageFn({file: $scope.attachment});
snCustomEvent.fire('sn.attachment.preview', event, $scope.attachment);
} else {
if (!$scope.attachment.sys_id)
return;
$window.location.href = 'sys_attachment.do?sys_id=' + $scope.attachment.sys_id;
}
}
function attachmentUnavailableMsg(msg) {
if (window.NOW && window.NOW.CustomEvent)
window.NOW.CustomEvent.fire('stream.attachment.unavailable', msg);
}
$scope.getSize = function (bytes, precision) {
if ($scope.attachment.state === "not_available")
return '[unavailable]';
if (typeof bytes === 'string' && bytes.slice(-1) === 'B')
return bytes;
var kb = 1024;
var mb = kb * 1024;
var gb = mb * 1024;
if ((bytes >= 0) && (bytes < kb))
return bytes + ' B';
else if ((bytes >= kb) && (bytes < mb))
return (bytes / kb).toFixed(precision) + ' KB';
else if ((bytes >= mb) && (bytes < gb))
return (bytes / mb).toFixed(precision) + ' MB';
else if (bytes >= gb)
return (bytes / gb).toFixed(precision) + ' GB';
else
return bytes + ' B';
};
$scope.onButtonFocus = function() {
$scope.buttonFocus = true;
};
$scope.onButtonBlur = function() {
$scope.buttonFocus = false;
};
}
};
});
;
;
/*! RESOURCE: /scripts/calendar.js */
var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x) {return(x<0||x>9?"":"0")+x}
function isDate(val,format) {
var date=getDateFromFormat(val,format);
if (date==0) { return false; }
return true;
}
function compareDates(date1,dateformat1,date2,dateformat2) {
var d1=getDateFromFormat(date1,dateformat1);
var d2=getDateFromFormat(date2,dateformat2);
if (d1==0 || d2==0) {
return -1;
}
else if (d1 > d2) {
return 1;
}
return 0;
}
function formatDateServer(date, format) {
var ga = new GlideAjax("DateTimeUtils");
ga.addParam("sysparm_name", "formatCalendarDate");
var browserOffset = date.getTimezoneOffset() * 60000;
var utcTime = date.getTime() - browserOffset;
var userDateTime = utcTime - g_tz_offset;
ga.addParam("sysparm_value", userDateTime);
ga.getXMLWait();
return ga.getAnswer();
}
function formatDate(date,format) {
if (format.indexOf("z") > 0)
return formatDateServer(date, format);
format=format+"";
var result="";
var i_format=0;
var c="";
var token="";
var y=date.getFullYear()+"";
var M=date.getMonth()+1;
var d=date.getDate();
var E=date.getDay();
var H=date.getHours();
var m=date.getMinutes();
var s=date.getSeconds();
var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
var value=new Object();
value["M"]=M;
value["MM"]=LZ(M);
value["MMM"]=MONTH_NAMES[M+11];
value["NNN"]=MONTH_NAMES[M+11];
value["MMMM"]=MONTH_NAMES[M-1];
value["d"]=d;
value["dd"]=LZ(d);
value["E"]=DAY_NAMES[E+7];
value["EE"]=DAY_NAMES[E];
value["H"]=H;
value["HH"]=LZ(H);
if (format.indexOf('w') != -1) {
var wk = date.getWeek();
if (wk >= 52 && M == 1) {
y = date.getFullYear();
y--;
y = y + "";
}
if (wk == 1 && M == 12) {
y = date.getFullYear();
y++;
y = y + "";
}
value["w"] = wk;
value["ww"] = LZ(wk);
}
var dayOfWeek = (7 + (E + 1) - (g_first_day_of_week - 1)) % 7;
if (dayOfWeek == 0)
dayOfWeek = 7;
value["D"] = dayOfWeek;
if (y.length < 4) {
y=""+(y-0+1900);
}
value["y"]=""+y;
value["yyyy"]=y;
value["yy"]=y.substring(2,4);
if (H==0) {
value["h"]=12;
} else if (H>12){
value["h"]=H-12;
} else {
value["h"]=H;
}
value["hh"]=LZ(value["h"]);
if (H>11) {
value["K"]=H-12;
} else {
value["K"]=H;
}
value["k"]=H+1;
value["KK"]=LZ(value["K"]);
value["kk"]=LZ(value["k"]);
if (H > 11) {
value["a"]="PM";
} else {
value["a"]="AM";
}
value["m"]=m;
value["mm"]=LZ(m);
value["s"]=s;
value["ss"]=LZ(s);
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (value[token] != null) { result=result + value[token]; }
else { result=result + token; }
}
return result;
}
function _isInteger(val) {
var digits="1234567890";
for (var i=0; i < val.length; i++) {
if (digits.indexOf(val.charAt(i))==-1) { return false; }
}
return true;
}
function _getInt(str,i,minlength,maxlength) {
for (var x=maxlength; x>=minlength; x--) {
var token=str.substring(i,i+x);
if (token.length < minlength) { return null; }
if (_isInteger(token)) { return token; }
}
return null;
}
Date.prototype.getWeek = function() {
var newYear = new Date(this.getFullYear(),0,1);
var day = newYear.getDay() - (g_first_day_of_week - 1);
day = (day >= 0 ? day : day + 7);
var dayNum = Math.floor((this.getTime() - newYear.getTime() - (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
var weekNum;
if (day < 4) {
weekNum = Math.floor((dayNum+day-1)/7) +1;
if (weekNum > 52)
weekNum = this._checkNextYear(weekNum);
return weekNum;
}
weekNum = Math.floor((dayNum+day-1)/7);
if (weekNum < 1)
weekNum = this._lastWeekOfYear();
else if (weekNum > 52)
weekNum = this._checkNextYear(weekNum);
return weekNum;
}
Date.prototype._lastWeekOfYear = function() {
var newYear = new Date(this.getFullYear() - 1,0,1);
var endOfYear = new Date(this.getFullYear() - 1,11,31);
var day = newYear.getDay() - (g_first_day_of_week - 1);
var dayNum = Math.floor((endOfYear.getTime() - newYear.getTime() - (endOfYear.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
return day < 4 ? Math.floor((dayNum+day-1)/7) + 1 : Math.floor((dayNum+day-1)/7);
}
Date.prototype._checkNextYear = function() {
var nYear = new Date(this.getFullYear() + 1,0,1);
var nDay = nYear.getDay() - (g_first_day_of_week-1);
nDay = nDay >= 0 ? nDay : nDay + 7;
return nDay < 4 ? 1 : 53;
}
Date.prototype.setWeek = function(weekNum) {
weekNum--;
var startOfYear = new Date(this.getFullYear(), 0, 1);
var day = startOfYear.getDay() - (g_first_day_of_week - 1);
if (day > 0 && day < 4) {
this.setFullYear(startOfYear.getFullYear() - 1);
this.setDate(31 - day + 1);
this.setMonth(11);
} else if (day > 3)
this.setDate(startOfYear.getDate() + (7-day));
this.setDate(this.getDate() + (7 * weekNum));
}
function getDateFromFormat(val,format) {
val=val+"";
format=format+"";
var i_val=0;
var i_format=0;
var c="";
var token="";
var token2="";
var x,y;
var now=new Date();
var year=now.getYear();
var month=now.getMonth()+1;
var date=0;
var hh=now.getHours();
var mm=now.getMinutes();
var ss=now.getSeconds();
var ampm="";
var week = false;
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (token=="yyyy" || token=="yy" || token=="y") {
if (token=="yyyy") { x=4;y=4; }
if (token=="yy")   { x=2;y=2; }
if (token=="y")    { x=2;y=4; }
year=_getInt(val,i_val,x,y);
if (year==null) { return 0; }
i_val += year.length;
if (year.length==2) {
if (year > 70) { year=1900+(year-0); }
else { year=2000+(year-0); }
}
}
else if (token=="MMM"||token=="NNN"){
month=0;
for (var i=0; i<MONTH_NAMES.length; i++) {
var month_name=MONTH_NAMES[i];
if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
if (token=="MMM"||(token=="NNN"&&i>11)) {
month=i+1;
if (month>12) { month -= 12; }
i_val += month_name.length;
break;
}
}
}
if ((month < 1)||(month>12)){return 0;}
}
else if (token=="EE"||token=="E") {
for (var i=0; i<DAY_NAMES.length; i++) {
var day_name=DAY_NAMES[i];
if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
if (week) {
if (i==0 || i == 7)
date+=6;
else if (i== 2 || i == 9)
date+=1;
else if (i== 3 || i == 10)
date+=2;
else if (i == 4 || i == 11)
date+=3;
else if (i == 5 || i == 12)
date +=4;
else if (i == 6 || i== 13)
date+=5;
}
i_val += day_name.length;
break;
}
}
}
else if (token=="MM"||token=="M") {
month=_getInt(val,i_val,token.length,2);
if(month==null||(month<1)||(month>12)){return 0;}
i_val+=month.length;}
else if (token=="dd"||token=="d") {
date=_getInt(val,i_val,token.length,2);
if(date==null||(date<1)||(date>31)){return 0;}
i_val+=date.length;}
else if (token=="hh"||token=="h") {
hh=_getInt(val,i_val,token.length,2);
if(hh==null||(hh<1)||(hh>12)){return 0;}
i_val+=hh.length;}
else if (token=="HH"||token=="H") {
hh=_getInt(val,i_val,token.length,2);
if(hh==null||(hh<0)||(hh>23)){return 0;}
i_val+=hh.length;}
else if (token=="KK"||token=="K") {
hh=_getInt(val,i_val,token.length,2);
if(hh==null||(hh<0)||(hh>11)){return 0;}
i_val+=hh.length;}
else if (token=="kk"||token=="k") {
hh=_getInt(val,i_val,token.length,2);
if(hh==null||(hh<1)||(hh>24)){return 0;}
i_val+=hh.length;hh--;}
else if (token=="mm"||token=="m") {
mm=_getInt(val,i_val,token.length,2);
if(mm==null||(mm<0)||(mm>59)){return 0;}
i_val+=mm.length;}
else if (token=="ss"||token=="s") {
ss=_getInt(val,i_val,token.length,2);
if(ss==null||(ss<0)||(ss>59)){return 0;}
i_val+=ss.length;}
else if (token=="a") {
if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";}
else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";}
else {return 0;}
i_val+=2;}
else if (token == "w" || token == "ww") {
var weekNum = _getInt(val,i_val,token.length, 2);
week = true;
if (weekNum != null) {
var temp = new Date(year, 0, 1, 0, 0, 0);
temp.setWeek(parseInt(weekNum, 10));
year = temp.getFullYear();
month = temp.getMonth()+1;
date = temp.getDate();
}
weekNum += "";
i_val += weekNum.length;
}
else if (token=="D") {
if (week) {
var day = _getInt(val,i_val,token.length, 1);
if ((day == null) || (day <= 0) || (day > 7))
return 0;
var temp = new Date(year, month-1, date, hh, mm, ss);
var dayOfWeek = temp.getDay();
day = parseInt(day, 10);
day = (day + g_first_day_of_week - 1) % 7;
if (day == 0)
day = 7;
day--;
if (day < dayOfWeek)
day = 7 - (dayOfWeek - day);
else
day -= dayOfWeek;
if (day > 0) {
temp.setDate(temp.getDate() + day);
year = temp.getFullYear();
month = temp.getMonth() + 1;
date = temp.getDate();
}
i_val++;
}
} else if (token =="z")
i_val+=3;
else {
if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
else {i_val+=token.length;}
}
}
if (i_val != val.length) { return 0; }
if (month==2) {
if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) {
if (date > 29){ return 0; }
}
else { if (date > 28) { return 0; } }
}
if ((month==4)||(month==6)||(month==9)||(month==11)) {
if (date > 30) { return 0; }
}
if (hh<12 && ampm=="PM") { hh=hh-0+12; }
else if (hh>11 && ampm=="AM") { hh-=12; }
var newdate=new Date(year,month-1,date,hh,mm,ss);
return newdate.getTime();
}
function parseDate(val) {
var preferEuro=(arguments.length==2)?arguments[1]:false;
generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');
monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');
dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');
yearFirst =new Array( 'yyyyw.F', 'yyw.F');
var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst', 'yearFirst');
var d=null;
for (var i=0; i<checkList.length; i++) {
var l=window[checkList[i]];
for (var j=0; j<l.length; j++) {
d=getDateFromFormat(val,l[j]);
if (d!=0) { return new Date(d); }
}
}
return null;
}
function getDurationString(ms) {
var sec = Math.floor(ms / 1000), s = '', days = Math.floor(sec/86400);
if (days >= 1) {
s += days + ' day' + (days > 1 ? 's' : '');
sec -= days * 86400;
}
var hours = Math.floor(sec/3600);
if (hours >= 1) {
s += (days > 0 ? ' ' : '') + hours + ' hour' + (hours > 1 ? 's' : '');
sec -= hours * 3600;
}
var min = Math.floor(sec/60);
if (days == 0) {
if (min >= 1) {
s += (hours > 0 ? ' ' : '') + min + ' minute' + (min > 1 ? 's' : '');
if (hours < 1) {
sec -= min * 60;
if (sec > 0 && min <= 10)
s += ' ' + sec + ' second' + (sec > 1 ? 's' : '');
}
} else if (hours == 0 && sec > 0)
s += sec + ' second' + (sec > 1 ? 's' : '');
}
return s;
}
function getUserDateTime() {
var browserDate = new Date();
var browserOffset = browserDate.getTimezoneOffset() * 60000;
var utcTime = browserDate.getTime() + browserOffset;
var userDateTime = utcTime + g_tz_offset;
return new Date(userDateTime);
}
function convertUtcTimeToUserTimeMs(utcTimeMs) {
var d = new Date();
return parseInt(utcTimeMs) + (d.getTimezoneOffset() * 60000) + g_tz_offset;
}
function convertUserTimeToUtcTimeMs(userTimeMs) {
var d = new Date();
return parseInt(userTimeMs) - (d.getTimezoneOffset() * 60000) - g_tz_offset;
}
;
;
/*! RESOURCE: /scripts/sn/common/analytics/js_includes_analytics_deps.js */
/*! RESOURCE: /scripts/sn/common/analytics/_module.js */
angular.module('sn.common.analytics', []);
;
/*! RESOURCE: /scripts/sn/common/analytics/SNAnalytics.js */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SNAnalytics=e():t.SNAnalytics=e()}(this,(function(){return function(){var t={1511:function(t,e,r){t.exports=r(3363)},4103:function(t,e,r){t.exports=r(8196)},7766:function(t,e,r){t.exports=r(8065)},116:function(t,e,r){t.exports=r(1955)},8914:function(t,e,r){t.exports=r(6279)},8580:function(t,e,r){t.exports=r(3778)},2991:function(t,e,r){t.exports=r(1798)},3649:function(t,e,r){t.exports=r(2073)},2762:function(t,e,r){t.exports=r(2348)},9828:function(t,e,r){t.exports=r(5178)},5843:function(t,e,r){t.exports=r(6361)},9340:function(t,e,r){t.exports=r(8933)},9392:function(t,e,r){t.exports=r(5868)},8926:function(t,e,r){t.exports=r(6258)},1942:function(t,e,r){t.exports=r(7410)},4943:function(t,e,r){t.exports=r(4471)},3978:function(t,e,r){t.exports=r(1910)},6295:function(t,e,r){t.exports=r(6209)},1306:function(t,e,r){t.exports=r(3402)},4074:function(t,e,r){t.exports=r(9427)},6902:function(t,e,r){t.exports=r(3059)},5507:function(t,e,r){t.exports=r(6670)},455:function(t,e,r){t.exports=r(7795)},4198:function(t,e,r){t.exports=r(4888)},3476:function(t,e,r){t.exports=r(7460)},3032:function(t,e,r){t.exports=r(7989)},5420:function(t,e,r){t.exports=r(2547)},8341:function(t,e,r){t.exports=r(6509)},1446:function(t,e,r){t.exports=r(6600)},3882:function(t,e,r){t.exports=r(9759)},530:function(t){t.exports=function(t){return t&&t.__esModule?t:{default:t}}},3765:function(t,e,r){var n=r(3882),o=r(1446);function i(e){return t.exports=i="function"==typeof o&&"symbol"==typeof n?function(t){return typeof t}:function(t){return t&&"function"==typeof o&&t.constructor===o&&t!==o.prototype?"symbol":typeof t},i(e)}t.exports=i},6486:function(t,e,r){var n,o;n=function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?s(t):e}function f(t){var e=u();return function(){var r,n=i(t);if(e){var o=i(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function l(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=i(t)););return t}function p(t,e,r){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=l(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}},p(t,e,r||t)}var d=function(){function e(){t(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return n(e,[{key:"addEventListener",value:function(t,e){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push(e)}},{key:"removeEventListener",value:function(t,e){if(t in this.listeners)for(var r=this.listeners[t],n=0,o=r.length;n<o;n++)if(r[n]===e)return void r.splice(n,1)}},{key:"dispatchEvent",value:function(t){var e=this;if(t.type in this.listeners){for(var r=function(r){setTimeout((function(){return r.call(e,t)}))},n=this.listeners[t.type],o=0,i=n.length;o<i;o++)r(n[o]);return!t.defaultPrevented}}}]),e}(),v=function(e){o(a,e);var r=f(a);function a(){var e;return t(this,a),(e=r.call(this)).listeners||d.call(s(e)),Object.defineProperty(s(e),"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(s(e),"onabort",{value:null,writable:!0,configurable:!0}),e}return n(a,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(t){"abort"===t.type&&(this.aborted=!0,"function"==typeof this.onabort&&this.onabort.call(this,t)),p(i(a.prototype),"dispatchEvent",this).call(this,t)}}]),a}(d),h=function(){function e(){t(this,e),Object.defineProperty(this,"signal",{value:new v,writable:!0,configurable:!0})}return n(e,[{key:"abort",value:function(){var t;try{t=new Event("abort")}catch(e){"undefined"!=typeof document?document.createEvent?(t=document.createEvent("Event")).initEvent("abort",!1,!1):(t=document.createEventObject()).type="abort":t={type:"abort",bubbles:!1,cancelable:!1}}this.signal.dispatchEvent(t)}},{key:"toString",value:function(){return"[object AbortController]"}}]),e}();function y(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):"function"==typeof t.Request&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}"undefined"!=typeof Symbol&&Symbol.toStringTag&&(h.prototype[Symbol.toStringTag]="AbortController",v.prototype[Symbol.toStringTag]="AbortSignal"),function(t){y(t)&&(t.AbortController=h,t.AbortSignal=v)}("undefined"!=typeof self?self:r.g)},void 0===(o="function"==typeof n?n.call(e,r,e,t):n)||(t.exports=o)},9179:function(t,e,r){"use strict";var n=r(530)(r(3978));(0,n.default)(e,"__esModule",{value:!0});var o=r(6766),i=r(3534),a=r(1859),u=r(7551),s=function(){function t(){}return(0,n.default)(t,"baseUrl",{get:function(){return this.baseServerUrl},set:function(t){if(!(0,o.isNonEmptyString)(t))throw new a.SNTypeError("Server endpoint cannot be empty");this.baseServerUrl=(0,u.removeTrailingSlash)(t)},enumerable:!1,configurable:!0}),t.baseServerUrl="https://api-appsee.service-now.com",t.IS_PRODUCTION=!0,t.VERSION="2.0.1",t.DEFAULT_CLIENT_ID="0",t.DEFAULT_LOG_LEVEL=t.IS_PRODUCTION?i.LogLevel.error:i.LogLevel.debug,t.DEFAULT_TRACKING_CONSENT=i.TrackingLevel.Disabled,t.MAX_HEARTBEAT_CALL_ATTEMPTS=2,t.SYSTEM_PROPERTY_PREFIX="SN_",t.LOGGER_PREFIX="[SNAnalytics]",t}();e.default=s},6737:function(t,e,r){"use strict";var n=r(530)(r(3978)),o=function(t){return t&&t.__esModule?t:{default:t}};(0,n.default)(e,"__esModule",{value:!0});var i=o(r(2213)),a=o(r(8629)),u=o(r(8606)),s=o(r(9107)),c=r(6604),f=r(1859),l=o(r(9179)),p=r(7981),d=function(){function t(){}return t.prototype.validate=function(t){if(!t)throw new f.SNError("Need to call setKeys with a valid apiKey");return t},t.prototype.setKeys=function(t,e){var r=new c.LocalStore(t);this.appUserIdProvider=(0,p.createBasicProvider)(r,"user"),this.browserIdProvider=new u.default(r),this.clientIdProvider=(0,p.createBasicProvider)(r,"client",l.default.DEFAULT_CLIENT_ID),this.trackingConsentProvider=(0,p.createBasicProvider)(r,"consent",l.default.DEFAULT_TRACKING_CONSENT);var n=new c.SessionStore(t);this.configurationProvider=new i.default(n,t,e,this.appUserIdProvider),this.tabIdProvider=new s.default(n),this.currentPageProvider=(0,p.createBasicProvider)(n,"page",""),this.domainProvider=(0,p.createBasicProvider)(n,"domain",{}),this.appContextProvider=(0,p.createBasicProvider)(n,"app",{}),this.dataPointsProvider=new a.default(n,this.configurationProvider,this.appContextProvider)},(0,n.default)(t.prototype,"appContext",{get:function(){return this.validate(this.appContextProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"appUserId",{get:function(){return this.validate(this.appUserIdProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"browserId",{get:function(){return this.validate(this.browserIdProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"clientId",{get:function(){return this.validate(this.clientIdProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"configuration",{get:function(){return this.validate(this.configurationProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"currentPage",{get:function(){return this.validate(this.currentPageProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"dataPoints",{get:function(){return this.validate(this.dataPointsProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"domain",{get:function(){return this.validate(this.domainProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"tabId",{get:function(){return this.validate(this.tabIdProvider)},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"trackingConsent",{get:function(){return this.validate(this.trackingConsentProvider)},enumerable:!1,configurable:!0}),t}();e.default=new d},1231:function(t,e,r){"use strict";var n=r(530),o=n(r(3978)),i=n(r(8341)),a=n(r(5420)),u=n(r(3476)),s=function(t,e,r,n){return new(r||(r=u.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},c=function(t,e){var r,n,o,u,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof a.default&&(u[i.default]=function(){return this}),u;function c(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},f=function(t){return t&&t.__esModule?t:{default:t}};(0,o.default)(e,"__esModule",{value:!0});var l=f(r(6373)),p=f(r(6737)),d=f(r(3453)),v=f(r(9179)),h=r(4983),y=function(){function t(t){this.sessionLifecycleManager=t,this.heartbeatTimeoutId=0,this.heartbeatErrorCounter=0}return t.prototype.startHeartbeats=function(){var t=this;if(!this.heartbeatTimeoutId){l.default.info("Starting heartbeats");this.heartbeatTimeoutId=window.setTimeout((function e(){return s(t,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.sendHeartbeat()];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),l.default.warn("Heartbeat failed",t),[3,3];case 3:return this.heartbeatTimeoutId=window.setTimeout(e,p.default.configuration.get("HeartbeatInterval")),[2]}}))}))}))}},t.prototype.stopHeartbeats=function(){l.default.info("Stop heartbeats"),clearTimeout(this.heartbeatTimeoutId),this.heartbeatTimeoutId=0},t.prototype.sendHeartbeat=function(){return s(this,void 0,void 0,(function(){var t,e;return c(this,(function(r){switch(r.label){case 0:return(null==(t=p.default.dataPoints.select(p.default.configuration.get("MaxDataPointsPerHeartbeat")))?void 0:t.dataPoints.length)?(l.default.info("Send heartbeat:",t),[4,d.default.sendHeartbeat(t)]):(l.default.debug("Heartbeat skipped: No data points to send"),[2]);case 1:return(e=r.sent()).ok?(l.default.info("Heartbeat sent successfully"),p.default.dataPoints.deleteByCount(t.dataPoints.length),this.heartbeatErrorCounter=0):1===e.errorCode?(l.default.info("Session "+t.sessionId+" not found for heartbeat, deleting session configuration and data"),p.default.configuration.deleteSessionData(t.sessionId),p.default.dataPoints.deleteBySessionId(t.sessionId),this.heartbeatErrorCounter=0):t.sessionId!==p.default.configuration.get("SessionId")||this.sessionLifecycleManager.getCurrentState()===h.SessionState.Ended?this.heartbeatErrorCounter<v.default.MAX_HEARTBEAT_CALL_ATTEMPTS?(this.heartbeatErrorCounter++,l.default.info("Heartbeat failed for a session that was ended "+t.sessionId+",","will try again later (attempt "+this.heartbeatErrorCounter+"/"+v.default.MAX_HEARTBEAT_CALL_ATTEMPTS+")")):(l.default.info("Heartbeat failed for a session that was ended",t.sessionId,"deleting its data"),p.default.dataPoints.deleteBySessionId(t.sessionId),p.default.configuration.deleteSessionData(t.sessionId),this.heartbeatErrorCounter=0):l.default.info("Heartbeat failed for alive session, will try again later"),[2]}}))}))},t}();e.default=y},9820:function(t,e,r){"use strict";var n=r(530),o=n(r(3978)),i=n(r(8341)),a=n(r(5420)),u=n(r(3476)),s=function(t,e,r,n){return new(r||(r=u.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},c=function(t,e){var r,n,o,u,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof a.default&&(u[i.default]=function(){return this}),u;function c(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},f=function(t){return t&&t.__esModule?t:{default:t}};(0,o.default)(e,"__esModule",{value:!0});var l=f(r(3703)),p=function(){function t(){}return t.start=function(t,e,r){l.default.start(t,e,r)},t.startPage=function(t,e){l.default.startPage(t,e)},t.addEvent=function(t,e,r){l.default.addEvent(t,e,r)},t.setUserId=function(t){l.default.setUserId(t)},t.setUserProperty=function(t,e){l.default.setUserProperty(t,e)},t.setUserProperties=function(t){l.default.setUserProperties(t)},t.removeUserProperty=function(t){l.default.removeUserProperty(t)},t.incUserProperty=function(t,e){l.default.incUserProperty(t,e)},t.appendToUserProperty=function(t,e){l.default.appendToUserProperty(t,e)},t.setTrackingConsent=function(t){l.default.setTrackingConsent(t)},t.getTrackingConsent=function(){return l.default.getTrackingConsent()},t.deleteCurrentUserData=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,l.default.deleteCurrentUserData()]}))}))},t.setDebugLevel=function(t){l.default.setDebugLevel(t)},t}();e.default=p},3703:function(t,e,r){"use strict";var n=r(530);r(9600);var o=n(r(6902)),i=n(r(8341)),a=n(r(5420)),u=n(r(3476)),s=n(r(3765)),c=n(r(4074)),f=n(r(3978)),l=n(r(4943)),p=l.default?function(t,e,r,n){void 0===n&&(n=r),(0,f.default)(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},d=l.default?function(t,e){(0,f.default)(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},v=function(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=(0,c.default)(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,s.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&(0,f.default)(e,r,a),a},h=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&p(e,t,r);return d(e,t),e},y=function(t,e,r,n){return new(r||(r=u.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},g=function(t,e){var r,n,o,u,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof a.default&&(u[i.default]=function(){return this}),u;function c(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},b=function(t){return t&&t.__esModule?t:{default:t}};(0,f.default)(e,"__esModule",{value:!0});var m=r(3534),x=b(r(6373)),w=b(r(6737)),S=r(6566),A=b(r(9686)),E=b(r(1231)),T=h(r(4983)),I=b(r(9179)),P=r(6766),O=r(1859),_=b(r(3453)),C=r(9445),j=r(7551),R=r(7733),L=r(1669),N=function(){function t(){this.isWired=!1,this.sessionLifecycleManager=new T.default,this.heartbeatManager=new E.default(this.sessionLifecycleManager),this.metadataRecorder=new A.default}return t.prototype.start=function(t,e,r){if(x.default.info("Start session - API Key:",t,", API Auth:",e,", Options:",r),this.isWired){if(x.default.info("Session is already running"),t!==w.default.configuration.get("ApiKey")||e!==w.default.configuration.get("ApiAuth"))return void x.default.error("SDK already started with different API Key and Auth")}else{if(!(0,P.isNonEmptyString)(t))throw new O.SNTypeError('"apiKey" must be a string and cannot be empty');if(!(0,P.isNonEmptyString)(e))throw new O.SNTypeError('"apiAuth" must be a string and cannot be empty');if((0,P.isDefined)(r)){if(!(0,P.isObject)(r))throw new O.SNTypeError('"options" must be an object');(0,P.isDefined)(r.serverEndpoint)&&(I.default.baseUrl=r.serverEndpoint)}try{this.wire(t,e)}catch(t){return x.default.error("SDK wiring failed",t),void this.unwire()}}if((0,P.isObject)(r)){if((0,P.isDefined)(r.userId))try{x.default.info("Set user id before config");var n=(0,L.normalizeAppUserId)(r.userId);w.default.appUserId.set(n)}catch(t){x.default.error(t instanceof Error?t.message:t)}this.saveDomain(r),this.saveAppContext(r),(0,P.isDefined)(r.trackingConsent)&&this.setTrackingConsent(r.trackingConsent)}this.startNewSessionIfNeeded()},t.prototype.startPage=function(t,e){x.default.info("Start page - Name:",t,", Description:",e),this.metadataRecorder.page.start(t,e)},t.prototype.addEvent=function(t,e,r){x.default.info("Add event - Name:",t,", Properties:",e,", Type:",r),this.metadataRecorder.event.add(t,e,r)},t.prototype.setUserId=function(t){if(this.validateSdkReady()){x.default.info("Set user id:",t);var e=(0,L.normalizeAppUserId)(t);w.default.appUserId.set(e),this.startNewSessionIfNeeded()}},t.prototype.setUserProperty=function(t,e){x.default.info("Set user property:",t,"-",e),this.metadataRecorder.user.setProperty(t,e)},t.prototype.setUserProperties=function(t){x.default.info("Set user properties:",t),this.metadataRecorder.user.setProperties(t)},t.prototype.removeUserProperty=function(t){x.default.info("Remove user property:",t),this.metadataRecorder.user.removeProperty(t)},t.prototype.incUserProperty=function(t,e){x.default.info("Increment user property:",t,"-",e),this.metadataRecorder.user.incProperty(t,e)},t.prototype.appendToUserProperty=function(t,e){x.default.info("Append to user property:",t,"-",e),this.metadataRecorder.user.appendToProperty(t,e)},t.prototype.setTrackingConsent=function(t){x.default.info("Set tracking consent level to:",t);var e=(0,C.tryGetEnumValue)(t,m.TrackingLevel,!0);if(!(0,P.isDefined)(e))throw new O.SNError('"trackingLevel" must be one of: '+(0,o.default)(m.TrackingLevel).join(" | "));var r=w.default.trackingConsent.get();if(e!==r){w.default.trackingConsent.set(e),x.default.info("Consent level is now:",e);var n=this.sessionLifecycleManager.getCurrentState();e===m.TrackingLevel.Basic||e===m.TrackingLevel.Full?this.startNewSessionIfNeeded()&&this.metadataRecorder.event.addConsentChange(e,r):n!==T.SessionState.Created&&n!==T.SessionState.Started||(this.metadataRecorder.event.addConsentChange(e,r),this.stopSession())}else x.default.info("Consent level is the same:",e)},t.prototype.getTrackingConsent=function(){return x.default.info("Get tracking consent"),w.default.trackingConsent.get()},t.prototype.deleteCurrentUserData=function(){return y(this,void 0,void 0,(function(){var t,e;return g(this,(function(r){switch(r.label){case 0:return x.default.info("Deleting current user data"),this.setTrackingConsent(m.TrackingLevel.Disabled),(t=w.default.clientId.get())&&t!==I.default.DEFAULT_CLIENT_ID?(e=w.default.appUserId.get(),[4,_.default.deleteUserData(e)]):(x.default.warn("SNAnalytics was never started on the device"),[2,!0]);case 1:if(!r.sent().ok)throw new O.SNError("Server could not delete user "+e);return w.default.appUserId.remove(),this.stopSession(!0),[2,!0]}}))}))},t.prototype.setDebugLevel=function(t){x.default.info("Set debug level:",t),x.default.setDebugLevel(t)},t.prototype.StartSession=function(t,e,r){var n=r.value;return r.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.startNewSessionIfNeeded()?n.apply(this,t):void 0},r},(0,f.default)(t,"StartSession",{get:function(){return t.prototype.StartSession},enumerable:!1,configurable:!0}),t.prototype.EnsureWired=function(t,e,r){var n=r.value;return r.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.isWired)return n.apply(this,t);throw new O.SNError("Must call SNAnalytics.start beforehand")},r},(0,f.default)(t,"EnsureWired",{get:function(){return t.prototype.EnsureWired},enumerable:!1,configurable:!0}),t.prototype.validateSdkReady=function(){return this.isWired?w.default.trackingConsent.get()!==m.TrackingLevel.Disabled||(x.default.warn("No tracking consent given"),!1):(x.default.warn("Must call SNAnalytics.start beforehand"),!1)},t.prototype.startNewSessionIfNeeded=function(){try{return!!this.validateSdkReady()&&(this.sessionLifecycleManager.getCurrentState()===T.SessionState.Ended&&(this.stopSession(),this.startNewSession()),w.default.configuration.get("RecordMetadata"))}catch(t){return x.default.error("Could not start a session:",t),!1}},t.prototype.wire=function(t,e){x.default.info("Wiring SDK..."),w.default.setKeys(t,e),w.default.dataPoints.deletePreSessionItems(),this.heartbeatManager.startHeartbeats(),this.isWired=!0,x.default.info("SDK is Wired")},t.prototype.unwire=function(){this.isWired=!1,this.heartbeatManager.stopHeartbeats()},t.prototype.stopSession=function(t){void 0===t&&(t=!1),t&&w.default.dataPoints.deleteBySessionId(w.default.configuration.get("SessionId")),w.default.configuration.deleteData()},t.prototype.startNewSession=function(){return y(this,void 0,void 0,(function(){var t,e,r;return g(this,(function(n){switch(n.label){case 0:return t=(0,j.getGuid)(),x.default.info("Starting new session with request id",t),w.default.configuration.startNewSession(t),this.sessionLifecycleManager.setIsGettingConfiguration(t,!0),[4,_.default.getConfiguration(t)];case 1:return e=n.sent(),this.sessionLifecycleManager.setIsGettingConfiguration(t,!1),e.ok?this.gotConfiguration(t):1===e.errorCode?(r=e.data,x.default.warn("Got bad config response for request id",t,", session finished",r),w.default.dataPoints.assignPreSessionItems(t,r,(0,R.getTime)()),w.default.configuration.deleteSessionData(r)):(x.default.warn("Got bad config response for request id",t),w.default.dataPoints.deletePreSessionItems(t)),[2]}}))}))},t.prototype.gotConfiguration=function(t){x.default.info("Got session id:",w.default.configuration.get("SessionId")),w.default.dataPoints.assignPreSessionItems(t,w.default.configuration.get("SessionId"),w.default.configuration.get("ConfigReceivedTime"));var e=w.default.configuration.get("LogLevel");(0,P.isDefined)(e)&&(I.default.IS_PRODUCTION?x.default.setDebugLevel(e):x.default.warn("Log level can be changed from config response only in production")),w.default.clientId.set(w.default.configuration.get("ClientId")),w.default.configuration.get("RecordMetadata")?this.metadataRecorder.user.setAppUserId(w.default.configuration.get("AppUserId")):x.default.info("Record metadata is false so no data points will be collected")},t.prototype.saveDomain=function(t){if((0,P.isUndefined)(t.domainId)&&(0,P.isUndefined)(t.domainName))w.default.domain.remove();else{if((0,P.isDefined)(t.domainId)&&!(0,P.isString)(t.domainId))throw new O.SNTypeError('"domainId" must be string');if((0,P.isDefined)(t.domainName)&&!(0,P.isString)(t.domainName))throw new O.SNTypeError('"domainName" must be string');w.default.domain.set({id:t.domainId,name:t.domainName})}},t.prototype.saveAppContext=function(t){if((0,P.isUndefined)(t.appContextId)&&(0,P.isUndefined)(t.appContextName))w.default.appContext.remove();else{if((0,P.isDefined)(t.appContextId)&&!(0,P.isString)(t.appContextId))throw new O.SNTypeError('"appContextId" must be string');if((0,P.isDefined)(t.appContextName)&&!(0,P.isString)(t.appContextName))throw new O.SNTypeError('"appContextName" must be string');w.default.appContext.set({id:t.appContextId,name:t.appContextName})}},v([S.CatchAll,t.StartSession],t.prototype,"startPage",null),v([S.CatchAll,t.StartSession],t.prototype,"addEvent",null),v([S.CatchAll],t.prototype,"setUserId",null),v([S.CatchAll,t.StartSession],t.prototype,"setUserProperty",null),v([S.CatchAll,t.StartSession],t.prototype,"setUserProperties",null),v([S.CatchAll,t.StartSession],t.prototype,"removeUserProperty",null),v([S.CatchAll,t.StartSession],t.prototype,"incUserProperty",null),v([S.CatchAll,t.StartSession],t.prototype,"appendToUserProperty",null),v([S.CatchAll,t.EnsureWired],t.prototype,"setTrackingConsent",null),v([(0,S.CatchAllAndReturn)(m.TrackingLevel.Disabled),t.EnsureWired],t.prototype,"getTrackingConsent",null),v([(0,S.CatchAllAndReturn)(!1),t.EnsureWired],t.prototype,"deleteCurrentUserData",null),v([S.CatchAll],t.prototype,"setDebugLevel",null),v([S.CatchAll],t.prototype,"unwire",null),v([S.CatchAll],t.prototype,"startNewSession",null),t}();e.default=new N},6343:function(t,e,r){"use strict";var n=r(530);r(8309),(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.DataPointField=void 0,function(t){t.type="t",t.timestamp="d",t.name="n",t.properties="p"}(e.DataPointField||(e.DataPointField={}))},7981:function(t,e,r){"use strict";(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0}),e.createBasicProvider=void 0;e.createBasicProvider=function(t,e,r){return{set:function(r){return t.set(e,r)},get:function(){var n;return null!==(n=t.get(e))&&void 0!==n?n:r},remove:function(){return t.remove(e)}}}},8606:function(t,e,r){"use strict";var n=r(530),o=n(r(3978)),i=n(r(8341)),a=n(r(5420)),u=n(r(3476)),s=function(t,e,r,n){return new(r||(r=u.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},c=function(t,e){var r,n,o,u,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof a.default&&(u[i.default]=function(){return this}),u;function c(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},f=function(t){return t&&t.__esModule?t:{default:t}};(0,o.default)(e,"__esModule",{value:!0});var l=f(r(1453)),p=r(7551),d=new l.default("create-browser-id"),v=function(){function t(t){this.store=t}return t.prototype.get=function(){return this.store.get("browser")},t.prototype.getOrCreate=function(){return s(this,void 0,void 0,(function(){var t,e;return c(this,(function(r){switch(r.label){case 0:return(t=this.get())?[3,2]:[4,d.acquire()];case 1:e=r.sent(),(t=this.get())||(t=(0,p.getGuid)(),this.store.set("browser",t)),e.release(),r.label=2;case 2:return[2,t]}}))}))},t}();e.default=v},2213:function(t,e,r){"use strict";var n,o=r(530),i=o(r(4103)),a=o(r(3978)),u=o(r(1942)),s=function(){return s=u.default||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s.apply(this,arguments)},c=function(t){return t&&t.__esModule?t:{default:t}};(0,a.default)(e,"__esModule",{value:!0});var f=r(6766),l=r(3534),p=c(r(9179)),d=r(9445),v=r(7733),h={ClientId:p.default.DEFAULT_CLIENT_ID,SessionId:"",LogLevel:void 0,MaxDataPointsPerHeartbeat:1e4,HeartbeatInterval:5e3,SessionTimeout:18e5,RecordMetadata:!0,RequestId:"",ConfigReceivedTime:0,AppUserId:void 0},y={ClientId:f.isString,SessionId:f.isString,LogLevel:(0,i.default)(n=f.isEnum).call(n,null,l.LogLevel),MaxDataPointsPerHeartbeat:f.isPositiveInteger,HeartbeatInterval:f.isPositiveInteger,SessionTimeout:f.isPositiveInteger,RecordMetadata:f.isBoolean,RequestId:f.isString,ConfigReceivedTime:f.isInteger,AppUserId:f.isString},g=function(){function t(t,e,r,n){this.store=t,this.apiKey=e,this.apiAuth=r,this.appUserIdProvider=n,this.configuration=this.buildConfiguration()}return t.prototype.buildConfiguration=function(){return s(s({},(0,d.getValuesOrDefaults)(this.store.get("config")||{},h,y)),{LastServerResponseTime:(0,d.getValueOrDefault)(this.store.get("srt"),0,f.isInteger),ApiKey:this.apiKey,ApiAuth:this.apiAuth})},t.prototype.get=function(t){return this.configuration[t]},t.prototype.startNewSession=function(t){this.deleteData(),this.configuration.RequestId=t,this.configuration.AppUserId=this.appUserIdProvider.get()},t.prototype.isValidConfigResponse=function(t){for(var e=0,r=["SessionId","ClientId","HeartbeatInterval","SessionTimeout","MaxDataPointsPerHeartbeat"];e<r.length;e++){if(!(r[e]in t))return!1}return!0},t.prototype.fillWithJson=function(t){var e=s(s({},t),{RequestId:this.configuration.RequestId,AppUserId:this.configuration.AppUserId,ConfigReceivedTime:(0,v.getTime)()});this.store.set("config",e),this.configuration=this.buildConfiguration()},t.prototype.updateServerResponseTime=function(){var t=(0,v.getTime)();this.configuration.LastServerResponseTime=t,this.store.set("srt",t)},t.prototype.deleteData=function(){this.store.remove("srt"),this.store.remove("config"),this.configuration=this.buildConfiguration()},t.prototype.deleteSessionData=function(t){t===this.configuration.SessionId&&this.deleteData()},t}();e.default=g},8629:function(t,e,r){"use strict";var n=r(530);r(8309);var o=n(r(3649)),i=n(r(116)),a=n(r(2991)),u=n(r(2762)),s=n(r(3978)),c=n(r(1942)),f=function(){return f=c.default||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},f.apply(this,arguments)};(0,s.default)(e,"__esModule",{value:!0});var l=r(6343),p=r(7733),d=r(212),v=r(6766),h=r(9445),y=r(4794),g=function(){function t(t,e,r){this.store=t,this.configurationProvider=e,this.appContextProvider=r}return t.prototype.remove=function(){this.store.remove("data")},t.prototype.get=function(){return this.store.get("data")||[]},t.prototype.set=function(t){t.length?this.store.set("data",t):this.remove()},t.prototype.add=function(t,e,r){var n,o=void 0===r?{}:r,i=o.properties,a=o.systemProperties,u=((n={})[l.DataPointField.type]=t,n[l.DataPointField.timestamp]=(0,p.getUniqueTime)(),n[l.DataPointField.name]=e,n);(0,v.isDefined)(a)&&(a=f({},(0,h.mapKeys)(a,(function(t,e){return(0,y.addSystemPropertyPrefix)(e)}))));var s=f(f({},a),i);(0,h.isEmptyObject)(s)||(u[l.DataPointField.properties]=s);var c=this.get();this.prepareQueueToInsert(c),(0,d.last)((0,d.last)(c).ctx).data.push(u),this.set(c)},t.prototype.prepareQueueToInsert=function(t){var e=this.configurationProvider.get("RequestId"),r=this.configurationProvider.get("SessionId"),n=this.configurationProvider.get("ConfigReceivedTime"),o=this.appContextProvider.get();t.length&&(0,d.last)(t).rid===e||t.push({rid:e,sid:r,time:n,ctx:[]});var i=(0,d.last)(t),a=(0,d.last)(i.ctx);i.ctx.length&&a.id===o.id&&a.name===o.name||i.ctx.push({id:o.id,name:o.name,data:[]})},t.prototype.deleteByCount=function(t){var e,r,n,o,i,a,s,c,f,l,p=this.get();null===(n=null===(r=null===(e=p[0])||void 0===e?void 0:e.ctx[0])||void 0===r?void 0:r.data)||void 0===n||(0,u.default)(n).call(n,0,t),(null===(a=null===(i=null===(o=p[0])||void 0===o?void 0:o.ctx[0])||void 0===i?void 0:i.data)||void 0===a?void 0:a.length)||null===(c=null===(s=p[0])||void 0===s?void 0:s.ctx)||void 0===c||c.shift(),(null===(l=null===(f=p[0])||void 0===f?void 0:f.ctx)||void 0===l?void 0:l.length)||null==p||p.shift(),this.set(p)},t.prototype.assignPreSessionItems=function(t,e,r){var n;this.set((0,a.default)(n=this.get()).call(n,(function(n){return n.sid||n.rid!==t||(n.sid=e,n.time=r),n})))},t.prototype.deletePreSessionItems=function(t){var e;this.set((0,i.default)(e=this.get()).call(e,(function(e){return e.sid||e.rid!==t})))},t.prototype.deleteBySessionId=function(t){var e;this.set((0,i.default)(e=this.get()).call(e,(function(e){return e.sid!==t})))},t.prototype.select=function(t){var e,r,n,i,a=this.get()[0];return(null==a?void 0:a.sid)?{sessionId:a.sid,configReceivedTime:a.time,appContextId:null===(r=a.ctx[0])||void 0===r?void 0:r.id,appContextName:null===(n=a.ctx[0])||void 0===n?void 0:n.name,dataPoints:(null===(i=a.ctx[0])||void 0===i?void 0:(0,o.default)(e=i.data).call(e,0,t))||[]}:void 0},t}();e.default=g},9107:function(t,e,r){"use strict";(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0});var n=r(7551),o=function(){function t(t){this.store=t}return t.prototype.getOrCreate=function(){var t=this.store.get("tab");return t||(t=(0,n.getGuid)(),this.store.set("tab",t)),t},t}();e.default=o},6604:function(t,e,r){"use strict";var n,o=r(530),i=o(r(9340)),a=o(r(3978)),u=o(r(4943)),s=o(r(5507)),c=(n=function(t,e){return n=s.default||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?(0,u.default)(e):(r.prototype=e.prototype,new r)});(0,a.default)(e,"__esModule",{value:!0}),e.LocalStore=e.SessionStore=e.Store=void 0;var f=r(1859),l=r(6766),p=function(){function t(t,e){if(this.apiKey=t,this.storage=e,!(0,l.isNonEmptyString)(this.apiKey))throw new f.SNError("Must supply an API key to initialize a store instance");try{var r=this.getStoreKey("test");this.storage.setItem(r,"ok"),this.storage.removeItem(r)}catch(t){throw new f.SNError("Web storage is not supported")}}return t.prototype.getStoreKey=function(t){return"sn:"+this.apiKey+":"+t},t.prototype.set=function(t,e){return(0,l.isNullOrUndefined)(e)?this.remove(t):this.storage.setItem(this.getStoreKey(t),(0,i.default)(e))},t.prototype.get=function(t){var e=this.storage.getItem(this.getStoreKey(t));return null===e?void 0:JSON.parse(e)},t.prototype.remove=function(t){this.storage.removeItem(this.getStoreKey(t))},t}();e.Store=p;var d=function(t){function e(e){return t.call(this,e,window.sessionStorage)||this}return c(e,t),e}(p);e.SessionStore=d;var v=function(t){function e(e){return t.call(this,e,window.localStorage)||this}return c(e,t),e}(p);e.LocalStore=v},3453:function(t,e,r){"use strict";var n=r(530);r(8309);var o=n(r(8341)),i=n(r(5420)),a=n(r(3476)),u=n(r(3978)),s=n(r(3765)),c=n(r(4074)),f=function(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=(0,c.default)(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,s.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var f=t.length-1;f>=0;f--)(o=t[f])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&(0,u.default)(e,r,a),a},l=function(t,e,r,n){return new(r||(r=a.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},p=function(t,e){var r,n,a,u,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof i.default&&(u[o.default]=function(){return this}),u;function c(o){return function(i){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}},d=function(t){return t&&t.__esModule?t:{default:t}};(0,u.default)(e,"__esModule",{value:!0});var v=d(r(6737)),h=d(r(6068)),y=r(4308),g=r(1859),b=r(7733),m=r(6566),x=d(r(6373)),w=function(t,e){return{ok:!1,errorCode:t,data:e}},S=6e4,A=function(){function t(){}return t.getConfiguration=function(t){return l(this,void 0,void 0,(function(){var e,r,n,o,i;return p(this,(function(a){switch(a.label){case 0:return e=h.default.getScreenDimension(),r=e.height,n=e.width,o=v.default.domain.get(),[4,(0,y.postData)("config",{RequestId:t,TabId:v.default.tabId.getOrCreate(),SystemLocale:h.default.getSystemLocale(),AppUserId:v.default.appUserId.get(),ScreenHeight:r,ScreenWidth:n,ClientTime:(0,b.toISOString)((0,b.getTime)()),DomainId:null==o?void 0:o.id,DomainName:null==o?void 0:o.name,TrackingLevel:v.default.trackingConsent.get()},S)];case 1:return i=a.sent(),v.default.configuration.isValidConfigResponse(i)?t!==v.default.configuration.get("RequestId")?(x.default.warn("Ignoring old configuration with request id",t,"and session id",i.SessionId),[2,w(1,i.SessionId)]):(v.default.configuration.fillWithJson(i),v.default.configuration.updateServerResponseTime(),x.default.debug("Networker got valid configuration response",i),[2,{ok:!0}]):(x.default.warn("Configuration response for request id",t,"is not valid:",i),[2,w()])}}))}))},t.sendHeartbeat=function(t){return l(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,(0,y.postData)("heartbeat",{SessionId:t.sessionId,DataPoints:t.dataPoints,TabId:v.default.tabId.getOrCreate(),ClientTime:(0,b.toISOString)((0,b.getTime)()),ConfigReceivedTime:(0,b.toISOString)(t.configReceivedTime),AppContextId:t.appContextId,AppContextName:t.appContextName},S)];case 1:return e.sent(),v.default.configuration.updateServerResponseTime(),x.default.debug("Networker sent heartbeat"),[2,{ok:!0}]}}))}))},t.deleteUserData=function(t){return l(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,(0,y.postData)("delete-data",{AppUserId:t},S)];case 1:return e.sent(),x.default.debug("Networker deleted user"),[2,{ok:!0}]}}))}))},f([(0,m.Catch)(Error,(function(){return w()}))],t,"getConfiguration",null),f([(0,m.Catch)(Error,(function(){return w()})),(0,m.Catch)(g.HttpError,(function(t){return w(t.errorCode)}))],t,"sendHeartbeat",null),f([(0,m.Catch)(Error,(function(){return w()}))],t,"deleteUserData",null),t}();e.default=A},3992:function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}};(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0});var o=r(6766),i=r(1859),a=n(r(6737)),u=r(4794),s=n(r(6373)),c=function(){function t(){}return t.prototype.add=function(t,e,r){if(!(0,o.isNonEmptyString)(t))throw new i.SNTypeError("Invalid event name: ''");(0,o.isDefined)(e)&&((0,o.isObject)(e)?e=(0,u.getValidProperties)(e,!1,!1):(e=void 0,s.default.error("Invalid event properties for event",t)));var n={Page:a.default.currentPage.get()};(0,o.isDefined)(r)&&((0,o.isString)(r)?n.Type=r:s.default.error("Invalid type",r,"for event",t)),a.default.dataPoints.add(1,t,{properties:e,systemProperties:n})},t.prototype.addConsentChange=function(t,e){this.add("SNAnalyticsTrackingTriggered",{Value:t,PreviousValue:e})},t}();e.default=c},9686:function(t,e,r){"use strict";var n=r(530)(r(3978)),o=function(t){return t&&t.__esModule?t:{default:t}};(0,n.default)(e,"__esModule",{value:!0});var i=o(r(3992)),a=o(r(4908)),u=o(r(9103)),s=function(){function t(){this.eventRecorder=new i.default,this.pageRecorder=new a.default,this.userRecorder=new u.default}return(0,n.default)(t.prototype,"event",{get:function(){return this.eventRecorder},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"page",{get:function(){return this.pageRecorder},enumerable:!1,configurable:!0}),(0,n.default)(t.prototype,"user",{get:function(){return this.userRecorder},enumerable:!1,configurable:!0}),t}();e.default=s},4908:function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}};(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0});var o=r(6766),i=r(1859),a=n(r(6373)),u=n(r(6737)),s=function(){function t(){}return t.prototype.start=function(t,e){if(t=null!=t?t:"",!(0,o.isString)(t))throw new i.SNTypeError("Page name must be a string");var r={};(0,o.isDefined)(e)&&((0,o.isNonEmptyString)(e)?e.length>100?a.default.error("Ignoring description too long (greater than 100)"):r.Description=e:a.default.error("Ignoring empty page description")),u.default.currentPage.set(t),u.default.dataPoints.add(0,t,{systemProperties:r})},t}();e.default=s},9103:function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}};(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0});var o=r(6766),i=r(1859),a=n(r(6373)),u=n(r(6737)),s=r(4794),c=function(){function t(){}return t.prototype.getAppUserIdOrNull=function(){return u.default.appUserId.get()||null},t.prototype.setAppUserId=function(t){u.default.dataPoints.add(2,t||null)},t.prototype.removeProperty=function(t){this.setProperty(t,null)},t.prototype.setProperty=function(t,e){var r;this.setProperties(((r={})[t]=e,r))},t.prototype.setProperties=function(t){(0,o.isObject)(t)?(t=(0,s.getValidProperties)(t,!0,!0),u.default.dataPoints.add(2,this.getAppUserIdOrNull(),{properties:t})):a.default.error("Invalid user properties")},t.prototype.incProperty=function(t,e){if(!(0,o.isNumber)(e))throw new i.SNTypeError("Property value must be a number");e?this.operationToProperty(t,e,"$inc"):a.default.debug("Ignoring inc user property by zero")},t.prototype.appendToProperty=function(t,e){if(!(0,o.isString)(e))throw new i.SNTypeError("Property value must be a string");this.operationToProperty(t,[e],"$appendToList")},t.prototype.operationToProperty=function(t,e,r){var n,a;if(!(0,o.isNonEmptyString)(t))throw new i.SNTypeError("Property name must be a string");if((0,s.isSystemPropertyKey)(t))throw new i.SNTypeError("Property name has invalid prefix");u.default.dataPoints.add(2,this.getAppUserIdOrNull(),{properties:(n={},n[t]=(a={},a.op=r,a.val=e,a),n)})},t}();e.default=c},4308:function(t,e,r){"use strict";var n=r(530);r(1539),r(8674);var o=n(r(9340)),i=n(r(7766)),a=n(r(3978)),u=n(r(8341)),s=n(r(5420)),c=n(r(3476)),f=n(r(1942)),l=function(){return l=f.default||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},l.apply(this,arguments)},p=function(t,e,r,n){return new(r||(r=c.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},d=function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof s.default&&(i[u.default]=function(){return this}),i;function c(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},v=function(t){return t&&t.__esModule?t:{default:t}};(0,a.default)(e,"__esModule",{value:!0}),e.postData=void 0,r(7147),r(6486);var h=v(r(6373)),y=v(r(6737)),g=v(r(9179)),b=r(1859),m=r(9445),x=r(7733),w=function(t,e,r){return p(void 0,void 0,void 0,(function(){var n,a,u,s,f,v,x,w,S,A,E,T;return d(this,(function(I){switch(I.label){case 0:n=0,I.label=1;case 1:return I.trys.push([1,8,9,10]),a=new AbortController,u=a.signal,f=fetch,v=[g.default.baseUrl+"/web/"+t],T={method:"POST",mode:"cors",cache:"no-cache"},x=[{}],[4,p(void 0,void 0,void 0,(function(){var t,e;return d(this,(function(r){switch(r.label){case 0:return t=m.removeFalsyEntries,e={Version:g.default.VERSION,APIKey:y.default.configuration.get("ApiKey"),APIAuth:y.default.configuration.get("ApiAuth")},[4,y.default.browserId.getOrCreate()];case 1:return[2,t.apply(void 0,[(e.BrowserId=r.sent(),e.ClientId=y.default.clientId.get(),e)])]}}))}))];case 2:return s=f.apply(void 0,(0,i.default)(v).call(v,[(T.headers=l.apply(void 0,[l.apply(void 0,(0,i.default)(x).call(x,[I.sent()])),{"Content-Type":"application/json"}]),T.referrer="no-referrer",T.body=(0,o.default)(e),T.signal=u,T)])),n=window.setTimeout((function(){return a.abort()}),r),[4,s];case 3:w=I.sent(),I.label=4;case 4:return I.trys.push([4,6,,7]),[4,w.json()];case 5:return S=I.sent(),w.ok?[2,S]:(h.default.warn("Server call to '"+t+"' failed. Response is",w.status,":",S.Error),[2,c.default.reject(new b.HttpError(S.ErrorCode))]);case 6:return A=I.sent(),h.default.warn("Server call to '"+t+"' failed. Response is",w.status,A),[2,c.default.reject(new b.HttpError)];case 7:return[3,10];case 8:return E=I.sent(),h.default.warn("Server call to '"+t+"' failed.",E),[2,c.default.reject(new b.HttpError)];case 9:return clearTimeout(n),[7];case 10:return[2]}}))}))};e.postData=function(t,e,r){return p(void 0,void 0,void 0,(function(){var n,o;return d(this,(function(i){switch(i.label){case 0:return n=(0,x.getTime)(),[4,w(t,e,r)];case 1:return o=i.sent(),h.default.debug("Profiler: '"+t+"' request took",(0,x.getTime)()-n,"ms"),[2,o]}}))}))}},4983:function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}};(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0}),e.SessionState=void 0;var o,i=n(r(6737)),a=r(7733),u=n(r(6373)),s=r(6766);!function(t){t[t.Created=0]="Created",t[t.Started=1]="Started",t[t.Ended=2]="Ended"}(o=e.SessionState||(e.SessionState={}));var c=function(){function t(){this.isGettingCurrSessionConfig=!1}return t.prototype.setIsGettingConfiguration=function(t,e){t===i.default.configuration.get("RequestId")&&(this.isGettingCurrSessionConfig=e)},t.prototype.isSessionTimedOut=function(){return(0,a.getTime)()-i.default.configuration.get("LastServerResponseTime")>i.default.configuration.get("SessionTimeout")},t.prototype.isUserChanged=function(){return i.default.configuration.get("AppUserId")!==i.default.appUserId.get()},t.prototype.isSessionIdExist=function(){return(0,s.isNonEmptyString)(i.default.configuration.get("SessionId"))},t.prototype.getCurrentState=function(){var t;if(this.isUserChanged())u.default.debug("Session Lifecycle: User switched from",i.default.appUserId.get(),"to",i.default.configuration.get("AppUserId")),t=o.Ended;else if(this.isSessionIdExist()){var e=this.isSessionTimedOut();u.default.debug("Session Lifecycle: Session timed out - ",e),t=e?o.Ended:o.Started}else u.default.debug("Session Lifecycle: Getting config for current session - ",this.isGettingCurrSessionConfig),t=this.isGettingCurrSessionConfig?o.Created:o.Ended;return t},t}();e.default=c},212:function(t,e,r){"use strict";(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0}),e.last=void 0,e.last=function(t){return t[t.length-1]}},7733:function(t,e,r){"use strict";var n=r(530);r(4916),r(5306),(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.getUniqueTime=e.getTime=e.toDateString=e.toISOString=void 0;e.toISOString=function(t){return new Date(t).toISOString()};e.toDateString=function(t){return t.toLocaleString("en-GB",{timeZone:"UTC"}).replace(/,/g,"")};e.getTime=function(){return(new Date).getTime()};var o=(0,e.getTime)();e.getUniqueTime=function(){var t=(0,e.getTime)();return o=o>=t?o+1:t}},6566:function(t,e,r){"use strict";var n=r(530);r(1539),r(9714);var o=function(t){return t&&t.__esModule?t:{default:t}};(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.CatchAll=e.CatchAllAndReturn=e.Catch=void 0;var i=o(r(6373)),a=r(6766),u=function(t,e,r,n,o){if((0,a.isFunction)(r)&&n instanceof e)return r(n,t,o.toString());throw n};e.Catch=function(t,e){return function(r,n,o){var i=o.value;return o.value=function(){for(var r=this,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];try{var c=i.apply(this,o);return(0,a.isPromise)(c)?c.catch((function(o){return u(r,t,e,o,n)})):c}catch(r){return u(this,t,e,r,n)}},o}};e.CatchAllAndReturn=function(t){return(0,e.Catch)(Error,(function(e,r,n){return i.default.error("Fatal error in SNAnalytics:"+n+".",e.message),t}))},e.CatchAll=(0,e.CatchAllAndReturn)(void 0)},6068:function(t,e,r){"use strict";(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0});var n=function(){function t(){}return t.getScreenDimension=function(){var t=window.screen;return{height:t.height||0,width:t.width||0}},t.getSystemLocale=function(){return window.navigator.language.toLowerCase()},t}();e.default=n},1859:function(t,e,r){"use strict";var n=r(530);r(8309);var o,i=n(r(3978)),a=n(r(4943)),u=n(r(5507)),s=(o=function(t,e){return o=u.default||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?(0,a.default)(e):(r.prototype=e.prototype,new r)});function c(t,e){(0,u.default)(t,e.prototype),t.name=t.constructor.name}(0,i.default)(e,"__esModule",{value:!0}),e.HttpError=e.SNTypeError=e.SNError=void 0;var f=function(t){function e(r){var n=t.call(this,"[SNAnalytics] "+r)||this;return c(n,e),n}return s(e,t),e}(Error);e.SNError=f;var l=function(t){function e(r){var n=t.call(this,r)||this;return c(n,e),n}return s(e,t),e}(f);e.SNTypeError=l;var p=function(t){function e(r){var n=t.call(this,"Server call failed: "+r)||this;return c(n,e),n.errorCode=r,n}return s(e,t),e}(f);e.HttpError=p},1453:function(t,e,r){"use strict";var n=r(530);r(1539),r(9714);var o=n(r(9340)),i=n(r(4103)),a=n(r(3032)),u=n(r(3649)),s=n(r(3978)),c=n(r(8341)),f=n(r(5420)),l=n(r(3476)),p=function(t,e,r,n){return new(r||(r=l.default))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},d=function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof f.default&&(i[c.default]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},v=function(t){return t&&t.__esModule?t:{default:t}};(0,s.default)(e,"__esModule",{value:!0});var h=r(1859),y=v(r(6373)),g=r(7733),b=function t(){var e,r=Math.random();return r?(0,u.default)(e=r.toString(36)).call(e,2):t()},m=function(t){return void 0===t&&(t=0),new l.default((function(e){return(0,a.default)(e,t)}))},x=function(){function t(t,e){if(void 0===e&&(e=3e3),this.key=t,this.expiry=e,this.id=b(),this.localStorage=window.localStorage,this.expiry<100)throw new Error("Lock should have a minimum expiry of 100ms")}return t.prototype.lockName=function(t){return"sn:"+this.key+t},(0,s.default)(t.prototype,"outerLock",{get:function(){return this.lockName(":X")},enumerable:!1,configurable:!0}),(0,s.default)(t.prototype,"innerLock",{get:function(){return this.lockName(":Y")},enumerable:!1,configurable:!0}),t.prototype.tryGetLock=function(){return p(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.setLockHolder(this.outerLock),this.getLockHolderIdAndRemoveExpired(this.innerLock)?[2,!1]:(this.setLockHolder(this.innerLock),[4,m()]);case 1:return t.sent(),this.getLockHolderIdAndRemoveExpired(this.outerLock)===this.id?[2,!0]:[4,m(50)];case 2:return t.sent(),[2,this.getLockHolderIdAndRemoveExpired(this.innerLock)===this.id]}}))}))},t.prototype.acquire=function(){return p(this,void 0,void 0,(function(){var t;return d(this,(function(e){switch(e.label){case 0:t=(0,g.getTime)(),e.label=1;case 1:return(0,g.getTime)()-t<this.expiry?[4,this.tryGetLock()]:[3,4];case 2:var r;return e.sent()?(y.default.debug("Lock '"+this.key+"' acquired"),[2,{release:(0,i.default)(r=this.release).call(r,this)}]):[4,m(25*Math.random())];case 3:return e.sent(),[3,1];case 4:throw new h.SNError("Lock could not be acquired within "+this.expiry+"ms")}}))}))},t.prototype.release=function(){this.localStorage.removeItem(this.outerLock),this.localStorage.removeItem(this.innerLock),y.default.debug("Lock '"+this.key+"' released")},t.prototype.setLockHolder=function(t){var e={id:this.id,expiresAt:(0,g.getTime)()+this.expiry};this.localStorage.setItem(t,(0,o.default)(e))},t.prototype.getLockHolderIdAndRemoveExpired=function(t){var e=this.localStorage.getItem(t);if(e){var r=JSON.parse(e);if(!((0,g.getTime)()>r.expiresAt))return r.id;this.localStorage.removeItem(t)}},t}();e.default=x},6373:function(t,e,r){"use strict";var n=r(530),o=n(r(4198)),i=n(r(6295)),a=n(r(4103)),u=n(r(3978)),s=n(r(3765)),c=n(r(4074)),f=function(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=(0,c.default)(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,s.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var f=t.length-1;f>=0;f--)(o=t[f])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&(0,u.default)(e,r,a),a},l=function(t){return t&&t.__esModule?t:{default:t}};(0,u.default)(e,"__esModule",{value:!0});var p=l(r(9179)),d=r(3534),v=r(6766),h=r(9445),y=r(6566),g=function(){function t(){this.logMethods={0:["debug"],1:["info"],2:["warn"],3:["error"]},this.handleLogLevel(p.default.DEFAULT_LOG_LEVEL);try{var t;this.channel=new BroadcastChannel("SNAnalytics.Logger"),this.channel.onmessage=(0,a.default)(t=this.onBroadcastMessage).call(t,this)}catch(t){this.debug("Broadcast channel is not supported")}}return t.prototype.onBroadcastMessage=function(t){this.handleLogLevel(t.data.logLevel)},t.prototype.notify=function(t){var e;return null===(e=this.channel)||void 0===e?void 0:e.postMessage({logLevel:t})},t.prototype.handleLogLevel=function(t,e){void 0===e&&(e=!1);var r=(0,h.tryGetEnumValue)(t,d.LogLevel,!0);if((0,v.isUndefined)(r))this.warn("Ignoring invalid log level:",t);else if(this.logLevel!==r){for(var n=0,u=(0,i.default)(this.logMethods);n<u.length;n++)for(var s=u[n],c=s[0],f=0,l=s[1];f<l.length;f++){var y,g=l[f];this[g]=(0,o.default)(c,10)>=r?(0,a.default)(y=console[g]).call(y,console,p.default.LOGGER_PREFIX):function(){}}e&&this.notify(r),this.logLevel=r}},t.prototype.setDebugLevel=function(t){this.handleLogLevel(t,!0)},t.prototype.debug=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},t.prototype.info=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},t.prototype.warn=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},t.prototype.error=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},f([(0,y.Catch)(Error,(function(){}))],t.prototype,"onBroadcastMessage",null),t}();e.default=new g},9445:function(t,e,r){"use strict";var n=r(530),o=n(r(4198)),i=n(r(8914)),a=n(r(9392)),u=n(r(2991)),s=n(r(6295)),c=n(r(116)),f=n(r(1306)),l=n(r(6902));(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.getValuesOrDefaults=e.getValueOrDefault=e.tryGetEnumValue=e.mapValues=e.mapKeys=e.removeFalsyEntries=e.isEmptyObject=void 0;var p=r(6766);e.isEmptyObject=function(t){return 0===(0,l.default)(t).length};e.removeFalsyEntries=function(t){var e;return(0,f.default)((0,c.default)(e=(0,s.default)(t)).call(e,(function(t){var e=t[1];return Boolean(e)})))};e.mapKeys=function(t,e){var r;return(0,f.default)((0,u.default)(r=(0,s.default)(t)).call(r,(function(t){var r=t[0],n=t[1];return[e(n,r),n]})))};e.mapValues=function(t,e){var r;return(0,f.default)((0,u.default)(r=(0,s.default)(t)).call(r,(function(t){var r=t[0],n=t[1];return[r,e(n,r)]})))};e.tryGetEnumValue=function(t,e,r){var n;void 0===r&&(r=!1);try{var u,c=new a.default,f=new a.default;(0,i.default)(u=(0,s.default)(e)).call(u,(function(t){var e=t[0],n=t[1];(0,p.isNumber)((0,o.default)(e,10))||(c.set(r?e.toLowerCase():e,n),f.set(r&&(0,p.isString)(n)?n.toLowerCase():n,n))}));var l=r&&(0,p.isString)(t)?t.toLowerCase():t;return null!==(n=c.get(l))&&void 0!==n?n:f.get(l)}catch(t){return}};e.getValueOrDefault=function(t,e,r){return r(t)?t:e};e.getValuesOrDefaults=function(t,r,n){return(0,e.mapValues)(r,(function(r,o){return(0,e.getValueOrDefault)(t[o],r,n[o])}))}},4794:function(t,e,r){"use strict";var n=r(530);r(1539),r(9714);var o=n(r(6295)),i=n(r(9828)),a=function(t){return t&&t.__esModule?t:{default:t}};(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.getValidProperties=e.isSystemPropertyKey=e.addSystemPropertyPrefix=void 0;var u=r(6766),s=a(r(6373)),c=r(7733),f=a(r(9179));e.addSystemPropertyPrefix=function(t){return f.default.SYSTEM_PROPERTY_PREFIX+t};e.isSystemPropertyKey=function(t){return(0,i.default)(t).call(t,f.default.SYSTEM_PROPERTY_PREFIX)};var l=function(t,e){return null===t||((0,u.isArray)(t)?e:(0,u.isNumber)(t)?t!==1/0&&t!==-1/0:(0,u.isString)(t)||(0,u.isDate)(t)||(0,u.isBoolean)(t))},p=function(t){return(0,u.isDate)(t)?(0,c.toDateString)(t):(0,u.isBoolean)(t)?t.toString():t};e.getValidProperties=function(t,r,n){for(var i={},a=0,c=(0,o.default)(t);a<c.length;a++){var f=c[a],d=f[0],v=f[1];if((0,u.isNonEmptyString)(d))if((0,e.isSystemPropertyKey)(d))s.default.error("Invalid property prefix for name:",d);else if(l(v=null!=v?v:n?null:"",r))if((0,u.isArray)(v)){for(var h=[],y=0,g=v;y<g.length;y++){var b=g[y];(0,u.isString)(b)?h.push(b):s.default.error("Invalid value",b,"for list",d)}i[d]=h}else i[d]=p(v);else s.default.error("Invalid value",v,"for property",d);else s.default.error("Invalid property name:",d)}return i}},7551:function(t,e,r){"use strict";var n=r(530);r(6992),r(9600),r(9575),r(9653),r(1539),r(4916),r(9714),r(5306),r(2472),r(2990),r(8927),r(3105),r(5035),r(4345),r(7174),r(2846),r(4731),r(7209),r(6319),r(8867),r(7789),r(3739),r(9368),r(4483),r(2056),r(3462),r(678),r(7462),r(3824),r(5021),r(2974),r(5016),(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.getGuid=e.removeTrailingSlash=void 0;e.removeTrailingSlash=function(t){return t.replace(/\/+$/,"")};var o=function(){return[1e7,1e3,4e3,8e3,1e11].join("-").replace(/[018]/g,(function(t){return(Number(t)^(window.crypto?15&window.crypto.getRandomValues(new Uint8Array(1))[0]:16*Math.random()|0)>>Number(t)/4).toString(16)}))};e.getGuid=function(){return o().replace(/-/g,"").toLowerCase()}},3534:function(t,e,r){"use strict";(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0}),e.TrackingLevel=e.LogLevel=void 0,function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error"}(e.LogLevel||(e.LogLevel={})),function(t){t.Disabled="Disabled",t.Basic="Basic",t.Full="Full"}(e.TrackingLevel||(e.TrackingLevel={}))},1669:function(t,e,r){"use strict";(0,r(530)(r(3978)).default)(e,"__esModule",{value:!0}),e.normalizeAppUserId=void 0;var n=r(1859),o=r(6766);e.normalizeAppUserId=function(t){if(!(0,o.isNullOrUndefined)(t)&&!(0,o.isString)(t))throw new n.SNTypeError("User id must be a non empty string");return t||void 0}},6766:function(t,e,r){"use strict";var n=r(530),o=n(r(455)),i=n(r(8580)),a=n(r(1511)),u=n(r(8926)),s=n(r(5843));(0,n(r(3978)).default)(e,"__esModule",{value:!0}),e.isEnum=e.isPromise=e.isFunction=e.isArray=e.isObject=e.isDate=e.isBoolean=e.isPositiveInteger=e.isInteger=e.isNumber=e.isNonEmptyString=e.isString=e.isNullOrUndefined=e.isDefined=e.isUndefined=void 0;e.isUndefined=function(t){return void 0===t};e.isDefined=function(t){return!(0,e.isUndefined)(t)};e.isNullOrUndefined=function(t){return(0,e.isUndefined)(t)||null===t};e.isString=function(t){return"string"==typeof t};e.isNonEmptyString=function(t){return(0,e.isString)(t)&&Boolean((0,s.default)(t).call(t))};e.isNumber=function(t){return"number"==typeof t&&!(0,u.default)(t)};e.isInteger=function(t){return(0,e.isNumber)(t)&&t%1==0};e.isPositiveInteger=function(t){return(0,e.isInteger)(t)&&t>0};e.isBoolean=function(t){return"boolean"==typeof t};e.isDate=function(t){return t instanceof Date};e.isObject=function(t){return t===Object(t)&&t.constructor===Object};e.isArray=function(t){return(0,a.default)(t)};e.isFunction=function(t){return"function"==typeof t};e.isPromise=function(t){return!!t&&(0,e.isFunction)(t.then)&&(0,e.isFunction)(t.catch)};e.isEnum=function(t,e){var r;return(0,i.default)(r=(0,o.default)(t)).call(r,e)}},4034:function(t,e,r){r(2988);var n=r(4058);t.exports=n.Array.isArray},5367:function(t,e,r){r(5906);var n=r(5703);t.exports=n("Array").concat},2383:function(t,e,r){r(1501);var n=r(5703);t.exports=n("Array").filter},9324:function(t,e,r){r(2437);var n=r(5703);t.exports=n("Array").forEach},991:function(t,e,r){r(7690);var n=r(5703);t.exports=n("Array").includes},3866:function(t,e,r){r(8787);var n=r(5703);t.exports=n("Array").map},4900:function(t,e,r){r(186);var n=r(5703);t.exports=n("Array").slice},8209:function(t,e,r){r(8611);var n=r(5703);t.exports=n("Array").splice},7700:function(t,e,r){r(3381);var n=r(5703);t.exports=n("Function").bind},6246:function(t,e,r){var n=r(7700),o=Function.prototype;t.exports=function(t){var e=t.bind;return t===o||t instanceof Function&&e===o.bind?n:e}},6043:function(t,e,r){var n=r(5367),o=Array.prototype;t.exports=function(t){var e=t.concat;return t===o||t instanceof Array&&e===o.concat?n:e}},2480:function(t,e,r){var n=r(2383),o=Array.prototype;t.exports=function(t){var e=t.filter;return t===o||t instanceof Array&&e===o.filter?n:e}},8557:function(t,e,r){var n=r(991),o=r(1631),i=Array.prototype,a=String.prototype;t.exports=function(t){var e=t.includes;return t===i||t instanceof Array&&e===i.includes?n:"string"==typeof t||t===a||t instanceof String&&e===a.includes?o:e}},8287:function(t,e,r){var n=r(3866),o=Array.prototype;t.exports=function(t){var e=t.map;return t===o||t instanceof Array&&e===o.map?n:e}},9601:function(t,e,r){var n=r(4900),o=Array.prototype;t.exports=function(t){var e=t.slice;return t===o||t instanceof Array&&e===o.slice?n:e}},8339:function(t,e,r){var n=r(8209),o=Array.prototype;t.exports=function(t){var e=t.splice;return t===o||t instanceof Array&&e===o.splice?n:e}},1611:function(t,e,r){var n=r(3269),o=String.prototype;t.exports=function(t){var e=t.startsWith;return"string"==typeof t||t===o||t instanceof String&&e===o.startsWith?n:e}},2774:function(t,e,r){var n=r(3348),o=String.prototype;t.exports=function(t){var e=t.trim;return"string"==typeof t||t===o||t instanceof String&&e===o.trim?n:e}},4426:function(t,e,r){r(2619);var n=r(4058);n.JSON||(n.JSON={stringify:JSON.stringify}),t.exports=function(t,e,r){return n.JSON.stringify.apply(null,arguments)}},1018:function(t,e,r){r(7501),r(5967),r(7971),r(7634);var n=r(4058);t.exports=n.Map},63:function(t,e,r){r(9622);var n=r(4058);t.exports=n.Number.isNaN},5999:function(t,e,r){r(9221);var n=r(4058);t.exports=n.Object.assign},5254:function(t,e,r){r(6950);var n=r(4058).Object;t.exports=function(t,e){return n.create(t,e)}},8171:function(t,e,r){r(6450);var n=r(4058).Object,o=t.exports=function(t,e,r){return n.defineProperty(t,e,r)};n.defineProperty.sham&&(o.sham=!0)},3081:function(t,e,r){r(1078);var n=r(4058);t.exports=n.Object.entries},7699:function(t,e,r){r(6274),r(8387);var n=r(4058);t.exports=n.Object.fromEntries},286:function(t,e,r){r(6924);var n=r(4058).Object,o=t.exports=function(t,e){return n.getOwnPropertyDescriptor(t,e)};n.getOwnPropertyDescriptor.sham&&(o.sham=!0)},8494:function(t,e,r){r(1724);var n=r(4058);t.exports=n.Object.keys},3065:function(t,e,r){r(108);var n=r(4058);t.exports=n.Object.setPrototypeOf},8430:function(t,e,r){r(6614);var n=r(4058);t.exports=n.Object.values},8524:function(t,e,r){r(4038);var n=r(4058);t.exports=n.parseInt},2956:function(t,e,r){r(5967),r(7971),r(7634),r(8881),r(4560),r(4349);var n=r(4058);t.exports=n.Promise},1631:function(t,e,r){r(1035);var n=r(5703);t.exports=n("String").includes},3269:function(t,e,r){r(4761);var n=r(5703);t.exports=n("String").startsWith},3348:function(t,e,r){r(7398);var n=r(5703);t.exports=n("String").trim},7473:function(t,e,r){r(5906),r(5967),r(5824),r(8555),r(2615),r(1732),r(5903),r(1825),r(8394),r(5915),r(1766),r(2737),r(9911),r(4315),r(3131),r(4714),r(659),r(5327),r(9120);var n=r(4058);t.exports=n.Symbol},4227:function(t,e,r){r(1825),r(7971),r(7634);var n=r(1477);t.exports=n.f("iterator")},6600:function(t,e,r){var n=r(7473);r(8783),r(3975),r(6774),r(620),r(6172),t.exports=n},9759:function(t,e,r){var n=r(4227);t.exports=n},3916:function(t){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},1851:function(t,e,r){var n=r(941);t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},8479:function(t){t.exports=function(){}},5743:function(t){t.exports=function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return t}},6059:function(t,e,r){var n=r(941);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},6837:function(t,e,r){"use strict";var n=r(3610).forEach,o=r(4194),i=r(5486),a=o("forEach"),u=i("forEach");t.exports=a&&u?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},1692:function(t,e,r){var n=r(4529),o=r(3057),i=r(9413),a=function(t){return function(e,r,a){var u,s=n(e),c=o(s.length),f=i(a,c);if(t&&r!=r){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((t||f in s)&&s[f]===r)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},3610:function(t,e,r){var n=r(6843),o=r(7026),i=r(9678),a=r(3057),u=r(4692),s=[].push,c=function(t){var e=1==t,r=2==t,c=3==t,f=4==t,l=6==t,p=5==t||l;return function(d,v,h,y){for(var g,b,m=i(d),x=o(m),w=n(v,h,3),S=a(x.length),A=0,E=y||u,T=e?E(d,S):r?E(d,0):void 0;S>A;A++)if((p||A in x)&&(b=w(g=x[A],A,m),t))if(e)T[A]=b;else if(b)switch(t){case 3:return!0;case 5:return g;case 6:return A;case 2:s.call(T,g)}else if(f)return!1;return l?-1:c||f?f:T}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},568:function(t,e,r){var n=r(5981),o=r(9813),i=r(3385),a=o("species");t.exports=function(t){return i>=51||!n((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},4194:function(t,e,r){"use strict";var n=r(5981);t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},5486:function(t,e,r){var n=r(5746),o=r(5981),i=r(7457),a=Object.defineProperty,u={},s=function(t){throw t};t.exports=function(t,e){if(i(u,t))return u[t];e||(e={});var r=[][t],c=!!i(e,"ACCESSORS")&&e.ACCESSORS,f=i(e,0)?e[0]:s,l=i(e,1)?e[1]:void 0;return u[t]=!!r&&!o((function(){if(c&&!n)return!0;var t={length:-1};c?a(t,1,{enumerable:!0,get:s}):t[1]=1,r.call(t,f,l)}))}},4692:function(t,e,r){var n=r(941),o=r(1052),i=r(9813)("species");t.exports=function(t,e){var r;return o(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!o(r.prototype)?n(r)&&null===(r=r[i])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)}},5196:function(t,e,r){var n=r(6059);t.exports=function(t,e,r,o){try{return o?e(n(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&n(i.call(t)),e}}},1385:function(t,e,r){var n=r(9813)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var r=!1;try{var i={};i[n]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(t){}return r}},2532:function(t){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},9697:function(t,e,r){var n=r(2885),o=r(2532),i=r(9813)("toStringTag"),a="Arguments"==o(function(){return arguments}());t.exports=n?o:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?r:a?o(e):"Object"==(n=o(e))&&"function"==typeof e.callee?"Arguments":n}},5616:function(t,e,r){"use strict";var n=r(5988).f,o=r(9290),i=r(7524),a=r(6843),u=r(5743),s=r(3091),c=r(7771),f=r(4431),l=r(5746),p=r(1647).fastKey,d=r(5402),v=d.set,h=d.getterFor;t.exports={getConstructor:function(t,e,r,c){var f=t((function(t,n){u(t,f,e),v(t,{type:e,index:o(null),first:void 0,last:void 0,size:0}),l||(t.size=0),null!=n&&s(n,t[c],t,r)})),d=h(e),y=function(t,e,r){var n,o,i=d(t),a=g(t,e);return a?a.value=r:(i.last=a={index:o=p(e,!0),key:e,value:r,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=a),n&&(n.next=a),l?i.size++:t.size++,"F"!==o&&(i.index[o]=a)),t},g=function(t,e){var r,n=d(t),o=p(e);if("F"!==o)return n.index[o];for(r=n.first;r;r=r.next)if(r.key==e)return r};return i(f.prototype,{clear:function(){for(var t=d(this),e=t.index,r=t.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete e[r.index],r=r.next;t.first=t.last=void 0,l?t.size=0:this.size=0},delete:function(t){var e=this,r=d(e),n=g(e,t);if(n){var o=n.next,i=n.previous;delete r.index[n.index],n.removed=!0,i&&(i.next=o),o&&(o.previous=i),r.first==n&&(r.first=o),r.last==n&&(r.last=i),l?r.size--:e.size--}return!!n},forEach:function(t){for(var e,r=d(this),n=a(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.next:r.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!g(this,t)}}),i(f.prototype,r?{get:function(t){var e=g(this,t);return e&&e.value},set:function(t,e){return y(this,0===t?0:t,e)}}:{add:function(t){return y(this,t=0===t?0:t,t)}}),l&&n(f.prototype,"size",{get:function(){return d(this).size}}),f},setStrong:function(t,e,r){var n=e+" Iterator",o=h(e),i=h(n);c(t,e,(function(t,e){v(this,{type:n,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?"keys"==e?{value:r.key,done:!1}:"values"==e?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),f(e)}}},4683:function(t,e,r){"use strict";var n=r(6887),o=r(1899),i=r(1647),a=r(5981),u=r(2029),s=r(3091),c=r(5743),f=r(941),l=r(904),p=r(5988).f,d=r(3610).forEach,v=r(5746),h=r(5402),y=h.set,g=h.getterFor;t.exports=function(t,e,r){var h,b=-1!==t.indexOf("Map"),m=-1!==t.indexOf("Weak"),x=b?"set":"add",w=o[t],S=w&&w.prototype,A={};if(v&&"function"==typeof w&&(m||S.forEach&&!a((function(){(new w).entries().next()})))){h=e((function(e,r){y(c(e,h,t),{type:t,collection:new w}),null!=r&&s(r,e[x],e,b)}));var E=g(t);d(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var e="add"==t||"set"==t;!(t in S)||m&&"clear"==t||u(h.prototype,t,(function(r,n){var o=E(this).collection;if(!e&&m&&!f(r))return"get"==t&&void 0;var i=o[t](0===r?0:r,n);return e?this:i}))})),m||p(h.prototype,"size",{configurable:!0,get:function(){return E(this).collection.size}})}else h=r.getConstructor(e,t,b,x),i.REQUIRED=!0;return l(h,t,!1,!0),A[t]=h,n({global:!0,forced:!0},A),m||r.setStrong(h,t,b),h}},7772:function(t,e,r){var n=r(9813)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[n]=!1,"/./"[t](e)}catch(t){}}return!1}},4160:function(t,e,r){var n=r(5981);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},1046:function(t,e,r){"use strict";var n=r(5143).IteratorPrototype,o=r(9290),i=r(1887),a=r(904),u=r(2077),s=function(){return this};t.exports=function(t,e,r){var c=e+" Iterator";return t.prototype=o(n,{next:i(1,r)}),a(t,c,!1,!0),u[c]=s,t}},2029:function(t,e,r){var n=r(5746),o=r(5988),i=r(1887);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},1887:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},5449:function(t,e,r){"use strict";var n=r(6935),o=r(5988),i=r(1887);t.exports=function(t,e,r){var a=n(e);a in t?o.f(t,a,i(0,r)):t[a]=r}},7771:function(t,e,r){"use strict";var n=r(6887),o=r(1046),i=r(249),a=r(8929),u=r(904),s=r(2029),c=r(9754),f=r(9813),l=r(2529),p=r(2077),d=r(5143),v=d.IteratorPrototype,h=d.BUGGY_SAFARI_ITERATORS,y=f("iterator"),g="keys",b="values",m="entries",x=function(){return this};t.exports=function(t,e,r,f,d,w,S){o(r,e,f);var A,E,T,I=function(t){if(t===d&&j)return j;if(!h&&t in _)return _[t];switch(t){case g:case b:case m:return function(){return new r(this,t)}}return function(){return new r(this)}},P=e+" Iterator",O=!1,_=t.prototype,C=_[y]||_["@@iterator"]||d&&_[d],j=!h&&C||I(d),R="Array"==e&&_.entries||C;if(R&&(A=i(R.call(new t)),v!==Object.prototype&&A.next&&(l||i(A)===v||(a?a(A,v):"function"!=typeof A[y]&&s(A,y,x)),u(A,P,!0,!0),l&&(p[P]=x))),d==b&&C&&C.name!==b&&(O=!0,j=function(){return C.call(this)}),l&&!S||_[y]===j||s(_,y,j),p[e]=j,d)if(E={values:I(b),keys:w?j:I(g),entries:I(m)},S)for(T in E)(h||O||!(T in _))&&c(_,T,E[T]);else n({target:e,proto:!0,forced:h||O},E);return E}},6349:function(t,e,r){var n=r(4058),o=r(7457),i=r(1477),a=r(5988).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});o(e,t)||a(e,t,{value:i.f(t)})}},5746:function(t,e,r){var n=r(5981);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},1333:function(t,e,r){var n=r(1899),o=r(941),i=n.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},3281:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},2749:function(t,e,r){var n=r(2861);t.exports=/(iphone|ipod|ipad).*applewebkit/i.test(n)},2861:function(t,e,r){var n=r(626);t.exports=n("navigator","userAgent")||""},3385:function(t,e,r){var n,o,i=r(1899),a=r(2861),u=i.process,s=u&&u.versions,c=s&&s.v8;c?o=(n=c.split("."))[0]+n[1]:a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=n[1]),t.exports=o&&+o},5703:function(t,e,r){var n=r(4058);t.exports=function(t){return n[t+"Prototype"]}},6759:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6887:function(t,e,r){"use strict";var n=r(1899),o=r(9677).f,i=r(7252),a=r(4058),u=r(6843),s=r(2029),c=r(7457),f=function(t){var e=function(e,r,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,r)}return new t(e,r,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e};t.exports=function(t,e){var r,l,p,d,v,h,y,g,b=t.target,m=t.global,x=t.stat,w=t.proto,S=m?n:x?n[b]:(n[b]||{}).prototype,A=m?a:a[b]||(a[b]={}),E=A.prototype;for(p in e)r=!i(m?p:b+(x?".":"#")+p,t.forced)&&S&&c(S,p),v=A[p],r&&(h=t.noTargetGet?(g=o(S,p))&&g.value:S[p]),d=r&&h?h:e[p],r&&typeof v==typeof d||(y=t.bind&&r?u(d,n):t.wrap&&r?f(d):w&&"function"==typeof d?u(Function.call,d):d,(t.sham||d&&d.sham||v&&v.sham)&&s(y,"sham",!0),A[p]=y,w&&(c(a,l=b+"Prototype")||s(a,l,{}),a[l][p]=d,t.real&&E&&!E[p]&&s(E,p,d)))}},5981:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},5602:function(t,e,r){var n=r(5981);t.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},6843:function(t,e,r){var n=r(3916);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},8308:function(t,e,r){"use strict";var n=r(3916),o=r(941),i=[].slice,a={},u=function(t,e,r){if(!(e in a)){for(var n=[],o=0;o<e;o++)n[o]="a["+o+"]";a[e]=Function("C,a","return new C("+n.join(",")+")")}return a[e](t,r)};t.exports=Function.bind||function(t){var e=n(this),r=i.call(arguments,1),a=function(){var n=r.concat(i.call(arguments));return this instanceof a?u(e,n.length,n):e.apply(t,n)};return o(e.prototype)&&(a.prototype=e.prototype),a}},626:function(t,e,r){var n=r(4058),o=r(1899),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t])||i(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},2902:function(t,e,r){var n=r(9697),o=r(2077),i=r(9813)("iterator");t.exports=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[n(t)]}},1899:function(t,e,r){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||Function("return this")()},7457:function(t){var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},7748:function(t){t.exports={}},4845:function(t,e,r){var n=r(1899);t.exports=function(t,e){var r=n.console;r&&r.error&&(1===arguments.length?r.error(t):r.error(t,e))}},5463:function(t,e,r){var n=r(626);t.exports=n("document","documentElement")},2840:function(t,e,r){var n=r(5746),o=r(5981),i=r(1333);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},7026:function(t,e,r){var n=r(5981),o=r(2532),i="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},1302:function(t,e,r){var n=r(3030),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource},1647:function(t,e,r){var n=r(7748),o=r(941),i=r(7457),a=r(5988).f,u=r(9418),s=r(5602),c=u("meta"),f=0,l=Object.isExtensible||function(){return!0},p=function(t){a(t,c,{value:{objectID:"O"+ ++f,weakData:{}}})},d=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,c)){if(!l(t))return"F";if(!e)return"E";p(t)}return t[c].objectID},getWeakData:function(t,e){if(!i(t,c)){if(!l(t))return!0;if(!e)return!1;p(t)}return t[c].weakData},onFreeze:function(t){return s&&d.REQUIRED&&l(t)&&!i(t,c)&&p(t),t}};n[c]=!0},5402:function(t,e,r){var n,o,i,a=r(8019),u=r(1899),s=r(941),c=r(2029),f=r(7457),l=r(4262),p=r(7748),d=u.WeakMap;if(a){var v=new d,h=v.get,y=v.has,g=v.set;n=function(t,e){return g.call(v,t,e),e},o=function(t){return h.call(v,t)||{}},i=function(t){return y.call(v,t)}}else{var b=l("state");p[b]=!0,n=function(t,e){return c(t,b,e),e},o=function(t){return f(t,b)?t[b]:{}},i=function(t){return f(t,b)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!s(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},6782:function(t,e,r){var n=r(9813),o=r(2077),i=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||a[i]===t)}},1052:function(t,e,r){var n=r(2532);t.exports=Array.isArray||function(t){return"Array"==n(t)}},7252:function(t,e,r){var n=r(5981),o=/#|\.prototype\./,i=function(t,e){var r=u[a(t)];return r==c||r!=s&&("function"==typeof e?n(e):!!e)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=i.data={},s=i.NATIVE="N",c=i.POLYFILL="P";t.exports=i},941:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},2529:function(t){t.exports=!0},685:function(t,e,r){var n=r(941),o=r(2532),i=r(9813)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},3091:function(t,e,r){var n=r(6059),o=r(6782),i=r(3057),a=r(6843),u=r(2902),s=r(5196),c=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,r,f,l){var p,d,v,h,y,g,b,m=a(e,r,f?2:1);if(l)p=t;else{if("function"!=typeof(d=u(t)))throw TypeError("Target is not iterable");if(o(d)){for(v=0,h=i(t.length);h>v;v++)if((y=f?m(n(b=t[v])[0],b[1]):m(t[v]))&&y instanceof c)return y;return new c(!1)}p=d.call(t)}for(g=p.next;!(b=g.call(p)).done;)if("object"==typeof(y=s(p,m,b.value,f))&&y&&y instanceof c)return y;return new c(!1)}).stop=function(t){return new c(!0,t)}},5143:function(t,e,r){"use strict";var n,o,i,a=r(249),u=r(2029),s=r(7457),c=r(9813),f=r(2529),l=c("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(n=o):p=!0),null==n&&(n={}),f||s(n,l)||u(n,l,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:p}},2077:function(t){t.exports={}},6132:function(t,e,r){var n,o,i,a,u,s,c,f,l=r(1899),p=r(9677).f,d=r(2532),v=r(2941).set,h=r(2749),y=l.MutationObserver||l.WebKitMutationObserver,g=l.process,b=l.Promise,m="process"==d(g),x=p(l,"queueMicrotask"),w=x&&x.value;w||(n=function(){var t,e;for(m&&(t=g.domain)&&t.exit();o;){e=o.fn,o=o.next;try{e()}catch(t){throw o?a():i=void 0,t}}i=void 0,t&&t.enter()},m?a=function(){g.nextTick(n)}:y&&!h?(u=!0,s=document.createTextNode(""),new y(n).observe(s,{characterData:!0}),a=function(){s.data=u=!u}):b&&b.resolve?(c=b.resolve(void 0),f=c.then,a=function(){f.call(c,n)}):a=function(){v.call(l,n)}),t.exports=w||function(t){var e={fn:t,next:void 0};i&&(i.next=e),o||(o=e,a()),i=e}},9297:function(t,e,r){var n=r(1899);t.exports=n.Promise},2497:function(t,e,r){var n=r(5981);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},8019:function(t,e,r){var n=r(1899),o=r(1302),i=n.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},9520:function(t,e,r){"use strict";var n=r(3916),o=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)};t.exports.f=function(t){return new o(t)}},344:function(t,e,r){var n=r(685);t.exports=function(t){if(n(t))throw TypeError("The method doesn't accept regular expressions");return t}},9806:function(t,e,r){var n=r(1899),o=r(4853).trim,i=r(3483),a=n.parseInt,u=/^[+-]?0[Xx]/,s=8!==a(i+"08")||22!==a(i+"0x16");t.exports=s?function(t,e){var r=o(String(t));return a(r,e>>>0||(u.test(r)?16:10))}:a},4420:function(t,e,r){"use strict";var n=r(5746),o=r(5981),i=r(4771),a=r(7857),u=r(6760),s=r(9678),c=r(7026),f=Object.assign,l=Object.defineProperty;t.exports=!f||o((function(){if(n&&1!==f({b:1},f(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol(),o="abcdefghijklmnopqrst";return t[r]=7,o.split("").forEach((function(t){e[t]=t})),7!=f({},t)[r]||i(f({},e)).join("")!=o}))?function(t,e){for(var r=s(t),o=arguments.length,f=1,l=a.f,p=u.f;o>f;)for(var d,v=c(arguments[f++]),h=l?i(v).concat(l(v)):i(v),y=h.length,g=0;y>g;)d=h[g++],n&&!p.call(v,d)||(r[d]=v[d]);return r}:f},9290:function(t,e,r){var n,o=r(6059),i=r(9938),a=r(6759),u=r(7748),s=r(5463),c=r(1333),f=r(4262),l=f("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"</"+"script>"},v=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;v=n?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(n):((e=c("iframe")).style.display="none",s.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var r=a.length;r--;)delete v.prototype[a[r]];return v()};u[l]=!0,t.exports=Object.create||function(t,e){var r;return null!==t?(p.prototype=o(t),r=new p,p.prototype=null,r[l]=t):r=v(),void 0===e?r:i(r,e)}},9938:function(t,e,r){var n=r(5746),o=r(5988),i=r(6059),a=r(4771);t.exports=n?Object.defineProperties:function(t,e){i(t);for(var r,n=a(e),u=n.length,s=0;u>s;)o.f(t,r=n[s++],e[r]);return t}},5988:function(t,e,r){var n=r(5746),o=r(2840),i=r(6059),a=r(6935),u=Object.defineProperty;e.f=n?u:function(t,e,r){if(i(t),e=a(e,!0),i(r),o)try{return u(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},9677:function(t,e,r){var n=r(5746),o=r(6760),i=r(1887),a=r(4529),u=r(6935),s=r(7457),c=r(2840),f=Object.getOwnPropertyDescriptor;e.f=n?f:function(t,e){if(t=a(t),e=u(e,!0),c)try{return f(t,e)}catch(t){}if(s(t,e))return i(!o.f.call(t,e),t[e])}},684:function(t,e,r){var n=r(4529),o=r(946).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return a.slice()}}(t):o(n(t))}},946:function(t,e,r){var n=r(5629),o=r(6759).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},7857:function(t,e){e.f=Object.getOwnPropertySymbols},249:function(t,e,r){var n=r(7457),o=r(9678),i=r(4262),a=r(4160),u=i("IE_PROTO"),s=Object.prototype;t.exports=a?Object.getPrototypeOf:function(t){return t=o(t),n(t,u)?t[u]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},5629:function(t,e,r){var n=r(7457),o=r(4529),i=r(1692).indexOf,a=r(7748);t.exports=function(t,e){var r,u=o(t),s=0,c=[];for(r in u)!n(a,r)&&n(u,r)&&c.push(r);for(;e.length>s;)n(u,r=e[s++])&&(~i(c,r)||c.push(r));return c}},4771:function(t,e,r){var n=r(5629),o=r(6759);t.exports=Object.keys||function(t){return n(t,o)}},6760:function(t,e){"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},8929:function(t,e,r){var n=r(6059),o=r(1851);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),e=r instanceof Array}catch(t){}return function(r,i){return n(r),o(i),e?t.call(r,i):r.__proto__=i,r}}():void 0)},8810:function(t,e,r){var n=r(5746),o=r(4771),i=r(4529),a=r(6760).f,u=function(t){return function(e){for(var r,u=i(e),s=o(u),c=s.length,f=0,l=[];c>f;)r=s[f++],n&&!a.call(u,r)||l.push(t?[r,u[r]]:u[r]);return l}};t.exports={entries:u(!0),values:u(!1)}},5623:function(t,e,r){"use strict";var n=r(2885),o=r(9697);t.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},4058:function(t){t.exports={}},2:function(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},6584:function(t,e,r){var n=r(6059),o=r(941),i=r(9520);t.exports=function(t,e){if(n(t),o(e)&&e.constructor===t)return e;var r=i.f(t);return(0,r.resolve)(e),r.promise}},7524:function(t,e,r){var n=r(9754);t.exports=function(t,e,r){for(var o in e)r&&r.unsafe&&t[o]?t[o]=e[o]:n(t,o,e[o],r);return t}},9754:function(t,e,r){var n=r(2029);t.exports=function(t,e,r,o){o&&o.enumerable?t[e]=r:n(t,e,r)}},8219:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},4911:function(t,e,r){var n=r(1899),o=r(2029);t.exports=function(t,e){try{o(n,t,e)}catch(r){n[t]=e}return e}},4431:function(t,e,r){"use strict";var n=r(626),o=r(5988),i=r(9813),a=r(5746),u=i("species");t.exports=function(t){var e=n(t),r=o.f;a&&e&&!e[u]&&r(e,u,{configurable:!0,get:function(){return this}})}},904:function(t,e,r){var n=r(2885),o=r(5988).f,i=r(2029),a=r(7457),u=r(5623),s=r(9813)("toStringTag");t.exports=function(t,e,r,c){if(t){var f=r?t:t.prototype;a(f,s)||o(f,s,{configurable:!0,value:e}),c&&!n&&i(f,"toString",u)}}},4262:function(t,e,r){var n=r(8726),o=r(9418),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},3030:function(t,e,r){var n=r(1899),o=r(4911),i="__core-js_shared__",a=n[i]||o(i,{});t.exports=a},8726:function(t,e,r){var n=r(2529),o=r(3030);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.4",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},487:function(t,e,r){var n=r(6059),o=r(3916),i=r(9813)("species");t.exports=function(t,e){var r,a=n(t).constructor;return void 0===a||null==(r=n(a)[i])?e:o(r)}},4620:function(t,e,r){var n=r(8459),o=r(8219),i=function(t){return function(e,r){var i,a,u=String(o(e)),s=n(r),c=u.length;return s<0||s>=c?t?"":void 0:(i=u.charCodeAt(s))<55296||i>56319||s+1===c||(a=u.charCodeAt(s+1))<56320||a>57343?t?u.charAt(s):i:t?u.slice(s,s+2):a-56320+(i-55296<<10)+65536}};t.exports={codeAt:i(!1),charAt:i(!0)}},3093:function(t,e,r){var n=r(5981),o=r(3483);t.exports=function(t){return n((function(){return!!o[t]()||"​…᠎"!="​…᠎"[t]()||o[t].name!==t}))}},4853:function(t,e,r){var n=r(8219),o="["+r(3483)+"]",i=RegExp("^"+o+o+"*"),a=RegExp(o+o+"*$"),u=function(t){return function(e){var r=String(n(e));return 1&t&&(r=r.replace(i,"")),2&t&&(r=r.replace(a,"")),r}};t.exports={start:u(1),end:u(2),trim:u(3)}},2941:function(t,e,r){var n,o,i,a=r(1899),u=r(5981),s=r(2532),c=r(6843),f=r(5463),l=r(1333),p=r(2749),d=a.location,v=a.setImmediate,h=a.clearImmediate,y=a.process,g=a.MessageChannel,b=a.Dispatch,m=0,x={},w="onreadystatechange",S=function(t){if(x.hasOwnProperty(t)){var e=x[t];delete x[t],e()}},A=function(t){return function(){S(t)}},E=function(t){S(t.data)},T=function(t){a.postMessage(t+"",d.protocol+"//"+d.host)};v&&h||(v=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return x[++m]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},n(m),m},h=function(t){delete x[t]},"process"==s(y)?n=function(t){y.nextTick(A(t))}:b&&b.now?n=function(t){b.now(A(t))}:g&&!p?(i=(o=new g).port2,o.port1.onmessage=E,n=c(i.postMessage,i,1)):!a.addEventListener||"function"!=typeof postMessage||a.importScripts||u(T)||"file:"===d.protocol?n=w in l("script")?function(t){f.appendChild(l("script")).onreadystatechange=function(){f.removeChild(this),S(t)}}:function(t){setTimeout(A(t),0)}:(n=T,a.addEventListener("message",E,!1))),t.exports={set:v,clear:h}},9413:function(t,e,r){var n=r(8459),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},4529:function(t,e,r){var n=r(7026),o=r(8219);t.exports=function(t){return n(o(t))}},8459:function(t){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},3057:function(t,e,r){var n=r(8459),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},9678:function(t,e,r){var n=r(8219);t.exports=function(t){return Object(n(t))}},6935:function(t,e,r){var n=r(941);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},2885:function(t,e,r){var n={};n[r(9813)("toStringTag")]="z",t.exports="[object z]"===String(n)},9418:function(t){var e=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+r).toString(36)}},2302:function(t,e,r){var n=r(2497);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},1477:function(t,e,r){var n=r(9813);e.f=n},9813:function(t,e,r){var n=r(1899),o=r(8726),i=r(7457),a=r(9418),u=r(2497),s=r(2302),c=o("wks"),f=n.Symbol,l=s?f:f&&f.withoutSetter||a;t.exports=function(t){return i(c,t)||(u&&i(f,t)?c[t]=f[t]:c[t]=l("Symbol."+t)),c[t]}},3483:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},5906:function(t,e,r){"use strict";var n=r(6887),o=r(5981),i=r(1052),a=r(941),u=r(9678),s=r(3057),c=r(5449),f=r(4692),l=r(568),p=r(9813),d=r(3385),v=p("isConcatSpreadable"),h=9007199254740991,y="Maximum allowed index exceeded",g=d>=51||!o((function(){var t=[];return t[v]=!1,t.concat()[0]!==t})),b=l("concat"),m=function(t){if(!a(t))return!1;var e=t[v];return void 0!==e?!!e:i(t)};n({target:"Array",proto:!0,forced:!g||!b},{concat:function(t){var e,r,n,o,i,a=u(this),l=f(a,0),p=0;for(e=-1,n=arguments.length;e<n;e++)if(m(i=-1===e?a:arguments[e])){if(p+(o=s(i.length))>h)throw TypeError(y);for(r=0;r<o;r++,p++)r in i&&c(l,p,i[r])}else{if(p>=h)throw TypeError(y);c(l,p++,i)}return l.length=p,l}})},1501:function(t,e,r){"use strict";var n=r(6887),o=r(3610).filter,i=r(568),a=r(5486),u=i("filter"),s=a("filter");n({target:"Array",proto:!0,forced:!u||!s},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},2437:function(t,e,r){"use strict";var n=r(6887),o=r(6837);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},7690:function(t,e,r){"use strict";var n=r(6887),o=r(1692).includes,i=r(8479);n({target:"Array",proto:!0,forced:!r(5486)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),i("includes")},2988:function(t,e,r){r(6887)({target:"Array",stat:!0},{isArray:r(1052)})},6274:function(t,e,r){"use strict";var n=r(4529),o=r(8479),i=r(2077),a=r(5402),u=r(7771),s="Array Iterator",c=a.set,f=a.getterFor(s);t.exports=u(Array,"Array",(function(t,e){c(this,{type:s,target:n(t),index:0,kind:e})}),(function(){var t=f(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},8787:function(t,e,r){"use strict";var n=r(6887),o=r(3610).map,i=r(568),a=r(5486),u=i("map"),s=a("map");n({target:"Array",proto:!0,forced:!u||!s},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},186:function(t,e,r){"use strict";var n=r(6887),o=r(941),i=r(1052),a=r(9413),u=r(3057),s=r(4529),c=r(5449),f=r(9813),l=r(568),p=r(5486),d=l("slice"),v=p("slice",{ACCESSORS:!0,0:0,1:2}),h=f("species"),y=[].slice,g=Math.max;n({target:"Array",proto:!0,forced:!d||!v},{slice:function(t,e){var r,n,f,l=s(this),p=u(l.length),d=a(t,p),v=a(void 0===e?p:e,p);if(i(l)&&("function"!=typeof(r=l.constructor)||r!==Array&&!i(r.prototype)?o(r)&&null===(r=r[h])&&(r=void 0):r=void 0,r===Array||void 0===r))return y.call(l,d,v);for(n=new(void 0===r?Array:r)(g(v-d,0)),f=0;d<v;d++,f++)d in l&&c(n,f,l[d]);return n.length=f,n}})},8611:function(t,e,r){"use strict";var n=r(6887),o=r(9413),i=r(8459),a=r(3057),u=r(9678),s=r(4692),c=r(5449),f=r(568),l=r(5486),p=f("splice"),d=l("splice",{ACCESSORS:!0,0:0,1:2}),v=Math.max,h=Math.min,y=9007199254740991,g="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!p||!d},{splice:function(t,e){var r,n,f,l,p,d,b=u(this),m=a(b.length),x=o(t,m),w=arguments.length;if(0===w?r=n=0:1===w?(r=0,n=m-x):(r=w-2,n=h(v(i(e),0),m-x)),m+r-n>y)throw TypeError(g);for(f=s(b,n),l=0;l<n;l++)(p=x+l)in b&&c(f,l,b[p]);if(f.length=n,r<n){for(l=x;l<m-n;l++)d=l+r,(p=l+n)in b?b[d]=b[p]:delete b[d];for(l=m;l>m-n+r;l--)delete b[l-1]}else if(r>n)for(l=m-n;l>x;l--)d=l+r-1,(p=l+n-1)in b?b[d]=b[p]:delete b[d];for(l=0;l<r;l++)b[l+x]=arguments[l+2];return b.length=m-n+r,f}})},3381:function(t,e,r){r(6887)({target:"Function",proto:!0},{bind:r(8308)})},2619:function(t,e,r){var n=r(6887),o=r(626),i=r(5981),a=o("JSON","stringify"),u=/[\uD800-\uDFFF]/g,s=/^[\uD800-\uDBFF]$/,c=/^[\uDC00-\uDFFF]$/,f=function(t,e,r){var n=r.charAt(e-1),o=r.charAt(e+1);return s.test(t)&&!c.test(o)||c.test(t)&&!s.test(n)?"\\u"+t.charCodeAt(0).toString(16):t},l=i((function(){return'"\\udf06\\ud834"'!==a("\udf06\ud834")||'"\\udead"'!==a("\udead")}));a&&n({target:"JSON",stat:!0,forced:l},{stringify:function(t,e,r){var n=a.apply(null,arguments);return"string"==typeof n?n.replace(u,f):n}})},9120:function(t,e,r){var n=r(1899);r(904)(n.JSON,"JSON",!0)},7501:function(t,e,r){"use strict";var n=r(4683),o=r(5616);t.exports=n("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),o)},5327:function(t,e,r){r(904)(Math,"Math",!0)},9622:function(t,e,r){r(6887)({target:"Number",stat:!0},{isNaN:function(t){return t!=t}})},9221:function(t,e,r){var n=r(6887),o=r(4420);n({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},6950:function(t,e,r){r(6887)({target:"Object",stat:!0,sham:!r(5746)},{create:r(9290)})},6450:function(t,e,r){var n=r(6887),o=r(5746);n({target:"Object",stat:!0,forced:!o,sham:!o},{defineProperty:r(5988).f})},1078:function(t,e,r){var n=r(6887),o=r(8810).entries;n({target:"Object",stat:!0},{entries:function(t){return o(t)}})},8387:function(t,e,r){var n=r(6887),o=r(3091),i=r(5449);n({target:"Object",stat:!0},{fromEntries:function(t){var e={};return o(t,(function(t,r){i(e,t,r)}),void 0,!0),e}})},6924:function(t,e,r){var n=r(6887),o=r(5981),i=r(4529),a=r(9677).f,u=r(5746),s=o((function(){a(1)}));n({target:"Object",stat:!0,forced:!u||s,sham:!u},{getOwnPropertyDescriptor:function(t,e){return a(i(t),e)}})},1724:function(t,e,r){var n=r(6887),o=r(9678),i=r(4771);n({target:"Object",stat:!0,forced:r(5981)((function(){i(1)}))},{keys:function(t){return i(o(t))}})},108:function(t,e,r){r(6887)({target:"Object",stat:!0},{setPrototypeOf:r(8929)})},5967:function(){},6614:function(t,e,r){var n=r(6887),o=r(8810).values;n({target:"Object",stat:!0},{values:function(t){return o(t)}})},4038:function(t,e,r){var n=r(6887),o=r(9806);n({global:!0,forced:parseInt!=o},{parseInt:o})},4560:function(t,e,r){"use strict";var n=r(6887),o=r(3916),i=r(9520),a=r(2),u=r(3091);n({target:"Promise",stat:!0},{allSettled:function(t){var e=this,r=i.f(e),n=r.resolve,s=r.reject,c=a((function(){var r=o(e.resolve),i=[],a=0,s=1;u(t,(function(t){var o=a++,u=!1;i.push(void 0),s++,r.call(e,t).then((function(t){u||(u=!0,i[o]={status:"fulfilled",value:t},--s||n(i))}),(function(t){u||(u=!0,i[o]={status:"rejected",reason:t},--s||n(i))}))})),--s||n(i)}));return c.error&&s(c.value),r.promise}})},4349:function(t,e,r){"use strict";var n=r(6887),o=r(2529),i=r(9297),a=r(5981),u=r(626),s=r(487),c=r(6584),f=r(9754);n({target:"Promise",proto:!0,real:!0,forced:!!i&&a((function(){i.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var e=s(this,u("Promise")),r="function"==typeof t;return this.then(r?function(r){return c(e,t()).then((function(){return r}))}:t,r?function(r){return c(e,t()).then((function(){throw r}))}:t)}}),o||"function"!=typeof i||i.prototype.finally||f(i.prototype,"finally",u("Promise").prototype.finally)},8881:function(t,e,r){"use strict";var n,o,i,a,u=r(6887),s=r(2529),c=r(1899),f=r(626),l=r(9297),p=r(9754),d=r(7524),v=r(904),h=r(4431),y=r(941),g=r(3916),b=r(5743),m=r(2532),x=r(1302),w=r(3091),S=r(1385),A=r(487),E=r(2941).set,T=r(6132),I=r(6584),P=r(4845),O=r(9520),_=r(2),C=r(5402),j=r(7252),R=r(9813),L=r(3385),N=R("species"),k="Promise",M=C.get,D=C.set,U=C.getterFor(k),F=l,B=c.TypeError,G=c.document,V=c.process,H=f("fetch"),W=O.f,K=W,q="process"==m(V),z=!!(G&&G.createEvent&&c.dispatchEvent),Y="unhandledrejection",$=j(k,(function(){if(!(x(F)!==String(F))){if(66===L)return!0;if(!q&&"function"!=typeof PromiseRejectionEvent)return!0}if(s&&!F.prototype.finally)return!0;if(L>=51&&/native code/.test(F))return!1;var t=F.resolve(1),e=function(t){t((function(){}),(function(){}))};return(t.constructor={})[N]=e,!(t.then((function(){}))instanceof e)})),X=$||!S((function(t){F.all(t).catch((function(){}))})),J=function(t){var e;return!(!y(t)||"function"!=typeof(e=t.then))&&e},Q=function(t,e,r){if(!e.notified){e.notified=!0;var n=e.reactions;T((function(){for(var o=e.value,i=1==e.state,a=0;n.length>a;){var u,s,c,f=n[a++],l=i?f.ok:f.fail,p=f.resolve,d=f.reject,v=f.domain;try{l?(i||(2===e.rejection&&rt(t,e),e.rejection=1),!0===l?u=o:(v&&v.enter(),u=l(o),v&&(v.exit(),c=!0)),u===f.promise?d(B("Promise-chain cycle")):(s=J(u))?s.call(u,p,d):p(u)):d(o)}catch(t){v&&!c&&v.exit(),d(t)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&tt(t,e)}))}},Z=function(t,e,r){var n,o;z?((n=G.createEvent("Event")).promise=e,n.reason=r,n.initEvent(t,!1,!0),c.dispatchEvent(n)):n={promise:e,reason:r},(o=c["on"+t])?o(n):t===Y&&P("Unhandled promise rejection",r)},tt=function(t,e){E.call(c,(function(){var r,n=e.value;if(et(e)&&(r=_((function(){q?V.emit("unhandledRejection",n,t):Z(Y,t,n)})),e.rejection=q||et(e)?2:1,r.error))throw r.value}))},et=function(t){return 1!==t.rejection&&!t.parent},rt=function(t,e){E.call(c,(function(){q?V.emit("rejectionHandled",t):Z("rejectionhandled",t,e.value)}))},nt=function(t,e,r,n){return function(o){t(e,r,o,n)}},ot=function(t,e,r,n){e.done||(e.done=!0,n&&(e=n),e.value=r,e.state=2,Q(t,e,!0))},it=function(t,e,r,n){if(!e.done){e.done=!0,n&&(e=n);try{if(t===r)throw B("Promise can't be resolved itself");var o=J(r);o?T((function(){var n={done:!1};try{o.call(r,nt(it,t,n,e),nt(ot,t,n,e))}catch(r){ot(t,n,r,e)}})):(e.value=r,e.state=1,Q(t,e,!1))}catch(r){ot(t,{done:!1},r,e)}}};$&&(F=function(t){b(this,F,k),g(t),n.call(this);var e=M(this);try{t(nt(it,this,e),nt(ot,this,e))}catch(t){ot(this,e,t)}},(n=function(t){D(this,{type:k,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=d(F.prototype,{then:function(t,e){var r=U(this),n=W(A(this,F));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=q?V.domain:void 0,r.parent=!0,r.reactions.push(n),0!=r.state&&Q(this,r,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new n,e=M(t);this.promise=t,this.resolve=nt(it,t,e),this.reject=nt(ot,t,e)},O.f=W=function(t){return t===F||t===i?new o(t):K(t)},s||"function"!=typeof l||(a=l.prototype.then,p(l.prototype,"then",(function(t,e){var r=this;return new F((function(t,e){a.call(r,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof H&&u({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return I(F,H.apply(c,arguments))}}))),u({global:!0,wrap:!0,forced:$},{Promise:F}),v(F,k,!1,!0),h(k),i=f(k),u({target:k,stat:!0,forced:$},{reject:function(t){var e=W(this);return e.reject.call(void 0,t),e.promise}}),u({target:k,stat:!0,forced:s||$},{resolve:function(t){return I(s&&this===i?F:this,t)}}),u({target:k,stat:!0,forced:X},{all:function(t){var e=this,r=W(e),n=r.resolve,o=r.reject,i=_((function(){var r=g(e.resolve),i=[],a=0,u=1;w(t,(function(t){var s=a++,c=!1;i.push(void 0),u++,r.call(e,t).then((function(t){c||(c=!0,i[s]=t,--u||n(i))}),o)})),--u||n(i)}));return i.error&&o(i.value),r.promise},race:function(t){var e=this,r=W(e),n=r.reject,o=_((function(){var o=g(e.resolve);w(t,(function(t){o.call(e,t).then(r.resolve,n)}))}));return o.error&&n(o.value),r.promise}})},1035:function(t,e,r){"use strict";var n=r(6887),o=r(344),i=r(8219);n({target:"String",proto:!0,forced:!r(7772)("includes")},{includes:function(t){return!!~String(i(this)).indexOf(o(t),arguments.length>1?arguments[1]:void 0)}})},7971:function(t,e,r){"use strict";var n=r(4620).charAt,o=r(5402),i=r(7771),a="String Iterator",u=o.set,s=o.getterFor(a);i(String,"String",(function(t){u(this,{type:a,string:String(t),index:0})}),(function(){var t,e=s(this),r=e.string,o=e.index;return o>=r.length?{value:void 0,done:!0}:(t=n(r,o),e.index+=t.length,{value:t,done:!1})}))},4761:function(t,e,r){"use strict";var n,o=r(6887),i=r(9677).f,a=r(3057),u=r(344),s=r(8219),c=r(7772),f=r(2529),l="".startsWith,p=Math.min,d=c("startsWith");o({target:"String",proto:!0,forced:!!(f||d||(n=i(String.prototype,"startsWith"),!n||n.writable))&&!d},{startsWith:function(t){var e=String(s(this));u(t);var r=a(p(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return l?l.call(e,n,r):e.slice(r,r+n.length)===n}})},7398:function(t,e,r){"use strict";var n=r(6887),o=r(4853).trim;n({target:"String",proto:!0,forced:r(3093)("trim")},{trim:function(){return o(this)}})},8555:function(t,e,r){r(6349)("asyncIterator")},2615:function(){},1732:function(t,e,r){r(6349)("hasInstance")},5903:function(t,e,r){r(6349)("isConcatSpreadable")},1825:function(t,e,r){r(6349)("iterator")},5824:function(t,e,r){"use strict";var n=r(6887),o=r(1899),i=r(626),a=r(2529),u=r(5746),s=r(2497),c=r(2302),f=r(5981),l=r(7457),p=r(1052),d=r(941),v=r(6059),h=r(9678),y=r(4529),g=r(6935),b=r(1887),m=r(9290),x=r(4771),w=r(946),S=r(684),A=r(7857),E=r(9677),T=r(5988),I=r(6760),P=r(2029),O=r(9754),_=r(8726),C=r(4262),j=r(7748),R=r(9418),L=r(9813),N=r(1477),k=r(6349),M=r(904),D=r(5402),U=r(3610).forEach,F=C("hidden"),B="Symbol",G=L("toPrimitive"),V=D.set,H=D.getterFor(B),W=Object.prototype,K=o.Symbol,q=i("JSON","stringify"),z=E.f,Y=T.f,$=S.f,X=I.f,J=_("symbols"),Q=_("op-symbols"),Z=_("string-to-symbol-registry"),tt=_("symbol-to-string-registry"),et=_("wks"),rt=o.QObject,nt=!rt||!rt.prototype||!rt.prototype.findChild,ot=u&&f((function(){return 7!=m(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a}))?function(t,e,r){var n=z(W,e);n&&delete W[e],Y(t,e,r),n&&t!==W&&Y(W,e,n)}:Y,it=function(t,e){var r=J[t]=m(K.prototype);return V(r,{type:B,tag:t,description:e}),u||(r.description=e),r},at=c?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof K},ut=function(t,e,r){t===W&&ut(Q,e,r),v(t);var n=g(e,!0);return v(r),l(J,n)?(r.enumerable?(l(t,F)&&t[F][n]&&(t[F][n]=!1),r=m(r,{enumerable:b(0,!1)})):(l(t,F)||Y(t,F,b(1,{})),t[F][n]=!0),ot(t,n,r)):Y(t,n,r)},st=function(t,e){v(t);var r=y(e),n=x(r).concat(pt(r));return U(n,(function(e){u&&!ct.call(r,e)||ut(t,e,r[e])})),t},ct=function(t){var e=g(t,!0),r=X.call(this,e);return!(this===W&&l(J,e)&&!l(Q,e))&&(!(r||!l(this,e)||!l(J,e)||l(this,F)&&this[F][e])||r)},ft=function(t,e){var r=y(t),n=g(e,!0);if(r!==W||!l(J,n)||l(Q,n)){var o=z(r,n);return!o||!l(J,n)||l(r,F)&&r[F][n]||(o.enumerable=!0),o}},lt=function(t){var e=$(y(t)),r=[];return U(e,(function(t){l(J,t)||l(j,t)||r.push(t)})),r},pt=function(t){var e=t===W,r=$(e?Q:y(t)),n=[];return U(r,(function(t){!l(J,t)||e&&!l(W,t)||n.push(J[t])})),n};(s||(K=function(){if(this instanceof K)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=R(t),r=function(t){this===W&&r.call(Q,t),l(this,F)&&l(this[F],e)&&(this[F][e]=!1),ot(this,e,b(1,t))};return u&&nt&&ot(W,e,{configurable:!0,set:r}),it(e,t)},O(K.prototype,"toString",(function(){return H(this).tag})),O(K,"withoutSetter",(function(t){return it(R(t),t)})),I.f=ct,T.f=ut,E.f=ft,w.f=S.f=lt,A.f=pt,N.f=function(t){return it(L(t),t)},u&&(Y(K.prototype,"description",{configurable:!0,get:function(){return H(this).description}}),a||O(W,"propertyIsEnumerable",ct,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!s,sham:!s},{Symbol:K}),U(x(et),(function(t){k(t)})),n({target:B,stat:!0,forced:!s},{for:function(t){var e=String(t);if(l(Z,e))return Z[e];var r=K(e);return Z[e]=r,tt[r]=e,r},keyFor:function(t){if(!at(t))throw TypeError(t+" is not a symbol");if(l(tt,t))return tt[t]},useSetter:function(){nt=!0},useSimple:function(){nt=!1}}),n({target:"Object",stat:!0,forced:!s,sham:!u},{create:function(t,e){return void 0===e?m(t):st(m(t),e)},defineProperty:ut,defineProperties:st,getOwnPropertyDescriptor:ft}),n({target:"Object",stat:!0,forced:!s},{getOwnPropertyNames:lt,getOwnPropertySymbols:pt}),n({target:"Object",stat:!0,forced:f((function(){A.f(1)}))},{getOwnPropertySymbols:function(t){return A.f(h(t))}}),q)&&n({target:"JSON",stat:!0,forced:!s||f((function(){var t=K();return"[null]"!=q([t])||"{}"!=q({a:t})||"{}"!=q(Object(t))}))},{stringify:function(t,e,r){for(var n,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(n=e,(d(e)||void 0!==t)&&!at(t))return p(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,q.apply(null,o)}});K.prototype[G]||P(K.prototype,G,K.prototype.valueOf),M(K,B),j[F]=!0},5915:function(t,e,r){r(6349)("matchAll")},8394:function(t,e,r){r(6349)("match")},1766:function(t,e,r){r(6349)("replace")},2737:function(t,e,r){r(6349)("search")},9911:function(t,e,r){r(6349)("species")},4315:function(t,e,r){r(6349)("split")},3131:function(t,e,r){r(6349)("toPrimitive")},4714:function(t,e,r){r(6349)("toStringTag")},659:function(t,e,r){r(6349)("unscopables")},8783:function(t,e,r){r(6349)("asyncDispose")},3975:function(t,e,r){r(6349)("dispose")},6774:function(t,e,r){r(6349)("observable")},620:function(t,e,r){r(6349)("patternMatch")},6172:function(t,e,r){r(6349)("replaceAll")},7634:function(t,e,r){r(6274);var n=r(3281),o=r(1899),i=r(9697),a=r(2029),u=r(2077),s=r(9813)("toStringTag");for(var c in n){var f=o[c],l=f&&f.prototype;l&&i(l)!==s&&a(l,s,c),u[c]=u.Array}},1249:function(t,e,r){var n=r(6887),o=r(1899),i=r(2861),a=[].slice,u=function(t){return function(e,r){var n=arguments.length>2,o=n?a.call(arguments,2):void 0;return t(n?function(){("function"==typeof e?e:Function(e)).apply(this,o)}:e,r)}};n({global:!0,bind:!0,forced:/MSIE .\./.test(i)},{setTimeout:u(o.setTimeout),setInterval:u(o.setInterval)})},3363:function(t,e,r){var n=r(4034);t.exports=n},9216:function(t,e,r){var n=r(9324);t.exports=n},8196:function(t,e,r){var n=r(6246);t.exports=n},8065:function(t,e,r){var n=r(6043);t.exports=n},1955:function(t,e,r){var n=r(2480);t.exports=n},6279:function(t,e,r){r(7634);var n=r(9216),o=r(9697),i=Array.prototype,a={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var e=t.forEach;return t===i||t instanceof Array&&e===i.forEach||a.hasOwnProperty(o(t))?n:e}},3778:function(t,e,r){var n=r(8557);t.exports=n},1798:function(t,e,r){var n=r(8287);t.exports=n},2073:function(t,e,r){var n=r(9601);t.exports=n},2348:function(t,e,r){var n=r(8339);t.exports=n},5178:function(t,e,r){var n=r(1611);t.exports=n},6361:function(t,e,r){var n=r(2774);t.exports=n},8933:function(t,e,r){var n=r(4426);t.exports=n},5868:function(t,e,r){var n=r(1018);t.exports=n},6258:function(t,e,r){var n=r(63);t.exports=n},7410:function(t,e,r){var n=r(5999);t.exports=n},4471:function(t,e,r){var n=r(5254);t.exports=n},1910:function(t,e,r){var n=r(8171);t.exports=n},6209:function(t,e,r){var n=r(3081);t.exports=n},3402:function(t,e,r){var n=r(7699);t.exports=n},9427:function(t,e,r){var n=r(286);t.exports=n},3059:function(t,e,r){var n=r(8494);t.exports=n},6670:function(t,e,r){var n=r(3065);t.exports=n},7795:function(t,e,r){var n=r(8430);t.exports=n},4888:function(t,e,r){var n=r(8524);t.exports=n},7460:function(t,e,r){var n=r(2956);t.exports=n},7989:function(t,e,r){r(1249);var n=r(4058);t.exports=n.setTimeout},2547:function(t,e,r){var n=r(7473);t.exports=n},6509:function(t,e,r){var n=r(4227);t.exports=n},3099:function(t){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},6077:function(t,e,r){var n=r(111);t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},1223:function(t,e,r){var n=r(5112),o=r(30),i=r(3070),a=n("unscopables"),u=Array.prototype;null==u[a]&&i.f(u,a,{configurable:!0,value:o(null)}),t.exports=function(t){u[a][t]=!0}},1530:function(t,e,r){"use strict";var n=r(8710).charAt;t.exports=function(t,e,r){return e+(r?n(t,e).length:1)}},5787:function(t){t.exports=function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return t}},9670:function(t,e,r){var n=r(111);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},4019:function(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},260:function(t,e,r){"use strict";var n,o=r(4019),i=r(9781),a=r(7854),u=r(111),s=r(6656),c=r(648),f=r(8880),l=r(1320),p=r(3070).f,d=r(9518),v=r(7674),h=r(5112),y=r(9711),g=a.Int8Array,b=g&&g.prototype,m=a.Uint8ClampedArray,x=m&&m.prototype,w=g&&d(g),S=b&&d(b),A=Object.prototype,E=A.isPrototypeOf,T=h("toStringTag"),I=y("TYPED_ARRAY_TAG"),P=o&&!!v&&"Opera"!==c(a.opera),O=!1,_={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},C=function(t){return u(t)&&s(_,c(t))};for(n in _)a[n]||(P=!1);if((!P||"function"!=typeof w||w===Function.prototype)&&(w=function(){throw TypeError("Incorrect invocation")},P))for(n in _)a[n]&&v(a[n],w);if((!P||!S||S===A)&&(S=w.prototype,P))for(n in _)a[n]&&v(a[n].prototype,S);if(P&&d(x)!==S&&v(x,S),i&&!s(S,T))for(n in O=!0,p(S,T,{get:function(){return u(this)?this[I]:void 0}}),_)a[n]&&f(a[n],I,n);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:O&&I,aTypedArray:function(t){if(C(t))return t;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(t){if(v){if(E.call(w,t))return t}else for(var e in _)if(s(_,n)){var r=a[e];if(r&&(t===r||E.call(r,t)))return t}throw TypeError("Target is not a typed array constructor")},exportTypedArrayMethod:function(t,e,r){if(i){if(r)for(var n in _){var o=a[n];o&&s(o.prototype,t)&&delete o.prototype[t]}S[t]&&!r||l(S,t,r?e:P&&b[t]||e)}},exportTypedArrayStaticMethod:function(t,e,r){var n,o;if(i){if(v){if(r)for(n in _)(o=a[n])&&s(o,t)&&delete o[t];if(w[t]&&!r)return;try{return l(w,t,r?e:P&&g[t]||e)}catch(t){}}for(n in _)!(o=a[n])||o[t]&&!r||l(o,t,e)}},isView:function(t){var e=c(t);return"DataView"===e||s(_,e)},isTypedArray:C,TypedArray:w,TypedArrayPrototype:S}},3331:function(t,e,r){"use strict";var n=r(7854),o=r(9781),i=r(4019),a=r(8880),u=r(2248),s=r(7293),c=r(5787),f=r(9958),l=r(7466),p=r(7067),d=r(1179),v=r(9518),h=r(7674),y=r(8006).f,g=r(3070).f,b=r(1285),m=r(8003),x=r(9909),w=x.get,S=x.set,A="ArrayBuffer",E="DataView",T="Wrong index",I=n.ArrayBuffer,P=I,O=n.DataView,_=O&&O.prototype,C=Object.prototype,j=n.RangeError,R=d.pack,L=d.unpack,N=function(t){return[255&t]},k=function(t){return[255&t,t>>8&255]},M=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},D=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},U=function(t){return R(t,23,4)},F=function(t){return R(t,52,8)},B=function(t,e){g(t.prototype,e,{get:function(){return w(this)[e]}})},G=function(t,e,r,n){var o=p(r),i=w(t);if(o+e>i.byteLength)throw j(T);var a=w(i.buffer).bytes,u=o+i.byteOffset,s=a.slice(u,u+e);return n?s:s.reverse()},V=function(t,e,r,n,o,i){var a=p(r),u=w(t);if(a+e>u.byteLength)throw j(T);for(var s=w(u.buffer).bytes,c=a+u.byteOffset,f=n(+o),l=0;l<e;l++)s[c+l]=f[i?l:e-l-1]};if(i){if(!s((function(){I(1)}))||!s((function(){new I(-1)}))||s((function(){return new I,new I(1.5),new I(NaN),I.name!=A}))){for(var H,W=(P=function(t){return c(this,P),new I(p(t))}).prototype=I.prototype,K=y(I),q=0;K.length>q;)(H=K[q++])in P||a(P,H,I[H]);W.constructor=P}h&&v(_)!==C&&h(_,C);var z=new O(new P(2)),Y=_.setInt8;z.setInt8(0,2147483648),z.setInt8(1,2147483649),!z.getInt8(0)&&z.getInt8(1)||u(_,{setInt8:function(t,e){Y.call(this,t,e<<24>>24)},setUint8:function(t,e){Y.call(this,t,e<<24>>24)}},{unsafe:!0})}else P=function(t){c(this,P,A);var e=p(t);S(this,{bytes:b.call(new Array(e),0),byteLength:e}),o||(this.byteLength=e)},O=function(t,e,r){c(this,O,E),c(t,P,E);var n=w(t).byteLength,i=f(e);if(i<0||i>n)throw j("Wrong offset");if(i+(r=void 0===r?n-i:l(r))>n)throw j("Wrong length");S(this,{buffer:t,byteLength:r,byteOffset:i}),o||(this.buffer=t,this.byteLength=r,this.byteOffset=i)},o&&(B(P,"byteLength"),B(O,"buffer"),B(O,"byteLength"),B(O,"byteOffset")),u(O.prototype,{getInt8:function(t){return G(this,1,t)[0]<<24>>24},getUint8:function(t){return G(this,1,t)[0]},getInt16:function(t){var e=G(this,2,t,arguments.length>1?arguments[1]:void 0);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=G(this,2,t,arguments.length>1?arguments[1]:void 0);return e[1]<<8|e[0]},getInt32:function(t){return D(G(this,4,t,arguments.length>1?arguments[1]:void 0))},getUint32:function(t){return D(G(this,4,t,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(t){return L(G(this,4,t,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(t){return L(G(this,8,t,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(t,e){V(this,1,t,N,e)},setUint8:function(t,e){V(this,1,t,N,e)},setInt16:function(t,e){V(this,2,t,k,e,arguments.length>2?arguments[2]:void 0)},setUint16:function(t,e){V(this,2,t,k,e,arguments.length>2?arguments[2]:void 0)},setInt32:function(t,e){V(this,4,t,M,e,arguments.length>2?arguments[2]:void 0)},setUint32:function(t,e){V(this,4,t,M,e,arguments.length>2?arguments[2]:void 0)},setFloat32:function(t,e){V(this,4,t,U,e,arguments.length>2?arguments[2]:void 0)},setFloat64:function(t,e){V(this,8,t,F,e,arguments.length>2?arguments[2]:void 0)}});m(P,A),m(O,E),t.exports={ArrayBuffer:P,DataView:O}},1048:function(t,e,r){"use strict";var n=r(7908),o=r(1400),i=r(7466),a=Math.min;t.exports=[].copyWithin||function(t,e){var r=n(this),u=i(r.length),s=o(t,u),c=o(e,u),f=arguments.length>2?arguments[2]:void 0,l=a((void 0===f?u:o(f,u))-c,u-s),p=1;for(c<s&&s<c+l&&(p=-1,c+=l-1,s+=l-1);l-- >0;)c in r?r[s]=r[c]:delete r[s],s+=p,c+=p;return r}},1285:function(t,e,r){"use strict";var n=r(7908),o=r(1400),i=r(7466);t.exports=function(t){for(var e=n(this),r=i(e.length),a=arguments.length,u=o(a>1?arguments[1]:void 0,r),s=a>2?arguments[2]:void 0,c=void 0===s?r:o(s,r);c>u;)e[u++]=t;return e}},1318:function(t,e,r){var n=r(5656),o=r(7466),i=r(1400),a=function(t){return function(e,r,a){var u,s=n(e),c=o(s.length),f=i(a,c);if(t&&r!=r){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((t||f in s)&&s[f]===r)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},2092:function(t,e,r){var n=r(9974),o=r(8361),i=r(7908),a=r(7466),u=r(5417),s=[].push,c=function(t){var e=1==t,r=2==t,c=3==t,f=4==t,l=6==t,p=5==t||l;return function(d,v,h,y){for(var g,b,m=i(d),x=o(m),w=n(v,h,3),S=a(x.length),A=0,E=y||u,T=e?E(d,S):r?E(d,0):void 0;S>A;A++)if((p||A in x)&&(b=w(g=x[A],A,m),t))if(e)T[A]=b;else if(b)switch(t){case 3:return!0;case 5:return g;case 6:return A;case 2:s.call(T,g)}else if(f)return!1;return l?-1:c||f?f:T}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},6583:function(t,e,r){"use strict";var n=r(5656),o=r(9958),i=r(7466),a=r(9341),u=r(9207),s=Math.min,c=[].lastIndexOf,f=!!c&&1/[1].lastIndexOf(1,-0)<0,l=a("lastIndexOf"),p=u("indexOf",{ACCESSORS:!0,1:0}),d=f||!l||!p;t.exports=d?function(t){if(f)return c.apply(this,arguments)||0;var e=n(this),r=i(e.length),a=r-1;for(arguments.length>1&&(a=s(a,o(arguments[1]))),a<0&&(a=r+a);a>=0;a--)if(a in e&&e[a]===t)return a||0;return-1}:c},9341:function(t,e,r){"use strict";var n=r(7293);t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},9207:function(t,e,r){var n=r(9781),o=r(7293),i=r(6656),a=Object.defineProperty,u={},s=function(t){throw t};t.exports=function(t,e){if(i(u,t))return u[t];e||(e={});var r=[][t],c=!!i(e,"ACCESSORS")&&e.ACCESSORS,f=i(e,0)?e[0]:s,l=i(e,1)?e[1]:void 0;return u[t]=!!r&&!o((function(){if(c&&!n)return!0;var t={length:-1};c?a(t,1,{enumerable:!0,get:s}):t[1]=1,r.call(t,f,l)}))}},3671:function(t,e,r){var n=r(3099),o=r(7908),i=r(8361),a=r(7466),u=function(t){return function(e,r,u,s){n(r);var c=o(e),f=i(c),l=a(c.length),p=t?l-1:0,d=t?-1:1;if(u<2)for(;;){if(p in f){s=f[p],p+=d;break}if(p+=d,t?p<0:l<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:l>p;p+=d)p in f&&(s=r(s,f[p],p,c));return s}};t.exports={left:u(!1),right:u(!0)}},5417:function(t,e,r){var n=r(111),o=r(3157),i=r(5112)("species");t.exports=function(t,e){var r;return o(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!o(r.prototype)?n(r)&&null===(r=r[i])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)}},3411:function(t,e,r){var n=r(9670);t.exports=function(t,e,r,o){try{return o?e(n(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&n(i.call(t)),e}}},7072:function(t,e,r){var n=r(5112)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var r=!1;try{var i={};i[n]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(t){}return r}},4326:function(t){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},648:function(t,e,r){var n=r(1694),o=r(4326),i=r(5112)("toStringTag"),a="Arguments"==o(function(){return arguments}());t.exports=n?o:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?r:a?o(e):"Object"==(n=o(e))&&"function"==typeof e.callee?"Arguments":n}},9920:function(t,e,r){var n=r(6656),o=r(3887),i=r(1236),a=r(3070);t.exports=function(t,e){for(var r=o(e),u=a.f,s=i.f,c=0;c<r.length;c++){var f=r[c];n(t,f)||u(t,f,s(e,f))}}},8544:function(t,e,r){var n=r(7293);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},4994:function(t,e,r){"use strict";var n=r(3383).IteratorPrototype,o=r(30),i=r(9114),a=r(8003),u=r(7497),s=function(){return this};t.exports=function(t,e,r){var c=e+" Iterator";return t.prototype=o(n,{next:i(1,r)}),a(t,c,!1,!0),u[c]=s,t}},8880:function(t,e,r){var n=r(9781),o=r(3070),i=r(9114);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},9114:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},654:function(t,e,r){"use strict";var n=r(2109),o=r(4994),i=r(9518),a=r(7674),u=r(8003),s=r(8880),c=r(1320),f=r(5112),l=r(1913),p=r(7497),d=r(3383),v=d.IteratorPrototype,h=d.BUGGY_SAFARI_ITERATORS,y=f("iterator"),g="keys",b="values",m="entries",x=function(){return this};t.exports=function(t,e,r,f,d,w,S){o(r,e,f);var A,E,T,I=function(t){if(t===d&&j)return j;if(!h&&t in _)return _[t];switch(t){case g:case b:case m:return function(){return new r(this,t)}}return function(){return new r(this)}},P=e+" Iterator",O=!1,_=t.prototype,C=_[y]||_["@@iterator"]||d&&_[d],j=!h&&C||I(d),R="Array"==e&&_.entries||C;if(R&&(A=i(R.call(new t)),v!==Object.prototype&&A.next&&(l||i(A)===v||(a?a(A,v):"function"!=typeof A[y]&&s(A,y,x)),u(A,P,!0,!0),l&&(p[P]=x))),d==b&&C&&C.name!==b&&(O=!0,j=function(){return C.call(this)}),l&&!S||_[y]===j||s(_,y,j),p[e]=j,d)if(E={values:I(b),keys:w?j:I(g),entries:I(m)},S)for(T in E)(h||O||!(T in _))&&c(_,T,E[T]);else n({target:e,proto:!0,forced:h||O},E);return E}},9781:function(t,e,r){var n=r(7293);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(t,e,r){var n=r(7854),o=r(111),i=n.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},6833:function(t,e,r){var n=r(8113);t.exports=/(iphone|ipod|ipad).*applewebkit/i.test(n)},8113:function(t,e,r){var n=r(5005);t.exports=n("navigator","userAgent")||""},7392:function(t,e,r){var n,o,i=r(7854),a=r(8113),u=i.process,s=u&&u.versions,c=s&&s.v8;c?o=(n=c.split("."))[0]+n[1]:a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=n[1]),t.exports=o&&+o},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,r){var n=r(7854),o=r(1236).f,i=r(8880),a=r(1320),u=r(3505),s=r(9920),c=r(4705);t.exports=function(t,e){var r,f,l,p,d,v=t.target,h=t.global,y=t.stat;if(r=h?n:y?n[v]||u(v,{}):(n[v]||{}).prototype)for(f in e){if(p=e[f],l=t.noTargetGet?(d=o(r,f))&&d.value:r[f],!c(h?f:v+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;s(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),a(r,f,p,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},7007:function(t,e,r){"use strict";r(4916);var n=r(1320),o=r(7293),i=r(5112),a=r(2261),u=r(8880),s=i("species"),c=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),f="$0"==="a".replace(/./,"$0"),l=i("replace"),p=!!/./[l]&&""===/./[l]("a","$0"),d=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));t.exports=function(t,e,r,l){var v=i(t),h=!o((function(){var e={};return e[v]=function(){return 7},7!=""[t](e)})),y=h&&!o((function(){var e=!1,r=/a/;return"split"===t&&((r={}).constructor={},r.constructor[s]=function(){return r},r.flags="",r[v]=/./[v]),r.exec=function(){return e=!0,null},r[v](""),!e}));if(!h||!y||"replace"===t&&(!c||!f||p)||"split"===t&&!d){var g=/./[v],b=r(v,""[t],(function(t,e,r,n,o){return e.exec===a?h&&!o?{done:!0,value:g.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}),{REPLACE_KEEPS_$0:f,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),m=b[0],x=b[1];n(String.prototype,t,m),n(RegExp.prototype,v,2==e?function(t,e){return x.call(t,this,e)}:function(t){return x.call(t,this)})}l&&u(RegExp.prototype[v],"sham",!0)}},9974:function(t,e,r){var n=r(3099);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},5005:function(t,e,r){var n=r(857),o=r(7854),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t])||i(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},1246:function(t,e,r){var n=r(648),o=r(7497),i=r(5112)("iterator");t.exports=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[n(t)]}},7854:function(t,e,r){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||Function("return this")()},6656:function(t){var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},3501:function(t){t.exports={}},842:function(t,e,r){var n=r(7854);t.exports=function(t,e){var r=n.console;r&&r.error&&(1===arguments.length?r.error(t):r.error(t,e))}},490:function(t,e,r){var n=r(5005);t.exports=n("document","documentElement")},4664:function(t,e,r){var n=r(9781),o=r(7293),i=r(317);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},1179:function(t){var e=1/0,r=Math.abs,n=Math.pow,o=Math.floor,i=Math.log,a=Math.LN2;t.exports={pack:function(t,u,s){var c,f,l,p=new Array(s),d=8*s-u-1,v=(1<<d)-1,h=v>>1,y=23===u?n(2,-24)-n(2,-77):0,g=t<0||0===t&&1/t<0?1:0,b=0;for((t=r(t))!=t||t===e?(f=t!=t?1:0,c=v):(c=o(i(t)/a),t*(l=n(2,-c))<1&&(c--,l*=2),(t+=c+h>=1?y/l:y*n(2,1-h))*l>=2&&(c++,l/=2),c+h>=v?(f=0,c=v):c+h>=1?(f=(t*l-1)*n(2,u),c+=h):(f=t*n(2,h-1)*n(2,u),c=0));u>=8;p[b++]=255&f,f/=256,u-=8);for(c=c<<u|f,d+=u;d>0;p[b++]=255&c,c/=256,d-=8);return p[--b]|=128*g,p},unpack:function(t,r){var o,i=t.length,a=8*i-r-1,u=(1<<a)-1,s=u>>1,c=a-7,f=i-1,l=t[f--],p=127&l;for(l>>=7;c>0;p=256*p+t[f],f--,c-=8);for(o=p&(1<<-c)-1,p>>=-c,c+=r;c>0;o=256*o+t[f],f--,c-=8);if(0===p)p=1-s;else{if(p===u)return o?NaN:l?-1/0:e;o+=n(2,r),p-=s}return(l?-1:1)*o*n(2,p-r)}}},8361:function(t,e,r){var n=r(7293),o=r(4326),i="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},9587:function(t,e,r){var n=r(111),o=r(7674);t.exports=function(t,e,r){var i,a;return o&&"function"==typeof(i=e.constructor)&&i!==r&&n(a=i.prototype)&&a!==r.prototype&&o(t,a),t}},2788:function(t,e,r){var n=r(5465),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource},9909:function(t,e,r){var n,o,i,a=r(8536),u=r(7854),s=r(111),c=r(8880),f=r(6656),l=r(6200),p=r(3501),d=u.WeakMap;if(a){var v=new d,h=v.get,y=v.has,g=v.set;n=function(t,e){return g.call(v,t,e),e},o=function(t){return h.call(v,t)||{}},i=function(t){return y.call(v,t)}}else{var b=l("state");p[b]=!0,n=function(t,e){return c(t,b,e),e},o=function(t){return f(t,b)?t[b]:{}},i=function(t){return f(t,b)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!s(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},7659:function(t,e,r){var n=r(5112),o=r(7497),i=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||a[i]===t)}},3157:function(t,e,r){var n=r(4326);t.exports=Array.isArray||function(t){return"Array"==n(t)}},4705:function(t,e,r){var n=r(7293),o=/#|\.prototype\./,i=function(t,e){var r=u[a(t)];return r==c||r!=s&&("function"==typeof e?n(e):!!e)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=i.data={},s=i.NATIVE="N",c=i.POLYFILL="P";t.exports=i},111:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},1913:function(t){t.exports=!1},408:function(t,e,r){var n=r(9670),o=r(7659),i=r(7466),a=r(9974),u=r(1246),s=r(3411),c=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,r,f,l){var p,d,v,h,y,g,b,m=a(e,r,f?2:1);if(l)p=t;else{if("function"!=typeof(d=u(t)))throw TypeError("Target is not iterable");if(o(d)){for(v=0,h=i(t.length);h>v;v++)if((y=f?m(n(b=t[v])[0],b[1]):m(t[v]))&&y instanceof c)return y;return new c(!1)}p=d.call(t)}for(g=p.next;!(b=g.call(p)).done;)if("object"==typeof(y=s(p,m,b.value,f))&&y&&y instanceof c)return y;return new c(!1)}).stop=function(t){return new c(!0,t)}},3383:function(t,e,r){"use strict";var n,o,i,a=r(9518),u=r(8880),s=r(6656),c=r(5112),f=r(1913),l=c("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(n=o):p=!0),null==n&&(n={}),f||s(n,l)||u(n,l,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:p}},7497:function(t){t.exports={}},5948:function(t,e,r){var n,o,i,a,u,s,c,f,l=r(7854),p=r(1236).f,d=r(4326),v=r(261).set,h=r(6833),y=l.MutationObserver||l.WebKitMutationObserver,g=l.process,b=l.Promise,m="process"==d(g),x=p(l,"queueMicrotask"),w=x&&x.value;w||(n=function(){var t,e;for(m&&(t=g.domain)&&t.exit();o;){e=o.fn,o=o.next;try{e()}catch(t){throw o?a():i=void 0,t}}i=void 0,t&&t.enter()},m?a=function(){g.nextTick(n)}:y&&!h?(u=!0,s=document.createTextNode(""),new y(n).observe(s,{characterData:!0}),a=function(){s.data=u=!u}):b&&b.resolve?(c=b.resolve(void 0),f=c.then,a=function(){f.call(c,n)}):a=function(){v.call(l,n)}),t.exports=w||function(t){var e={fn:t,next:void 0};i&&(i.next=e),o||(o=e,a()),i=e}},3366:function(t,e,r){var n=r(7854);t.exports=n.Promise},133:function(t,e,r){var n=r(7293);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},8536:function(t,e,r){var n=r(7854),o=r(2788),i=n.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},8523:function(t,e,r){"use strict";var n=r(3099),o=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)};t.exports.f=function(t){return new o(t)}},30:function(t,e,r){var n,o=r(9670),i=r(6048),a=r(748),u=r(3501),s=r(490),c=r(317),f=r(6200),l=f("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"</"+"script>"},v=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;v=n?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(n):((e=c("iframe")).style.display="none",s.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var r=a.length;r--;)delete v.prototype[a[r]];return v()};u[l]=!0,t.exports=Object.create||function(t,e){var r;return null!==t?(p.prototype=o(t),r=new p,p.prototype=null,r[l]=t):r=v(),void 0===e?r:i(r,e)}},6048:function(t,e,r){var n=r(9781),o=r(3070),i=r(9670),a=r(1956);t.exports=n?Object.defineProperties:function(t,e){i(t);for(var r,n=a(e),u=n.length,s=0;u>s;)o.f(t,r=n[s++],e[r]);return t}},3070:function(t,e,r){var n=r(9781),o=r(4664),i=r(9670),a=r(7593),u=Object.defineProperty;e.f=n?u:function(t,e,r){if(i(t),e=a(e,!0),i(r),o)try{return u(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},1236:function(t,e,r){var n=r(9781),o=r(5296),i=r(9114),a=r(5656),u=r(7593),s=r(6656),c=r(4664),f=Object.getOwnPropertyDescriptor;e.f=n?f:function(t,e){if(t=a(t),e=u(e,!0),c)try{return f(t,e)}catch(t){}if(s(t,e))return i(!o.f.call(t,e),t[e])}},8006:function(t,e,r){var n=r(6324),o=r(748).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},9518:function(t,e,r){var n=r(6656),o=r(7908),i=r(6200),a=r(8544),u=i("IE_PROTO"),s=Object.prototype;t.exports=a?Object.getPrototypeOf:function(t){return t=o(t),n(t,u)?t[u]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},6324:function(t,e,r){var n=r(6656),o=r(5656),i=r(1318).indexOf,a=r(3501);t.exports=function(t,e){var r,u=o(t),s=0,c=[];for(r in u)!n(a,r)&&n(u,r)&&c.push(r);for(;e.length>s;)n(u,r=e[s++])&&(~i(c,r)||c.push(r));return c}},1956:function(t,e,r){var n=r(6324),o=r(748);t.exports=Object.keys||function(t){return n(t,o)}},5296:function(t,e){"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},7674:function(t,e,r){var n=r(9670),o=r(6077);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),e=r instanceof Array}catch(t){}return function(r,i){return n(r),o(i),e?t.call(r,i):r.__proto__=i,r}}():void 0)},288:function(t,e,r){"use strict";var n=r(1694),o=r(648);t.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},3887:function(t,e,r){var n=r(5005),o=r(8006),i=r(5181),a=r(9670);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(a(t)),r=i.f;return r?e.concat(r(t)):e}},857:function(t,e,r){var n=r(7854);t.exports=n},2534:function(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},9478:function(t,e,r){var n=r(9670),o=r(111),i=r(8523);t.exports=function(t,e){if(n(t),o(e)&&e.constructor===t)return e;var r=i.f(t);return(0,r.resolve)(e),r.promise}},2248:function(t,e,r){var n=r(1320);t.exports=function(t,e,r){for(var o in e)n(t,o,e[o],r);return t}},1320:function(t,e,r){var n=r(7854),o=r(8880),i=r(6656),a=r(3505),u=r(2788),s=r(9909),c=s.get,f=s.enforce,l=String(String).split("String");(t.exports=function(t,e,r,u){var s=!!u&&!!u.unsafe,c=!!u&&!!u.enumerable,p=!!u&&!!u.noTargetGet;"function"==typeof r&&("string"!=typeof e||i(r,"name")||o(r,"name",e),f(r).source=l.join("string"==typeof e?e:"")),t!==n?(s?!p&&t[e]&&(c=!0):delete t[e],c?t[e]=r:o(t,e,r)):c?t[e]=r:a(e,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||u(this)}))},7651:function(t,e,r){var n=r(4326),o=r(2261);t.exports=function(t,e){var r=t.exec;if("function"==typeof r){var i=r.call(t,e);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==n(t))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},2261:function(t,e,r){"use strict";var n,o,i=r(7066),a=r(2999),u=RegExp.prototype.exec,s=String.prototype.replace,c=u,f=(n=/a/,o=/b*/g,u.call(n,"a"),u.call(o,"a"),0!==n.lastIndex||0!==o.lastIndex),l=a.UNSUPPORTED_Y||a.BROKEN_CARET,p=void 0!==/()??/.exec("")[1];(f||p||l)&&(c=function(t){var e,r,n,o,a=this,c=l&&a.sticky,d=i.call(a),v=a.source,h=0,y=t;return c&&(-1===(d=d.replace("y","")).indexOf("g")&&(d+="g"),y=String(t).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==t[a.lastIndex-1])&&(v="(?: "+v+")",y=" "+y,h++),r=new RegExp("^(?:"+v+")",d)),p&&(r=new RegExp("^"+v+"$(?!\\s)",d)),f&&(e=a.lastIndex),n=u.call(c?r:a,y),c?n?(n.input=n.input.slice(h),n[0]=n[0].slice(h),n.index=a.lastIndex,a.lastIndex+=n[0].length):a.lastIndex=0:f&&n&&(a.lastIndex=a.global?n.index+n[0].length:e),p&&n&&n.length>1&&s.call(n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n}),t.exports=c},7066:function(t,e,r){"use strict";var n=r(9670);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},2999:function(t,e,r){"use strict";var n=r(7293);function o(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=n((function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),e.BROKEN_CARET=n((function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},4488:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},3505:function(t,e,r){var n=r(7854),o=r(8880);t.exports=function(t,e){try{o(n,t,e)}catch(r){n[t]=e}return e}},6340:function(t,e,r){"use strict";var n=r(5005),o=r(3070),i=r(5112),a=r(9781),u=i("species");t.exports=function(t){var e=n(t),r=o.f;a&&e&&!e[u]&&r(e,u,{configurable:!0,get:function(){return this}})}},8003:function(t,e,r){var n=r(3070).f,o=r(6656),i=r(5112)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},6200:function(t,e,r){var n=r(2309),o=r(9711),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,e,r){var n=r(7854),o=r(3505),i="__core-js_shared__",a=n[i]||o(i,{});t.exports=a},2309:function(t,e,r){var n=r(1913),o=r(5465);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},6707:function(t,e,r){var n=r(9670),o=r(3099),i=r(5112)("species");t.exports=function(t,e){var r,a=n(t).constructor;return void 0===a||null==(r=n(a)[i])?e:o(r)}},8710:function(t,e,r){var n=r(9958),o=r(4488),i=function(t){return function(e,r){var i,a,u=String(o(e)),s=n(r),c=u.length;return s<0||s>=c?t?"":void 0:(i=u.charCodeAt(s))<55296||i>56319||s+1===c||(a=u.charCodeAt(s+1))<56320||a>57343?t?u.charAt(s):i:t?u.slice(s,s+2):a-56320+(i-55296<<10)+65536}};t.exports={codeAt:i(!1),charAt:i(!0)}},3111:function(t,e,r){var n=r(4488),o="["+r(1361)+"]",i=RegExp("^"+o+o+"*"),a=RegExp(o+o+"*$"),u=function(t){return function(e){var r=String(n(e));return 1&t&&(r=r.replace(i,"")),2&t&&(r=r.replace(a,"")),r}};t.exports={start:u(1),end:u(2),trim:u(3)}},261:function(t,e,r){var n,o,i,a=r(7854),u=r(7293),s=r(4326),c=r(9974),f=r(490),l=r(317),p=r(6833),d=a.location,v=a.setImmediate,h=a.clearImmediate,y=a.process,g=a.MessageChannel,b=a.Dispatch,m=0,x={},w="onreadystatechange",S=function(t){if(x.hasOwnProperty(t)){var e=x[t];delete x[t],e()}},A=function(t){return function(){S(t)}},E=function(t){S(t.data)},T=function(t){a.postMessage(t+"",d.protocol+"//"+d.host)};v&&h||(v=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return x[++m]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},n(m),m},h=function(t){delete x[t]},"process"==s(y)?n=function(t){y.nextTick(A(t))}:b&&b.now?n=function(t){b.now(A(t))}:g&&!p?(i=(o=new g).port2,o.port1.onmessage=E,n=c(i.postMessage,i,1)):!a.addEventListener||"function"!=typeof postMessage||a.importScripts||u(T)||"file:"===d.protocol?n=w in l("script")?function(t){f.appendChild(l("script")).onreadystatechange=function(){f.removeChild(this),S(t)}}:function(t){setTimeout(A(t),0)}:(n=T,a.addEventListener("message",E,!1))),t.exports={set:v,clear:h}},1400:function(t,e,r){var n=r(9958),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},7067:function(t,e,r){var n=r(9958),o=r(7466);t.exports=function(t){if(void 0===t)return 0;var e=n(t),r=o(e);if(e!==r)throw RangeError("Wrong length or index");return r}},5656:function(t,e,r){var n=r(8361),o=r(4488);t.exports=function(t){return n(o(t))}},9958:function(t){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},7466:function(t,e,r){var n=r(9958),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},7908:function(t,e,r){var n=r(4488);t.exports=function(t){return Object(n(t))}},4590:function(t,e,r){var n=r(3002);t.exports=function(t,e){var r=n(t);if(r%e)throw RangeError("Wrong offset");return r}},3002:function(t,e,r){var n=r(9958);t.exports=function(t){var e=n(t);if(e<0)throw RangeError("The argument can't be less than 0");return e}},7593:function(t,e,r){var n=r(111);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},1694:function(t,e,r){var n={};n[r(5112)("toStringTag")]="z",t.exports="[object z]"===String(n)},9843:function(t,e,r){"use strict";var n=r(2109),o=r(7854),i=r(9781),a=r(3832),u=r(260),s=r(3331),c=r(5787),f=r(9114),l=r(8880),p=r(7466),d=r(7067),v=r(4590),h=r(7593),y=r(6656),g=r(648),b=r(111),m=r(30),x=r(7674),w=r(8006).f,S=r(7321),A=r(2092).forEach,E=r(6340),T=r(3070),I=r(1236),P=r(9909),O=r(9587),_=P.get,C=P.set,j=T.f,R=I.f,L=Math.round,N=o.RangeError,k=s.ArrayBuffer,M=s.DataView,D=u.NATIVE_ARRAY_BUFFER_VIEWS,U=u.TYPED_ARRAY_TAG,F=u.TypedArray,B=u.TypedArrayPrototype,G=u.aTypedArrayConstructor,V=u.isTypedArray,H="BYTES_PER_ELEMENT",W="Wrong length",K=function(t,e){for(var r=0,n=e.length,o=new(G(t))(n);n>r;)o[r]=e[r++];return o},q=function(t,e){j(t,e,{get:function(){return _(this)[e]}})},z=function(t){var e;return t instanceof k||"ArrayBuffer"==(e=g(t))||"SharedArrayBuffer"==e},Y=function(t,e){return V(t)&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},$=function(t,e){return Y(t,e=h(e,!0))?f(2,t[e]):R(t,e)},X=function(t,e,r){return!(Y(t,e=h(e,!0))&&b(r)&&y(r,"value"))||y(r,"get")||y(r,"set")||r.configurable||y(r,"writable")&&!r.writable||y(r,"enumerable")&&!r.enumerable?j(t,e,r):(t[e]=r.value,t)};i?(D||(I.f=$,T.f=X,q(B,"buffer"),q(B,"byteOffset"),q(B,"byteLength"),q(B,"length")),n({target:"Object",stat:!0,forced:!D},{getOwnPropertyDescriptor:$,defineProperty:X}),t.exports=function(t,e,r){var i=t.match(/\d+$/)[0]/8,u=t+(r?"Clamped":"")+"Array",s="get"+t,f="set"+t,h=o[u],y=h,g=y&&y.prototype,T={},I=function(t,e){j(t,e,{get:function(){return function(t,e){var r=_(t);return r.view[s](e*i+r.byteOffset,!0)}(this,e)},set:function(t){return function(t,e,n){var o=_(t);r&&(n=(n=L(n))<0?0:n>255?255:255&n),o.view[f](e*i+o.byteOffset,n,!0)}(this,e,t)},enumerable:!0})};D?a&&(y=e((function(t,e,r,n){return c(t,y,u),O(b(e)?z(e)?void 0!==n?new h(e,v(r,i),n):void 0!==r?new h(e,v(r,i)):new h(e):V(e)?K(y,e):S.call(y,e):new h(d(e)),t,y)})),x&&x(y,F),A(w(h),(function(t){t in y||l(y,t,h[t])})),y.prototype=g):(y=e((function(t,e,r,n){c(t,y,u);var o,a,s,f=0,l=0;if(b(e)){if(!z(e))return V(e)?K(y,e):S.call(y,e);o=e,l=v(r,i);var h=e.byteLength;if(void 0===n){if(h%i)throw N(W);if((a=h-l)<0)throw N(W)}else if((a=p(n)*i)+l>h)throw N(W);s=a/i}else s=d(e),o=new k(a=s*i);for(C(t,{buffer:o,byteOffset:l,byteLength:a,length:s,view:new M(o)});f<s;)I(t,f++)})),x&&x(y,F),g=y.prototype=m(B)),g.constructor!==y&&l(g,"constructor",y),U&&l(g,U,u),T[u]=y,n({global:!0,forced:y!=h,sham:!D},T),H in y||l(y,H,i),H in g||l(g,H,i),E(u)}):t.exports=function(){}},3832:function(t,e,r){var n=r(7854),o=r(7293),i=r(7072),a=r(260).NATIVE_ARRAY_BUFFER_VIEWS,u=n.ArrayBuffer,s=n.Int8Array;t.exports=!a||!o((function(){s(1)}))||!o((function(){new s(-1)}))||!i((function(t){new s,new s(null),new s(1.5),new s(t)}),!0)||o((function(){return 1!==new s(new u(2),1,void 0).length}))},7321:function(t,e,r){var n=r(7908),o=r(7466),i=r(1246),a=r(7659),u=r(9974),s=r(260).aTypedArrayConstructor;t.exports=function(t){var e,r,c,f,l,p,d=n(t),v=arguments.length,h=v>1?arguments[1]:void 0,y=void 0!==h,g=i(d);if(null!=g&&!a(g))for(p=(l=g.call(d)).next,d=[];!(f=p.call(l)).done;)d.push(f.value);for(y&&v>2&&(h=u(h,arguments[2],2)),r=o(d.length),c=new(s(this))(r),e=0;r>e;e++)c[e]=y?h(d[e],e):d[e];return c}},9711:function(t){var e=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+r).toString(36)}},3307:function(t,e,r){var n=r(133);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},5112:function(t,e,r){var n=r(7854),o=r(2309),i=r(6656),a=r(9711),u=r(133),s=r(3307),c=o("wks"),f=n.Symbol,l=s?f:f&&f.withoutSetter||a;t.exports=function(t){return i(c,t)||(u&&i(f,t)?c[t]=f[t]:c[t]=l("Symbol."+t)),c[t]}},1361:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},9575:function(t,e,r){"use strict";var n=r(2109),o=r(7293),i=r(3331),a=r(9670),u=r(1400),s=r(7466),c=r(6707),f=i.ArrayBuffer,l=i.DataView,p=f.prototype.slice;n({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:o((function(){return!new f(2).slice(1,void 0).byteLength}))},{slice:function(t,e){if(void 0!==p&&void 0===e)return p.call(a(this),t);for(var r=a(this).byteLength,n=u(t,r),o=u(void 0===e?r:e,r),i=new(c(this,f))(s(o-n)),d=new l(this),v=new l(i),h=0;n<o;)v.setUint8(h++,d.getUint8(n++));return i}})},6992:function(t,e,r){"use strict";var n=r(5656),o=r(1223),i=r(7497),a=r(9909),u=r(654),s="Array Iterator",c=a.set,f=a.getterFor(s);t.exports=u(Array,"Array",(function(t,e){c(this,{type:s,target:n(t),index:0,kind:e})}),(function(){var t=f(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},9600:function(t,e,r){"use strict";var n=r(2109),o=r(8361),i=r(5656),a=r(9341),u=[].join,s=o!=Object,c=a("join",",");n({target:"Array",proto:!0,forced:s||!c},{join:function(t){return u.call(i(this),void 0===t?",":t)}})},8309:function(t,e,r){var n=r(9781),o=r(3070).f,i=Function.prototype,a=i.toString,u=/^\s*function ([^ (]*)/,s="name";n&&!(s in i)&&o(i,s,{configurable:!0,get:function(){try{return a.call(this).match(u)[1]}catch(t){return""}}})},9653:function(t,e,r){"use strict";var n=r(9781),o=r(7854),i=r(4705),a=r(1320),u=r(6656),s=r(4326),c=r(9587),f=r(7593),l=r(7293),p=r(30),d=r(8006).f,v=r(1236).f,h=r(3070).f,y=r(3111).trim,g="Number",b=o.Number,m=b.prototype,x=s(p(m))==g,w=function(t){var e,r,n,o,i,a,u,s,c=f(t,!1);if("string"==typeof c&&c.length>2)if(43===(e=(c=y(c)).charCodeAt(0))||45===e){if(88===(r=c.charCodeAt(2))||120===r)return NaN}else if(48===e){switch(c.charCodeAt(1)){case 66:case 98:n=2,o=49;break;case 79:case 111:n=8,o=55;break;default:return+c}for(a=(i=c.slice(2)).length,u=0;u<a;u++)if((s=i.charCodeAt(u))<48||s>o)return NaN;return parseInt(i,n)}return+c};if(i(g,!b(" 0o1")||!b("0b1")||b("+0x1"))){for(var S,A=function(t){var e=arguments.length<1?0:t,r=this;return r instanceof A&&(x?l((function(){m.valueOf.call(r)})):s(r)!=g)?c(new b(w(e)),r,A):w(e)},E=n?d(b):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),T=0;E.length>T;T++)u(b,S=E[T])&&!u(A,S)&&h(A,S,v(b,S));A.prototype=m,m.constructor=A,a(o,g,A)}},1539:function(t,e,r){var n=r(1694),o=r(1320),i=r(288);n||o(Object.prototype,"toString",i,{unsafe:!0})},8674:function(t,e,r){"use strict";var n,o,i,a,u=r(2109),s=r(1913),c=r(7854),f=r(5005),l=r(3366),p=r(1320),d=r(2248),v=r(8003),h=r(6340),y=r(111),g=r(3099),b=r(5787),m=r(4326),x=r(2788),w=r(408),S=r(7072),A=r(6707),E=r(261).set,T=r(5948),I=r(9478),P=r(842),O=r(8523),_=r(2534),C=r(9909),j=r(4705),R=r(5112),L=r(7392),N=R("species"),k="Promise",M=C.get,D=C.set,U=C.getterFor(k),F=l,B=c.TypeError,G=c.document,V=c.process,H=f("fetch"),W=O.f,K=W,q="process"==m(V),z=!!(G&&G.createEvent&&c.dispatchEvent),Y="unhandledrejection",$=j(k,(function(){if(!(x(F)!==String(F))){if(66===L)return!0;if(!q&&"function"!=typeof PromiseRejectionEvent)return!0}if(s&&!F.prototype.finally)return!0;if(L>=51&&/native code/.test(F))return!1;var t=F.resolve(1),e=function(t){t((function(){}),(function(){}))};return(t.constructor={})[N]=e,!(t.then((function(){}))instanceof e)})),X=$||!S((function(t){F.all(t).catch((function(){}))})),J=function(t){var e;return!(!y(t)||"function"!=typeof(e=t.then))&&e},Q=function(t,e,r){if(!e.notified){e.notified=!0;var n=e.reactions;T((function(){for(var o=e.value,i=1==e.state,a=0;n.length>a;){var u,s,c,f=n[a++],l=i?f.ok:f.fail,p=f.resolve,d=f.reject,v=f.domain;try{l?(i||(2===e.rejection&&rt(t,e),e.rejection=1),!0===l?u=o:(v&&v.enter(),u=l(o),v&&(v.exit(),c=!0)),u===f.promise?d(B("Promise-chain cycle")):(s=J(u))?s.call(u,p,d):p(u)):d(o)}catch(t){v&&!c&&v.exit(),d(t)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&tt(t,e)}))}},Z=function(t,e,r){var n,o;z?((n=G.createEvent("Event")).promise=e,n.reason=r,n.initEvent(t,!1,!0),c.dispatchEvent(n)):n={promise:e,reason:r},(o=c["on"+t])?o(n):t===Y&&P("Unhandled promise rejection",r)},tt=function(t,e){E.call(c,(function(){var r,n=e.value;if(et(e)&&(r=_((function(){q?V.emit("unhandledRejection",n,t):Z(Y,t,n)})),e.rejection=q||et(e)?2:1,r.error))throw r.value}))},et=function(t){return 1!==t.rejection&&!t.parent},rt=function(t,e){E.call(c,(function(){q?V.emit("rejectionHandled",t):Z("rejectionhandled",t,e.value)}))},nt=function(t,e,r,n){return function(o){t(e,r,o,n)}},ot=function(t,e,r,n){e.done||(e.done=!0,n&&(e=n),e.value=r,e.state=2,Q(t,e,!0))},it=function(t,e,r,n){if(!e.done){e.done=!0,n&&(e=n);try{if(t===r)throw B("Promise can't be resolved itself");var o=J(r);o?T((function(){var n={done:!1};try{o.call(r,nt(it,t,n,e),nt(ot,t,n,e))}catch(r){ot(t,n,r,e)}})):(e.value=r,e.state=1,Q(t,e,!1))}catch(r){ot(t,{done:!1},r,e)}}};$&&(F=function(t){b(this,F,k),g(t),n.call(this);var e=M(this);try{t(nt(it,this,e),nt(ot,this,e))}catch(t){ot(this,e,t)}},(n=function(t){D(this,{type:k,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=d(F.prototype,{then:function(t,e){var r=U(this),n=W(A(this,F));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=q?V.domain:void 0,r.parent=!0,r.reactions.push(n),0!=r.state&&Q(this,r,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new n,e=M(t);this.promise=t,this.resolve=nt(it,t,e),this.reject=nt(ot,t,e)},O.f=W=function(t){return t===F||t===i?new o(t):K(t)},s||"function"!=typeof l||(a=l.prototype.then,p(l.prototype,"then",(function(t,e){var r=this;return new F((function(t,e){a.call(r,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof H&&u({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return I(F,H.apply(c,arguments))}}))),u({global:!0,wrap:!0,forced:$},{Promise:F}),v(F,k,!1,!0),h(k),i=f(k),u({target:k,stat:!0,forced:$},{reject:function(t){var e=W(this);return e.reject.call(void 0,t),e.promise}}),u({target:k,stat:!0,forced:s||$},{resolve:function(t){return I(s&&this===i?F:this,t)}}),u({target:k,stat:!0,forced:X},{all:function(t){var e=this,r=W(e),n=r.resolve,o=r.reject,i=_((function(){var r=g(e.resolve),i=[],a=0,u=1;w(t,(function(t){var s=a++,c=!1;i.push(void 0),u++,r.call(e,t).then((function(t){c||(c=!0,i[s]=t,--u||n(i))}),o)})),--u||n(i)}));return i.error&&o(i.value),r.promise},race:function(t){var e=this,r=W(e),n=r.reject,o=_((function(){var o=g(e.resolve);w(t,(function(t){o.call(e,t).then(r.resolve,n)}))}));return o.error&&n(o.value),r.promise}})},4916:function(t,e,r){"use strict";var n=r(2109),o=r(2261);n({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},9714:function(t,e,r){"use strict";var n=r(1320),o=r(9670),i=r(7293),a=r(7066),u="toString",s=RegExp.prototype,c=s.toString,f=i((function(){return"/a/b"!=c.call({source:"a",flags:"b"})})),l=c.name!=u;(f||l)&&n(RegExp.prototype,u,(function(){var t=o(this),e=String(t.source),r=t.flags;return"/"+e+"/"+String(void 0===r&&t instanceof RegExp&&!("flags"in s)?a.call(t):r)}),{unsafe:!0})},5306:function(t,e,r){"use strict";var n=r(7007),o=r(9670),i=r(7908),a=r(7466),u=r(9958),s=r(4488),c=r(1530),f=r(7651),l=Math.max,p=Math.min,d=Math.floor,v=/\$([$&'`]|\d\d?|<[^>]*>)/g,h=/\$([$&'`]|\d\d?)/g;n("replace",2,(function(t,e,r,n){var y=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,g=n.REPLACE_KEEPS_$0,b=y?"$":"$0";return[function(r,n){var o=s(this),i=null==r?void 0:r[t];return void 0!==i?i.call(r,o,n):e.call(String(o),r,n)},function(t,n){if(!y&&g||"string"==typeof n&&-1===n.indexOf(b)){var i=r(e,t,this,n);if(i.done)return i.value}var s=o(t),d=String(this),v="function"==typeof n;v||(n=String(n));var h=s.global;if(h){var x=s.unicode;s.lastIndex=0}for(var w=[];;){var S=f(s,d);if(null===S)break;if(w.push(S),!h)break;""===String(S[0])&&(s.lastIndex=c(d,a(s.lastIndex),x))}for(var A,E="",T=0,I=0;I<w.length;I++){S=w[I];for(var P=String(S[0]),O=l(p(u(S.index),d.length),0),_=[],C=1;C<S.length;C++)_.push(void 0===(A=S[C])?A:String(A));var j=S.groups;if(v){var R=[P].concat(_,O,d);void 0!==j&&R.push(j);var L=String(n.apply(void 0,R))}else L=m(P,d,O,_,j,n);O>=T&&(E+=d.slice(T,O)+L,T=O+P.length)}return E+d.slice(T)}];function m(t,r,n,o,a,u){var s=n+t.length,c=o.length,f=h;return void 0!==a&&(a=i(a),f=v),e.call(u,f,(function(e,i){var u;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return r.slice(0,n);case"'":return r.slice(s);case"<":u=a[i.slice(1,-1)];break;default:var f=+i;if(0===f)return e;if(f>c){var l=d(f/10);return 0===l?e:l<=c?void 0===o[l-1]?i.charAt(1):o[l-1]+i.charAt(1):e}u=o[f-1]}return void 0===u?"":u}))}}))},2990:function(t,e,r){"use strict";var n=r(260),o=r(1048),i=n.aTypedArray;(0,n.exportTypedArrayMethod)("copyWithin",(function(t,e){return o.call(i(this),t,e,arguments.length>2?arguments[2]:void 0)}))},8927:function(t,e,r){"use strict";var n=r(260),o=r(2092).every,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("every",(function(t){return o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},3105:function(t,e,r){"use strict";var n=r(260),o=r(1285),i=n.aTypedArray;(0,n.exportTypedArrayMethod)("fill",(function(t){return o.apply(i(this),arguments)}))},5035:function(t,e,r){"use strict";var n=r(260),o=r(2092).filter,i=r(6707),a=n.aTypedArray,u=n.aTypedArrayConstructor;(0,n.exportTypedArrayMethod)("filter",(function(t){for(var e=o(a(this),t,arguments.length>1?arguments[1]:void 0),r=i(this,this.constructor),n=0,s=e.length,c=new(u(r))(s);s>n;)c[n]=e[n++];return c}))},7174:function(t,e,r){"use strict";var n=r(260),o=r(2092).findIndex,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("findIndex",(function(t){return o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},4345:function(t,e,r){"use strict";var n=r(260),o=r(2092).find,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("find",(function(t){return o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},2846:function(t,e,r){"use strict";var n=r(260),o=r(2092).forEach,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("forEach",(function(t){o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},4731:function(t,e,r){"use strict";var n=r(260),o=r(1318).includes,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("includes",(function(t){return o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},7209:function(t,e,r){"use strict";var n=r(260),o=r(1318).indexOf,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("indexOf",(function(t){return o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},6319:function(t,e,r){"use strict";var n=r(7854),o=r(260),i=r(6992),a=r(5112)("iterator"),u=n.Uint8Array,s=i.values,c=i.keys,f=i.entries,l=o.aTypedArray,p=o.exportTypedArrayMethod,d=u&&u.prototype[a],v=!!d&&("values"==d.name||null==d.name),h=function(){return s.call(l(this))};p("entries",(function(){return f.call(l(this))})),p("keys",(function(){return c.call(l(this))})),p("values",h,!v),p(a,h,!v)},8867:function(t,e,r){"use strict";var n=r(260),o=n.aTypedArray,i=n.exportTypedArrayMethod,a=[].join;i("join",(function(t){return a.apply(o(this),arguments)}))},7789:function(t,e,r){"use strict";var n=r(260),o=r(6583),i=n.aTypedArray;(0,n.exportTypedArrayMethod)("lastIndexOf",(function(t){return o.apply(i(this),arguments)}))},3739:function(t,e,r){"use strict";var n=r(260),o=r(2092).map,i=r(6707),a=n.aTypedArray,u=n.aTypedArrayConstructor;(0,n.exportTypedArrayMethod)("map",(function(t){return o(a(this),t,arguments.length>1?arguments[1]:void 0,(function(t,e){return new(u(i(t,t.constructor)))(e)}))}))},4483:function(t,e,r){"use strict";var n=r(260),o=r(3671).right,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("reduceRight",(function(t){return o(i(this),t,arguments.length,arguments.length>1?arguments[1]:void 0)}))},9368:function(t,e,r){"use strict";var n=r(260),o=r(3671).left,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("reduce",(function(t){return o(i(this),t,arguments.length,arguments.length>1?arguments[1]:void 0)}))},2056:function(t,e,r){"use strict";var n=r(260),o=n.aTypedArray,i=n.exportTypedArrayMethod,a=Math.floor;i("reverse",(function(){for(var t,e=this,r=o(e).length,n=a(r/2),i=0;i<n;)t=e[i],e[i++]=e[--r],e[r]=t;return e}))},3462:function(t,e,r){"use strict";var n=r(260),o=r(7466),i=r(4590),a=r(7908),u=r(7293),s=n.aTypedArray;(0,n.exportTypedArrayMethod)("set",(function(t){s(this);var e=i(arguments.length>1?arguments[1]:void 0,1),r=this.length,n=a(t),u=o(n.length),c=0;if(u+e>r)throw RangeError("Wrong length");for(;c<u;)this[e+c]=n[c++]}),u((function(){new Int8Array(1).set({})})))},678:function(t,e,r){"use strict";var n=r(260),o=r(6707),i=r(7293),a=n.aTypedArray,u=n.aTypedArrayConstructor,s=n.exportTypedArrayMethod,c=[].slice;s("slice",(function(t,e){for(var r=c.call(a(this),t,e),n=o(this,this.constructor),i=0,s=r.length,f=new(u(n))(s);s>i;)f[i]=r[i++];return f}),i((function(){new Int8Array(1).slice()})))},7462:function(t,e,r){"use strict";var n=r(260),o=r(2092).some,i=n.aTypedArray;(0,n.exportTypedArrayMethod)("some",(function(t){return o(i(this),t,arguments.length>1?arguments[1]:void 0)}))},3824:function(t,e,r){"use strict";var n=r(260),o=n.aTypedArray,i=n.exportTypedArrayMethod,a=[].sort;i("sort",(function(t){return a.call(o(this),t)}))},5021:function(t,e,r){"use strict";var n=r(260),o=r(7466),i=r(1400),a=r(6707),u=n.aTypedArray;(0,n.exportTypedArrayMethod)("subarray",(function(t,e){var r=u(this),n=r.length,s=i(t,n);return new(a(r,r.constructor))(r.buffer,r.byteOffset+s*r.BYTES_PER_ELEMENT,o((void 0===e?n:i(e,n))-s))}))},2974:function(t,e,r){"use strict";var n=r(7854),o=r(260),i=r(7293),a=n.Int8Array,u=o.aTypedArray,s=o.exportTypedArrayMethod,c=[].toLocaleString,f=[].slice,l=!!a&&i((function(){c.call(new a(1))}));s("toLocaleString",(function(){return c.apply(l?f.call(u(this)):u(this),arguments)}),i((function(){return[1,2].toLocaleString()!=new a([1,2]).toLocaleString()}))||!i((function(){a.prototype.toLocaleString.call([1,2])})))},5016:function(t,e,r){"use strict";var n=r(260).exportTypedArrayMethod,o=r(7293),i=r(7854).Uint8Array,a=i&&i.prototype||{},u=[].toString,s=[].join;o((function(){u.call({})}))&&(u=function(){return s.call(this)});var c=a.toString!=u;n("toString",u,c)},2472:function(t,e,r){r(9843)("Uint8",(function(t){return function(e,r,n){return t(this,e,r,n)}}))},7147:function(t,e,r){"use strict";r.r(e),r.d(e,{Headers:function(){return v},Request:function(){return w},Response:function(){return A},DOMException:function(){return T},fetch:function(){return I}});var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n&&n,o="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,a="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),u="FormData"in n,s="ArrayBuffer"in n;if(s)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function p(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function v(t){this.map={},t instanceof v?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=y(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:a&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:u&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&a&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||f(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=h(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(g)}),this.text=function(){var t,e,r,n=h(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=y(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u&&(this.formData=function(){return this.text().then(S)}),this.json=function(){return this.text().then(JSON.parse)},this}v.prototype.append=function(t,e){t=l(t),e=p(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},v.prototype.delete=function(t){delete this.map[l(t)]},v.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},v.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},v.prototype.set=function(t,e){this.map[l(t)]=p(e)},v.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},v.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},v.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},v.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},i&&(v.prototype[Symbol.iterator]=v.prototype.entries);var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,o=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new v(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new v(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),x.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function S(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function A(t,e){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"",this.headers=new v(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},m.call(w.prototype),m.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},A.error=function(){var t=new A(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];A.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new A(null,{status:e,headers:{location:t}})};var T=n.DOMException;try{new T}catch(t){(T=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),T.prototype.constructor=T}function I(t,e){return new Promise((function(r,o){var i=new w(t,e);if(i.signal&&i.signal.aborted)return o(new T("Aborted","AbortError"));var u=new XMLHttpRequest;function c(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new v,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;setTimeout((function(){r(new A(o,n))}),0)},u.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){o(new T("Aborted","AbortError"))}),0)},u.open(i.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(e){return t}}(i.url),!0),"include"===i.credentials?u.withCredentials=!0:"omit"===i.credentials&&(u.withCredentials=!1),"responseType"in u&&(a?u.responseType="blob":s&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof v?i.headers.forEach((function(t,e){u.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){u.setRequestHeader(t,p(e.headers[t]))})),i.signal&&(i.signal.addEventListener("abort",c),u.onreadystatechange=function(){4===u.readyState&&i.signal.removeEventListener("abort",c)}),u.send(void 0===i._bodyInit?null:i._bodyInit)}))}I.polyfill=!0,n.fetch||(n.fetch=I,n.Headers=v,n.Request=w,n.Response=A)}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n=r(9820);return n=n.default}()}));
;
/*! RESOURCE: /scripts/sn/common/analytics/service.snAnalyticsUtil.js */
angular.module('sn.common.analytics').factory("snAnalyticsUtil", function ($http, $rootScope, snAnalyticsConsentModal, i18n) {
"use strict";
function invokeUCMEngine () {
NOW.usage_tracking = NOW.usage_tracking || {};
if (!NOW.analytics_enabled || !NOW.sp_analytics_plugin_active)
return;
if (NOW.user_name === 'guest'
|| NOW.user_impersonating
|| ((NOW.usage_tracking.user_consent === 'NoConsentRequired' || NOW.usage_tracking.user_consent === 'BasicTracking') && NOW.ucm_portal_id === NOW.portal_id))
return;
$http.get("/api/now/sp/consent/getConsentDetails", { params: { "portal_id": NOW.portal_id } }).then(function(response) {
var consent;
try {
consent = JSON.parse(response.data.result);
} catch (e) {
return;
}
NOW.usage_tracking.user_consent = consent.user_consent;
NOW.usage_tracking.usage_tracking_allowed_for_session = consent.usage_tracking_allowed_for_session;
NOW.sp_analytics_portal_override = consent.portal_override;
NOW.ucm_invocations = consent.ucm_invocations;
NOW.ucm_portal_id = consent.ucm_portal_id;
if (consent.user_consent === "NoConsentRequired" || consent.user_consent === "BasicTracking" || consent.user_consent === "Disabled") {
emitUCMFinished();
} else {
var buttonsObj = [];
if (consent.user_consent === "Notice") {
buttonsObj.push({label: i18n.getMessage('Agree'), user_consent: 'Y', primary: true, focus: true });
} else if (consent.user_consent === "ExplicitOptIn") {
buttonsObj.push({label: i18n.getMessage('No'), user_consent: 'N'});
buttonsObj.push({label: i18n.getMessage('Yes'), user_consent: 'Y', primary: true, focus: true});
} else {
return;
}
var options = {
title: i18n.getMessage('Enable Analytics'),
message: consent.user_analytics_consent_text,
buttons: buttonsObj
};
snAnalyticsConsentModal.open(options).then(updateUserConsent);
}
});
}
function updateUserConsent(obj) {
var params = { "user_consent": obj.user_consent };
$http.post("/api/now/sp/consent/update", params).then(function (response) {
try {
var updatedConsent = JSON.parse(response.data.result);
NOW.usage_tracking.usage_tracking_allowed_for_session = updatedConsent.usage_tracking_allowed_for_session;
NOW.usage_tracking.user_consent = updatedConsent.user_consent
emitUCMFinished();
} catch (e) {
return;
}
});
}
function emitUCMFinished() {
$rootScope.$emit('sn.ucm.finished', $rootScope);
}
var util = {
invokeUCMEngine: invokeUCMEngine
};
return util;
});
;
/*! RESOURCE: /scripts/sn/common/analytics/service.snAnalyticsModal.js */
angular.module('sn.common.analytics').factory('snAnalyticsConsentModal', function($q, $uibModal, i18n, $templateCache) {
"use strict";
var templateName = "sn-analytics-consent-modal.xml";
function open(options) {
var options = initOptions(options);
var defer = $q.defer();
_open(options, defer);
return defer.promise;
}
function _open(options, defer) {
var pageRoot = angular.element(options.pageRootElement || '.sp-page-root');
var modal = $uibModal.open({
templateUrl: templateName,
controller: snModalCtrl,
size: options.size,
appendTo: options.appendTo,
backdrop: options.backdrop != undefined ? options.backdrop : 'static',
keyboard: options.keyboard != undefined ? options.keyboard : false,
resolve: {
options: function() {
return options;
}
}
});
modal.result.then(function(result) {
defer.resolve(result.button);
}, function(){
defer.reject();
});
modal.rendered.then(function() {
var h1 = angular.element('#modal-title');
var modal = h1.closest('div.modal');
modal.attr('aria-labelledby', 'modal-title');
modal.attr('aria-describedby', 'modal-body');
pageRoot.attr('aria-hidden', 'true');
setTimeout(function(){
modal.find('.btn-focus').focus();
},0);
});
modal.closed.then(function() {
pageRoot.attr('aria-hidden', 'false');
});
}
function initOptions(options) {
var defaults = {
title: '',
message: '',
messageOnly: false,
size: '',
noDismiss: false,
buttons: [
{label: i18n.getMessage('No'), cancel:true},
{label: i18n.getMessage('Yes'), primary:true}
]
};
options = options || {};
for (var key in defaults) {
if (options[key] === undefined) {
options[key] = defaults[key];
}
}
if (options.messageOnly) {
options.headerStyle = {border: 'none'}
options.footerStyle = {border: 'none', 'padding-top': 0}
}
if (options.noDismiss)
options.headerStyle = {display: 'none'};
return options;
}
function snModalCtrl($scope, options) {
$scope.options = options;
$scope.buttonClicked = function(button){
if (button.cancel) {
$scope.$dismiss();
return;
}
$scope.$close({button:button});
}
}
$templateCache.put(templateName,
'<div>' +
'	<div class="modal-header" ng-style="options.headerStyle">' +
'		<h1 class="modal-title h4" ng-bind-html="options.title" id="modal-title"></h1>' +
'	</div>' +
'	<div class="modal-body" id="modal-body">' +
'		<p ng-if="options.message" ng-bind-html="options.message"></p>' +
'	</div>' +
'	<div class="modal-footer" ng-style="options.footerStyle">' +
'		<button ng-repeat="button in options.buttons track by button.label" class="btn btn-default {{button.class}}"' +
'			ng-class="{\'btn-primary\':button.primary, \'btn-focus\':button.focus}" ng-click="buttonClicked(button)">{{button.label}}</button>' +
'	</div>'+
'</div>'
);
var snAnalyticsConsentModal = {open: open};
return snAnalyticsConsentModal;
})
;
/*! RESOURCE: /scripts/sn/common/analytics/service.snAnalytics.js */
angular.module('sn.common.analytics').factory("snAnalytics", function ($rootScope) {
"use strict";
var instanceLevelEnabled = NOW.analytics_enabled && NOW.sp_analytics_plugin_active;
var authKeyPresent = !!NOW.instrumentation_authkey;
var unauthenticatedUserTrackingEnabled = NOW.unauthenticated_user_tracking_enabled || false;
initializeAnalyticsSDK();
$rootScope.$on('sn.ucm.finished', function(){
initializeAnalyticsSDK();
});
function initializeAnalyticsSDK() {
if (!allowAnalytics())
return;
var options = {
"serverEndpoint": NOW.instrumentation_api_host,
"trackingConsent": "Full",
}
if (!unauthenticatedUserTrackingEnabled || NOW.user_name !== 'guest') {
options["userId"] =  NOW.user_id_hashed;
options["trackingConsent"] = NOW.usage_tracking.user_consent === "BasicTracking" ? "Basic" : "Full";
}
SNAnalytics.start(getApiKey(), NOW.instrumentation_authkey, options);
if (NOW.instance_name)
setUserProperty("Instance Name", NOW.instance_name);
if (NOW.domain_id)
setUserProperty("Domain", NOW.domain_id);
}
function getApiKey() {
return NOW.instance_id + ":" + NOW.portal_id;
}
function setUserProperty(name, value) {
if (!allowAnalytics())
return;
SNAnalytics.setUserProperty(name, value);
}
function setUserProperties(properties) {
if (!allowAnalytics())
return;
SNAnalytics.setUserProperties(properties);
}
function removeUserProperty(name) {
if (!allowAnalytics())
return;
SNAnalytics.removeUserProperty(name);
}
function appendToUserProperty(name, value) {
if (!allowAnalytics())
return;
SNAnalytics.appendToUserProperty(name, value);
}
function incUserProperty(name, value) {
if (!allowAnalytics())
return;
SNAnalytics.incUserProperty(name, value);
}
function startPage(id, title) {
if (!allowAnalytics())
return;
SNAnalytics.startPage(id, title);
}
function multipleEventsInPayload (payload) {
var eventName = payload.parentEvent.EventName || "";
var eventPayload = payload.parentEvent.EventPayload;
if (eventName && eventPayload)
SNAnalytics.addEvent(eventName, eventPayload);
var childEvents = payload.childEvents;
if (childEvents) {
var childEventName;
var childEventPayload;
for (var i = 0; i < childEvents.length; i++) {
childEventName = childEvents[i]['EventName'];
childEventPayload = childEvents[i]['EventPayload'];
if (childEventName && childEventPayload)
SNAnalytics.addEvent(childEventName, childEventPayload);
}
}
}
function addEvent(payload) {
if (!allowAnalytics())
return;
if (payload.parentEvent) {
multipleEventsInPayload(payload);
return;
}
if (payload.name && payload.data)
SNAnalytics.addEvent(payload.name, payload.data);
}
function allowAnalytics() {
if (!instanceLevelEnabled)
return false;
if (NOW.usage_tracking.usage_tracking_allowed_for_session && authKeyPresent && NOW.user_name !== 'guest')
return true;
else if (unauthenticatedUserTrackingEnabled && authKeyPresent && NOW.user_name === 'guest')
return true;
return false;
}
$rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
if (newUrl.indexOf("logout.do") !== -1) {
if (unauthenticatedUserTrackingEnabled && authKeyPresent) {
var payload= {};
payload.name = "Successful Logout";
payload.data = {};
payload.data["Login"] = false;
addEvent(payload);
}
else if (allowAnalytics()) {
SNAnalytics.setTrackingConsent('Disabled');
}
}
});
var util = {
addEvent: addEvent,
startPage: startPage,
setUserProperty: setUserProperty,
setUserProperties: setUserProperties,
removeUserProperty: removeUserProperty,
appendToUserProperty: appendToUserProperty,
incUserProperty: incUserProperty
};
return util;
});
;
;
/*! RESOURCE: /scripts/bootstrap_336.js */
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
'use strict';
var version = $.fn.jquery.split(' ')[0].split('.')
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')
}
}(jQuery);
+function ($) {
'use strict';
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition    : 'transitionend',
OTransition      : 'oTransitionEnd otransitionend',
transition       : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false
}
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);
+function ($) {
'use strict';
var dismiss = '[data-dismiss="alert"]'
var Alert   = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.3.6'
Alert.TRANSITION_DURATION = 150
Alert.prototype.close = function (e) {
var $this    = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '')
}
selector    = selector === '#' ? [] : selector
var $parent = $(document).find(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.closest('.alert')
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent.detach().trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
}
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data  = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.alert
$.fn.alert             = Plugin
$.fn.alert.Constructor = Alert
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);
+function ($) {
'use strict';
var Button = function (element, options) {
this.$element  = $(element)
this.options   = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}
Button.VERSION  = '3.3.6'
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
var d    = 'disabled'
var $el  = this.$element
var val  = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d).prop(d, true)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d).prop(d, false)
}
}, this), 0)
}
Button.prototype.toggle = function () {
var changed = true
var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked')) changed = false
$parent.find('.active').removeClass('active')
this.$element.addClass('active')
} else if ($input.prop('type') == 'checkbox') {
if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
this.$element.toggleClass('active')
}
$input.prop('checked', this.$element.hasClass('active'))
if (changed) $input.trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
this.$element.toggleClass('active')
}
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.button')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
var old = $.fn.button
$.fn.button             = Plugin
$.fn.button.Constructor = Button
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})
}(jQuery);
+function ($) {
'use strict';
var Carousel = function (element, options) {
this.$element    = $(element)
this.$indicators = this.$element.find('.carousel-indicators')
this.options     = options
this.paused      = null
this.sliding     = null
this.interval    = null
this.$active     = null
this.$items      = null
this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION  = '3.3.6'
Carousel.TRANSITION_DURATION = 600
Carousel.DEFAULTS = {
interval: 5000,
pause: 'hover',
wrap: true,
keyboard: true
}
Carousel.prototype.keydown = function (e) {
if (/input|textarea/i.test(e.target.tagName)) return
switch (e.which) {
case 37: this.prev(); break
case 39: this.next(); break
default: return
}
e.preventDefault()
}
Carousel.prototype.cycle = function (e) {
e || (this.paused = false)
this.interval && clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getItemIndex = function (item) {
this.$items = item.parent().children('.item')
return this.$items.index(item || this.$active)
}
Carousel.prototype.getItemForDirection = function (direction, active) {
var activeIndex = this.getItemIndex(active)
var willWrap = (direction == 'prev' && activeIndex === 0)
|| (direction == 'next' && activeIndex == (this.$items.length - 1))
if (willWrap && !this.options.wrap) return active
var delta = direction == 'prev' ? -1 : 1
var itemIndex = (activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to = function (pos) {
var that        = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
}
Carousel.prototype.pause = function (e) {
e || (this.paused = true)
if (this.$element.find('.next, .prev').length && $.support.transition) {
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval = clearInterval(this.interval)
return this
}
Carousel.prototype.next = function () {
if (this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev = function () {
if (this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide = function (type, next) {
var $active   = this.$element.find('.item.active')
var $next     = next || this.getItemForDirection(type, $active)
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
var that      = this
if ($next.hasClass('active')) return (this.sliding = false)
var relatedTarget = $next[0]
var slideEvent = $.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if (slideEvent.isDefaultPrevented()) return
this.sliding = true
isCycling && this.pause()
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator && $nextIndicator.addClass('active')
}
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction })
if ($.support.transition && this.$element.hasClass('slide')) {
$next.addClass(type)
$next[0].offsetWidth
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () {
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
} else {
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger(slidEvent)
}
isCycling && this.cycle()
return this
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.carousel')
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action  = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
})
}
var old = $.fn.carousel
$.fn.carousel             = Plugin
$.fn.carousel.Constructor = Carousel
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
var clickHandler = function (e) {
var $this   = $(this)
var href    = $this.attr('href')
if (href) {
href = href.replace(/.*(?=#[^\s]+$)/, '')
}
var target  = $this.attr('data-target') || href
var $target = $(document).find(target)
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
Plugin.call($target, options)
if (slideIndex) {
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
}
$(document)
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
$(window).on('load', function () {
$('[data-ride="carousel"]').each(function () {
var $carousel = $(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);
+function ($) {
'use strict';
var Collapse = function (element, options) {
this.$element      = $(element)
this.options       = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger      = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning = null
if (this.options.parent) {
this.$parent = this.getParent()
} else {
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if (this.options.toggle) this.toggle()
}
Collapse.VERSION  = '3.3.6'
Collapse.TRANSITION_DURATION = 350
Collapse.DEFAULTS = {
toggle: true
}
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var activesData
var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
if (actives && actives.length) {
activesData = actives.data('bs.collapse')
if (activesData && activesData.transitioning) return
}
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
if (actives && actives.length) {
Plugin.call(actives, 'hide')
activesData || actives.data('bs.collapse', null)
}
var dimension = this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)
this.$trigger
.removeClass('collapsed')
.attr('aria-expanded', true)
this.transitioning = 1
var complete = function () {
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning = 0
this.$element
.trigger('shown.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var dimension = this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)
this.$trigger
.addClass('collapsed')
.attr('aria-expanded', false)
this.transitioning = 1
var complete = function () {
this.transitioning = 0
this.$element
.removeClass('collapsing')
.addClass('collapse')
.trigger('hidden.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
}
Collapse.prototype.toggle = function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
Collapse.prototype.getParent = function () {
return $(document).find(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element) {
var $element = $(element)
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
}, this))
.end()
}
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
var isOpen = $element.hasClass('in')
$element.attr('aria-expanded', isOpen)
$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
}
function getTargetFromTrigger($trigger) {
var href
var target = $trigger.attr('data-target')
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')
return $(document).find(target)
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.collapse
$.fn.collapse             = Plugin
$.fn.collapse.Constructor = Collapse
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
var $this   = $(this)
if (!$this.attr('data-target')) e.preventDefault()
var $target = getTargetFromTrigger($this)
var data    = $target.data('bs.collapse')
var option  = data ? 'toggle' : $this.data()
Plugin.call($target, option)
})
}(jQuery);
+function ($) {
'use strict';
var backdrop = '.dropdown-backdrop'
var toggle   = '[data-toggle="dropdown"]'
var Dropdown = function (element) {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.3.6'
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '')
}
var $parent = selector !== '#' ? $(document).find(selector) : null
return $parent && $parent.length ? $parent : $this.parent()
}
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $this         = $(this)
var $parent       = getParent($this)
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
})
}
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
var $parent  = getParent($this)
var isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
$(document.createElement('div'))
.addClass('dropdown-backdrop')
.insertAfter($(this))
.on('click', clearMenus)
}
var relatedTarget = { relatedTarget: this }
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this
.trigger('focus')
.attr('aria-expanded', 'true')
$parent
.toggleClass('open')
.trigger($.Event('shown.bs.dropdown', relatedTarget))
}
return false
}
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
var $parent  = getParent($this)
var isActive = $parent.hasClass('open')
if (!isActive && e.which != 27 || isActive && e.which == 27) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc = ' li:not(.disabled):visible a'
var $items = $parent.find('.dropdown-menu' + desc)
if (!$items.length) return
var index = $items.index(e.target)
if (e.which == 38 && index > 0)                 index--
if (e.which == 40 && index < $items.length - 1) index++
if (!~index)                                    index = 0
$items.eq(index).trigger('focus')
}
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data  = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.dropdown
$.fn.dropdown             = Plugin
$.fn.dropdown.Constructor = Dropdown
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
}(jQuery);
+function ($) {
'use strict';
var Modal = function (element, options) {
this.options             = options
this.$body               = $(document.body)
this.$element            = $(element)
this.$dialog             = this.$element.find('.modal-dialog')
this.$backdrop           = null
this.isShown             = null
this.originalBodyPad     = null
this.scrollbarWidth      = 0
this.ignoreBackdropClick = false
if (this.options.remote) {
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function () {
this.$element.trigger('loaded.bs.modal')
}, this))
}
}
Modal.VERSION  = '3.3.6'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
Modal.DEFAULTS = {
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle = function (_relatedTarget) {
return this.isShown ? this.hide() : this.show(_relatedTarget)
}
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.checkScrollbar()
this.setScrollbar()
this.$body.addClass('modal-open')
this.escape()
this.resize()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$dialog.on('mousedown.dismiss.bs.modal', function () {
that.$element.one('mouseup.dismiss.bs.modal', function (e) {
if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
})
})
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(that.$body)
}
that.$element
.show()
.scrollTop(0)
that.adjustDialog()
if (transition) {
that.$element[0].offsetWidth
}
that.$element.addClass('in')
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$dialog
.one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide = function (e) {
if (e) e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
this.resize()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal')
this.$dialog.off('mousedown.dismiss.bs.modal')
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
}
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal')
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keydown.dismiss.bs.modal')
}
}
Modal.prototype.resize = function () {
if (this.isShown) {
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
} else {
$(window).off('resize.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.$body.removeClass('modal-open')
that.resetAdjustments()
that.resetScrollbar()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $(document.createElement('div'))
.addClass('modal-backdrop ' + animate)
.appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (this.ignoreBackdropClick) {
this.ignoreBackdropClick = false
return
}
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus()
: this.hide()
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
var callbackRemove = function () {
that.removeBackdrop()
callback && callback()
}
$.support.transition && this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
} else if (callback) {
callback()
}
}
Modal.prototype.handleUpdate = function () {
this.adjustDialog()
}
Modal.prototype.adjustDialog = function () {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft:  !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
}
Modal.prototype.resetAdjustments = function () {
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
}
Modal.prototype.checkScrollbar = function () {
var fullWindowWidth = window.innerWidth
if (!fullWindowWidth) {
var documentElementRect = document.documentElement.getBoundingClientRect()
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
this.scrollbarWidth = this.measureScrollbar()
}
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
this.originalBodyPad = document.body.style.paddingRight || ''
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', this.originalBodyPad)
}
Modal.prototype.measureScrollbar = function () {
var scrollDiv = document.createElement('div')
scrollDiv.className = 'modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
})
}
var old = $.fn.modal
$.fn.modal             = Plugin
$.fn.modal.Constructor = Modal
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this   = $(this)
var href    = $this.attr('href')
var target = $this.attr('data-target') ||
(href && href.replace(/.*(?=#[^\s]+$)/, ''))
var $target = $(document).find(target)
var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);
+function ($) {
'use strict';
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
var uriAttrs = [
'background',
'cite',
'href',
'itemtype',
'longdesc',
'poster',
'src',
'xlink:href'
]
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
var DefaultWhitelist = {
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
a: ['target', 'href', 'title', 'rel'],
area: [],
b: [],
br: [],
col: [],
code: [],
div: [],
em: [],
hr: [],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
i: [],
img: ['src', 'alt', 'title', 'width', 'height'],
li: [],
ol: [],
p: [],
pre: [],
s: [],
small: [],
span: [],
sub: [],
sup: [],
strong: [],
u: [],
ul: []
}
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
function allowedAttribute(attr, allowedAttributeList) {
var attrName = attr.nodeName.toLowerCase()
if ($.inArray(attrName, allowedAttributeList) !== -1) {
if ($.inArray(attrName, uriAttrs) !== -1) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}
return true
}
var regExp = $(allowedAttributeList).filter(function (index, value) {
return value instanceof RegExp
})
for (var i = 0, l = regExp.length; i < l; i++) {
if (attrName.match(regExp[i])) {
return true
}
}
return false
}
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
if (unsafeHtml.length === 0) {
return unsafeHtml
}
if (sanitizeFn && typeof sanitizeFn === 'function') {
return sanitizeFn(unsafeHtml)
}
if (!document.implementation || !document.implementation.createHTMLDocument) {
return unsafeHtml
}
var createdDocument = document.implementation.createHTMLDocument('sanitization')
createdDocument.body.innerHTML = unsafeHtml
var whitelistKeys = $.map(whiteList, function (el, i) { return i })
var elements = $(createdDocument.body).find('*')
for (var i = 0, len = elements.length; i < len; i++) {
var el = elements[i]
var elName = el.nodeName.toLowerCase()
if ($.inArray(elName, whitelistKeys) === -1) {
el.parentNode.removeChild(el)
continue
}
var attributeList = $.map(el.attributes, function (el) { return el })
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
for (var j = 0, len2 = attributeList.length; j < len2; j++) {
if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
el.removeAttribute(attributeList[j].nodeName)
}
}
}
return createdDocument.body.innerHTML
}
var Tooltip = function (element, options) {
this.type       = null
this.options    = null
this.enabled    = null
this.timeout    = null
this.hoverState = null
this.$element   = null
this.inState    = null
this.init('tooltip', element, options)
}
Tooltip.VERSION  = '3.3.6'
Tooltip.TRANSITION_DURATION = 150
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
},
sanitize : false,
sanitizeFn : null,
whiteList : DefaultWhitelist
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled   = true
this.type      = type
this.$element  = $(element)
this.options   = this.getOptions(options)
this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState   = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
var dataAttributes = this.$element.data()
for (var dataAttr in dataAttributes) {
if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
delete dataAttributes[dataAttr]
}
}
options = $.extend({}, this.getDefaults(), dataAttributes, options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
if (options.sanitize) {
options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options  = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
}
if (self.tip().hasClass('in') || self.hoverState == 'in') {
self.hoverState = 'in'
return
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.isInStateTrue = function () {
for (var key in this.inState) {
if (this.inState[key]) return true
}
return false
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
}
if (self.isInStateTrue()) return
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
this.$element.trigger('inserted.bs.' + this.type)
var pos          = this.getPosition()
var actualWidth  = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var viewportDim = this.getPosition(this.$viewport)
placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top'    :
placement == 'top'    && pos.top    - actualHeight < viewportDim.top    ? 'bottom' :
placement == 'right'  && pos.right  + actualWidth  > viewportDim.width  ? 'left'   :
placement == 'left'   && pos.left   - actualWidth  < viewportDim.left   ? 'right'  :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
var prevHoverState = that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
if (prevHoverState == 'out') that.leave(that)
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip   = this.tip()
var width  = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
if (isNaN(marginTop))  marginTop  = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top  += marginTop
offset.left += marginLeft
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
var actualWidth  = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var isVertical          = /top|bottom/.test(placement)
var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
this.arrow()
.css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isVertical ? 'top' : 'left', '')
}
Tooltip.prototype.setContent = function () {
var $tip  = this.tip()
var title = this.getTitle()
if (this.options.html) {
if (this.options.sanitize) {
title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
}
$tip.find('.tooltip-inner').html(title)
} else {
$tip.find('.tooltip-inner').text(title)
}
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function (callback) {
var that = this
var $tip = $(this.$tip)
var e    = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
if (that.$element) {
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
}
callback && callback()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && $tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element   = $element || this.$element
var el     = $element[0]
var isBody = el.tagName == 'BODY'
var elRect    = el.getBoundingClientRect()
if (elRect.width == null) {
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset  = isBody ? { top: 0, left: 0 } : $element.offset()
var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
{ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) {
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) {
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset  = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) {
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.right) {
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o  = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
if (this.$tip.length != 1) {
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
}
}
return this.$tip
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
if (e) {
self.inState.click = !self.inState.click
if (self.isInStateTrue()) self.enter(self)
else self.leave(self)
} else {
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
}
Tooltip.prototype.destroy = function () {
var that = this
clearTimeout(this.timeout)
this.hide(function () {
that.$element.off('.' + that.type).removeData('bs.' + that.type)
if (that.$tip) {
that.$tip.detach()
}
that.$tip = null
that.$arrow = null
that.$viewport = null
that.$element = null
})
}
Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip             = Plugin
$.fn.tooltip.Constructor = Tooltip
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
+function ($) {
'use strict';
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION  = '3.3.6'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip    = this.tip()
var title   = this.getTitle()
var content = this.getContent()
if (this.options.html) {
var typeContent = typeof content
if (this.options.sanitize) {
title = this.sanitizeHtml(title)
if (typeContent === 'string') {
content = this.sanitizeHtml(content)
}
}
$tip.find('.popover-title').html(title)
$tip.find('.popover-content').children().detach().end()[
typeContent === 'string' ? 'html' : 'append'
](content)
} else {
$tip.find('.popover-title').text(title)
$tip.find('.popover-content').children().detach().end().text(content)
}
$tip.removeClass('fade top bottom left right in')
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o  = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.popover
$.fn.popover             = Plugin
$.fn.popover.Constructor = Popover
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
+function ($) {
'use strict';
function ScrollSpy(element, options) {
this.$body          = $(document.body)
this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector       = (this.options.target || '') + ' .nav li > a'
this.offsets        = []
this.targets        = []
this.activeTarget   = null
this.scrollHeight   = 0
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
this.refresh()
this.process()
}
ScrollSpy.VERSION  = '3.3.6'
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh = function () {
var that          = this
var offsetMethod  = 'offset'
var offsetBase    = 0
this.offsets      = []
this.targets      = []
this.scrollHeight = this.getScrollHeight()
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase   = this.$scrollElement.scrollTop()
}
this.$body
.find(this.selector)
.map(function () {
var $el   = $(this)
var href  = $el.data('target') || $el.attr('href')
var $href = /^#./.test(href) && $(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
that.offsets.push(this[0])
that.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.getScrollHeight()
var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets      = this.offsets
var targets      = this.targets
var activeTarget = this.activeTarget
var i
if (this.scrollHeight != scrollHeight) {
this.refresh()
}
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop < offsets[0]) {
this.activeTarget = null
return this.clear()
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
&& this.activate(targets[i])
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
this.clear()
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear = function () {
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.scrollspy
$.fn.scrollspy             = Plugin
$.fn.scrollspy.Constructor = ScrollSpy
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
$(window).on('load.bs.scrollspy.data-api', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
+function ($) {
'use strict';
var Tab = function (element) {
this.element = $(element)
}
Tab.VERSION = '3.3.6'
Tab.TRANSITION_DURATION = 150
Tab.prototype.show = function () {
var $this    = this.element
var $ul      = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '')
}
if ($this.parent('li').hasClass('active')) return
var $previous = $ul.find('.active:last a')
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(document).find(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active    = container.find('> .active')
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()
}
$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data  = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab
$.fn.tab             = Plugin
$.fn.tab.Constructor = Tab
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
var clickHandler = function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
+function ($) {
'use strict';
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)
this.$target = target
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
this.$element     = $(element)
this.affixed      = null
this.unpin        = null
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION  = '3.3.6'
Affix.RESET    = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
var scrollTop    = this.$target.scrollTop()
var position     = this.$element.offset()
var targetHeight = this.$target.height()
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
if (this.affixed == 'bottom') {
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
}
var initializing   = this.affixed == null
var colliderTop    = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position  = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height       = this.$element.height()
var offset       = this.options.offset
var offsetTop    = offset.top
var offsetBottom = offset.bottom
var scrollHeight = Math.max($(document).height(), $(document.body).height())
if (typeof offset != 'object')         offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
if (this.affixed != affix) {
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e         = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}
function Plugin(option) {
return this.each(function () {
var $this   = $(this)
var data    = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix             = Plugin
$.fn.affix.Constructor = Affix
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop    != null) data.offset.top    = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);
;
/*! RESOURCE: /scripts/libs/bs_tooltip_wrapper.js */
(function() {
if ($.fn.tooltip.Constructor.prototype !== undefined) {
var toolTipShow = $.fn.tooltip.Constructor.prototype.show;
var toolTipHide = $.fn.tooltip.Constructor.prototype.hide;
var toolTipInit = $.fn.tooltip.Constructor.prototype.init;
$(window).on('load', function () {
$('body').on('keydown', function(evt) {
if (evt.which == 27) {
var ttElem = $('.tooltip.in');
if(!ttElem.length) return;
var targetElem = $('[aria-describedby='+ ttElem.attr('id') +']');
if(!targetElem.length) return;
var ttObj = $(targetElem).data('bs.tooltip');
if(!ttObj || !ttObj.tip().hasClass('in')) return;
ttObj.hoverOnTip = false;
ttObj.inState['override'] = false;
ttObj.hide();
evt.stopImmediatePropagation();
evt.stopPropagation();
}
});
});
$.fn.tooltip.Constructor.prototype.init = function(type, element, options) {
toolTipInit.apply(this, arguments);
var eventClick = 'click' + '.' + this.type;
this.$element.on(eventClick, null, $.proxy(function() {
this.hoverOnTip = false;
this.inState['override'] = false;
if(this.hoverState != "in")
this.hide();
}, this));
}
$.fn.tooltip.Constructor.prototype.show = function() {
var $element = this.$element;
var ariaDescribedBy = $element.attr('aria-describedby');
var ariaDescribedByList = ariaDescribedBy ? ariaDescribedBy.split(' ') : [];
toolTipShow.apply(this, arguments);
var $tip = this.tip();
if(ariaDescribedByList.length > 0) {
ariaDescribedByList.push($tip.attr('id'));
$element.attr('aria-describedby', ariaDescribedByList.join(' '));
}
var eventIn = 'mouseenter';
var eventOut = 'mouseleave';
var eventBlur = 'blur';
$tip.off(eventIn + '.' + this.type).off(eventOut + '.' + this.type);
$tip.on(eventIn + '.' + this.type, null, $.proxy(function() {
this.hoverOnTip = true;
this.inState['override'] = true;
}, this));
$tip.on(eventOut + '.' + this.type, null, $.proxy(function() {
this.hoverOnTip = false;
this.timeout = setTimeout($.proxy(function() {
this.inState['override'] = false;
if (!this.$element.is(':hover'))
this.hide();
}, this), 100)
}, this));
$element.off(eventBlur + '.' + this.type);
$element.on(eventBlur + '.' + this.type, null, $.proxy(function() {
this.hoverOnTip = false;
this.inState['override'] = false;
if(this.hoverState != "in")
this.hide();
}, this));
}
$.fn.tooltip.Constructor.prototype.hide = function(callback) {
clearTimeout(this.timeout);
this.timeout = setTimeout($.proxy(function() {
if (!this.hoverOnTip) {
var $element = this.$element;
var ariaDescribedBy = $element.attr('aria-describedby');
var ariaDescribedByList = ariaDescribedBy ? ariaDescribedBy.split(' ') : [];
if(ariaDescribedByList.length > 1)
$element.off('hidden.bs.tooltip').on('hidden.bs.tooltip', null,  $.proxy(function () {
var tipId = this.tip().attr('id');
if(ariaDescribedByList.indexOf(tipId) !== -1) {
ariaDescribedByList.splice(ariaDescribedByList.indexOf(tipId), 1);
if(ariaDescribedByList.length)
$element.attr('aria-describedby', ariaDescribedByList.join(' '));
else
$element.removeAttr('aria-describedby');
}
}, this));
this.inState['override'] = false;
toolTipHide.apply(this, arguments);
}
}, this), 100);
}
}
}())
;
/*! RESOURCE: /scripts/formatting.js */
function formatPhone(field) {
field.value = trim(field.value);
var ov = field.value;
var v = "";
var x = -1;
if (0 < ov.length && '+' != ov.charAt(0)) {
var n = 0;
if ('1' == ov.charAt(0))
ov = ov.substring(1, ov.length);
for (var i = 0; i < ov.length; i++) {
var ch = ov.charAt(i);
if (ch >= '0' && ch <= '9') {
if (n == 0)
v += "(";
else if (n == 3)
v += ") ";
else if (n == 6)
v += "-";
v += ch;
n++;
}
if (! (ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
x = i;
break;
}
}
if (x >= 0)
v += " " + ov.substring(x, ov.length);
if (n == 10 && v.length <= 40)
field.value = v;
}
return true;
}
function formatClean(num) {
var sVal = '';
var nVal = num.length;
var sChar = '';
var nChar = '';
try {
for (var i = 0; i < nVal; i++) {
sChar = num.charAt(i);
nChar = sChar.charCodeAt(0);
if (sChar == '-' || sChar == getDecimalSeparator() || ((nChar >= 48) && (nChar <= 57)))
sVal += num.charAt(i);
}
}
catch (exception) {
alertError("formatClean", exception);
}
return sVal;
}
function formatCurrency(num) {
var sVal = '';
var minus = '';
if (num.lastIndexOf("-") == 0)
minus = '-';
if (num.lastIndexOf(".") < 0)
num = num + '00';
num = formatClean(num);
sVal = minus + formatDollar(num, getGroupingSeparator()) + getDecimalSeparator() + formatCents(num);
return sVal;
}
function formatNumber(num) {
if (num.length == 0)
return num;
num = num + "";
var sVal = '';
var minus = '';
var samount = '';
try {
if (num.lastIndexOf("-") == 0)
minus = '-';
num = formatClean(num);
if (num.indexOf("-") == 0)
num = num.substring(1);
num = "0" + num;
var fraction = parseFraction(num + "");
num = parseInt(num, 10);
samount = num + "";
for (var i = 0; i < Math.floor((samount.length - (1 + i)) / 3); i++)
samount = samount.substring(0, samount.length - (4 * i + 3)) + getGroupingSeparator() + samount.substring(samount.length - (4 * i + 3));
if (fraction.length > 0) {
fraction = getDecimalSeparator() + fraction;
samount += fraction;
}
} catch (exception) {
alertError("Format Number", exception);
}
return minus + samount;
}
function parseFraction(num) {
var index = num.indexOf(getDecimalSeparator());
if (index == -1)
return "";
return num.substring(index + 1);
}
function formatCents(amount) {
var cents = '';
try {
amount = parseInt(amount, 10);
var samount = amount + "";
if (samount.length == 0)
return '00';
if (samount.length == 1)
return '0' + samount;
if (samount.length == 2)
return samount;
cents = samount.substring(samount.length - 2, samount.length);
}
catch (exception) {
alertError("Format Cents", e);
}
return cents;
}
function formatDollar(amount) {
var samount = "";
try {
amount = parseInt(amount, 10);
samount = amount + "";
if (samount.length < 3)
return 0;
samount = samount.substring(0, samount.length - 2);
for (var i = 0; i < Math.floor((samount.length - (1 + i)) / 3); i++)
samount = samount.substring(0, samount.length - (4 * i + 3)) + getGroupingSeparator() + samount.substring(samount.length - (4 * i + 3));
}
catch (exception) {
alertError("Format Dollar", e);
}
return samount;
}
function padLeft(value, width, fill) {
value = value + '';
while (value.length < width)
value = fill + value;
return value;
}
function getDecimalSeparator() {
if (g_user_decimal_separator)
return g_user_decimal_separator;
return ".";
}
function getGroupingSeparator() {
if (g_user_grouping_separator)
return g_user_grouping_separator;
return ",";
}
function alertError(MethodName, e) {
if (e.description == null)
alert(MethodName + " Exception: " + e.message);
else
alert(MethodName + " Exception: " + e.description);
}
;
/*! RESOURCE: /scripts/iconset-fontawesome.js */
(function ($) {
$.iconset_fontawesome = {
iconClass: 'fa',
iconClassFix: 'fa-',
icons: [
'',
'glass',
'music',
'search',
'envelope-o',
'heart',
'star',
'star-o',
'user',
'film',
'th-large',
'th',
'th-list',
'check',
'times',
'search-plus',
'search-minus',
'power-off',
'signal',
'cog',
'trash-o',
'home',
'file-o',
'clock-o',
'road',
'download',
'arrow-circle-o-down',
'arrow-circle-o-up',
'inbox',
'play-circle-o',
'repeat',
'refresh',
'list-alt',
'lock',
'flag',
'headphones',
'volume-off',
'volume-down',
'volume-up',
'qrcode',
'barcode',
'tag',
'tags',
'book',
'bookmark',
'print',
'camera',
'font',
'bold',
'italic',
'text-height',
'text-width',
'align-left',
'align-center',
'align-right',
'align-justify',
'list',
'outdent',
'indent',
'video-camera',
'picture-o',
'pencil',
'map-marker',
'adjust',
'tint',
'pencil-square-o',
'share-square-o',
'check-square-o',
'arrows',
'step-backward',
'fast-backward',
'backward',
'play',
'pause',
'stop',
'forward',
'fast-forward',
'step-forward',
'eject',
'chevron-left',
'chevron-right',
'plus-circle',
'minus-circle',
'times-circle',
'check-circle',
'question-circle',
'info-circle',
'crosshairs',
'times-circle-o',
'check-circle-o',
'ban',
'arrow-left',
'arrow-right',
'arrow-up',
'arrow-down',
'share',
'expand',
'compress',
'plus',
'minus',
'asterisk',
'exclamation-circle',
'gift',
'leaf',
'fire',
'eye',
'eye-slash',
'exclamation-triangle',
'plane',
'calendar',
'random',
'comment',
'magnet',
'chevron-up',
'chevron-down',
'retweet',
'shopping-cart',
'folder',
'folder-open',
'arrows-v',
'arrows-h',
'bar-chart',
'twitter-square',
'facebook-square',
'camera-retro',
'key',
'cogs',
'comments',
'thumbs-o-up',
'thumbs-o-down',
'star-half',
'heart-o',
'sign-out',
'linkedin-square',
'thumb-tack',
'external-link',
'sign-in',
'trophy',
'github-square',
'upload',
'lemon-o',
'phone',
'square-o',
'bookmark-o',
'phone-square',
'twitter',
'facebook',
'github',
'unlock',
'credit-card',
'rss',
'hdd-o',
'bullhorn',
'bell',
'certificate',
'hand-o-right',
'hand-o-left',
'hand-o-up',
'hand-o-down',
'arrow-circle-left',
'arrow-circle-right',
'arrow-circle-up',
'arrow-circle-down',
'globe',
'wrench',
'tasks',
'filter',
'briefcase',
'arrows-alt',
'users',
'link',
'cloud',
'flask',
'scissors',
'files-o',
'paperclip',
'floppy-o',
'square',
'bars',
'list-ul',
'list-ol',
'strikethrough',
'underline',
'table',
'magic',
'truck',
'pinterest',
'pinterest-square',
'google-plus-square',
'google-plus',
'money',
'caret-down',
'caret-up',
'caret-left',
'caret-right',
'columns',
'sort',
'sort-desc',
'sort-asc',
'envelope',
'linkedin',
'undo',
'gavel',
'tachometer',
'comment-o',
'comments-o',
'bolt',
'sitemap',
'umbrella',
'clipboard',
'lightbulb-o',
'exchange',
'cloud-download',
'cloud-upload',
'user-md',
'stethoscope',
'suitcase',
'bell-o',
'coffee',
'cutlery',
'file-text-o',
'building-o',
'hospital-o',
'ambulance',
'medkit',
'fighter-jet',
'beer',
'h-square',
'plus-square',
'angle-double-left',
'angle-double-right',
'angle-double-up',
'angle-double-down',
'angle-left',
'angle-right',
'angle-up',
'angle-down',
'desktop',
'laptop',
'tablet',
'mobile',
'circle-o',
'quote-left',
'quote-right',
'spinner',
'circle',
'reply',
'github-alt',
'folder-o',
'folder-open-o',
'smile-o',
'frown-o',
'meh-o',
'gamepad',
'keyboard-o',
'flag-o',
'flag-checkered',
'terminal',
'code',
'reply-all',
'star-half-o',
'location-arrow',
'crop',
'code-fork',
'chain-broken',
'question',
'info',
'exclamation',
'superscript',
'subscript',
'eraser',
'puzzle-piece',
'microphone',
'microphone-slash',
'shield',
'calendar-o',
'fire-extinguisher',
'rocket',
'maxcdn',
'chevron-circle-left',
'chevron-circle-right',
'chevron-circle-up',
'chevron-circle-down',
'html5',
'css3',
'anchor',
'unlock-alt',
'bullseye',
'ellipsis-h',
'ellipsis-v',
'rss-square',
'play-circle',
'ticket',
'minus-square',
'minus-square-o',
'level-up',
'level-down',
'check-square',
'pencil-square',
'external-link-square',
'share-square',
'compass',
'caret-square-o-down',
'caret-square-o-up',
'caret-square-o-right',
'eur',
'gbp',
'usd',
'inr',
'jpy',
'rub',
'krw',
'btc',
'file',
'file-text',
'sort-alpha-asc',
'sort-alpha-desc',
'sort-amount-asc',
'sort-amount-desc',
'sort-numeric-asc',
'sort-numeric-desc',
'thumbs-up',
'thumbs-down',
'youtube-square',
'youtube',
'xing',
'xing-square',
'youtube-play',
'dropbox',
'stack-overflow',
'instagram',
'flickr',
'adn',
'bitbucket',
'bitbucket-square',
'tumblr',
'tumblr-square',
'long-arrow-down',
'long-arrow-up',
'long-arrow-left',
'long-arrow-right',
'apple',
'windows',
'android',
'linux',
'dribbble',
'skype',
'foursquare',
'trello',
'female',
'male',
'gratipay',
'sun-o',
'moon-o',
'archive',
'bug',
'vk',
'weibo',
'renren',
'pagelines',
'stack-exchange',
'arrow-circle-o-right',
'arrow-circle-o-left',
'caret-square-o-left',
'dot-circle-o',
'wheelchair',
'vimeo-square',
'try',
'plus-square-o',
'space-shuttle',
'slack',
'envelope-square',
'wordpress',
'openid',
'university',
'graduation-cap',
'yahoo',
'google',
'reddit',
'reddit-square',
'stumbleupon-circle',
'stumbleupon',
'delicious',
'digg',
'pied-piper-pp',
'pied-piper-alt',
'drupal',
'joomla',
'language',
'fax',
'building',
'child',
'paw',
'spoon',
'cube',
'cubes',
'behance',
'behance-square',
'steam',
'steam-square',
'recycle',
'car',
'taxi',
'tree',
'spotify',
'deviantart',
'soundcloud',
'database',
'file-pdf-o',
'file-word-o',
'file-excel-o',
'file-powerpoint-o',
'file-image-o',
'file-archive-o',
'file-audio-o',
'file-video-o',
'file-code-o',
'vine',
'codepen',
'jsfiddle',
'life-ring',
'circle-o-notch',
'rebel',
'empire',
'git-square',
'git',
'hacker-news',
'tencent-weibo',
'qq',
'weixin',
'paper-plane',
'paper-plane-o',
'history',
'circle-thin',
'header',
'paragraph',
'sliders',
'share-alt',
'share-alt-square',
'bomb',
'futbol-o',
'tty',
'binoculars',
'plug',
'slideshare',
'twitch',
'yelp',
'newspaper-o',
'wifi',
'calculator',
'paypal',
'google-wallet',
'cc-visa',
'cc-mastercard',
'cc-discover',
'cc-amex',
'cc-paypal',
'cc-stripe',
'bell-slash',
'bell-slash-o',
'trash',
'copyright',
'at',
'eyedropper',
'paint-brush',
'birthday-cake',
'area-chart',
'pie-chart',
'line-chart',
'lastfm',
'lastfm-square',
'toggle-off',
'toggle-on',
'bicycle',
'bus',
'ioxhost',
'angellist',
'cc',
'ils',
'meanpath',
'buysellads',
'connectdevelop',
'dashcube',
'forumbee',
'leanpub',
'sellsy',
'shirtsinbulk',
'simplybuilt',
'skyatlas',
'cart-plus',
'cart-arrow-down',
'diamond',
'ship',
'user-secret',
'motorcycle',
'street-view',
'heartbeat',
'venus',
'mars',
'mercury',
'transgender',
'transgender-alt',
'venus-double',
'mars-double',
'venus-mars',
'mars-stroke',
'mars-stroke-v',
'mars-stroke-h',
'neuter',
'genderless',
'facebook-official',
'pinterest-p',
'whatsapp',
'server',
'user-plus',
'user-times',
'bed',
'viacoin',
'train',
'subway',
'medium',
'y-combinator',
'optin-monster',
'opencart',
'expeditedssl',
'battery-full',
'battery-three-quarters',
'battery-half',
'battery-quarter',
'battery-empty',
'mouse-pointer',
'i-cursor',
'object-group',
'object-ungroup',
'sticky-note',
'sticky-note-o',
'cc-jcb',
'cc-diners-club',
'clone',
'balance-scale',
'hourglass-o',
'hourglass-start',
'hourglass-half',
'hourglass-end',
'hourglass',
'hand-rock-o',
'hand-paper-o',
'hand-scissors-o',
'hand-lizard-o',
'hand-spock-o',
'hand-pointer-o',
'hand-peace-o',
'trademark',
'registered',
'creative-commons',
'gg',
'gg-circle',
'tripadvisor',
'odnoklassniki',
'odnoklassniki-square',
'get-pocket',
'wikipedia-w',
'safari',
'chrome',
'firefox',
'opera',
'internet-explorer',
'television',
'contao',
'500px',
'amazon',
'calendar-plus-o',
'calendar-minus-o',
'calendar-times-o',
'calendar-check-o',
'industry',
'map-pin',
'map-signs',
'map-o',
'map',
'commenting',
'commenting-o',
'houzz',
'vimeo',
'black-tie',
'fonticons',
'reddit-alien',
'edge',
'credit-card-alt',
'codiepie',
'modx',
'fort-awesome',
'usb',
'product-hunt',
'mixcloud',
'scribd',
'pause-circle',
'pause-circle-o',
'stop-circle',
'stop-circle-o',
'shopping-bag',
'shopping-basket',
'hashtag',
'bluetooth',
'bluetooth-b',
'percent',
'gitlab',
'wpbeginner',
'wpforms',
'envira',
'universal-access',
'wheelchair-alt',
'question-circle-o',
'blind',
'audio-description',
'volume-control-phone',
'braille',
'assistive-listening-systems',
'american-sign-language-interpreting',
'deaf',
'glide',
'glide-g',
'sign-language',
'low-vision',
'viadeo',
'viadeo-square',
'snapchat',
'snapchat-ghost',
'snapchat-square',
'pied-piper',
'first-order',
'yoast',
'themeisle',
'google-plus-official',
'font-awesome',
'handshake-o',
'envelope-open',
'envelope-open-o',
'linode',
'address-book',
'address-book-o',
'address-card',
'address-card-o',
'user-circle',
'user-circle-o',
'user-o',
'id-badge',
'id-card',
'id-card-o',
'quora',
'free-code-camp',
'telegram',
'thermometer-full',
'thermometer-three-quarters',
'thermometer-half',
'thermometer-quarter',
'thermometer-empty',
'shower',
'bath',
'podcast',
'window-maximize',
'window-minimize',
'window-restore',
'window-close',
'window-close-o',
'bandcamp',
'grav',
'etsy',
'imdb',
'ravelry',
'eercast',
'microchip',
'snowflake-o',
'superpowers',
'wpexplorer',
'meetup'
]
};
})(jQuery);
;
/*! RESOURCE: /scripts/bootstrap-iconpicker.js */
;(function($){ "use strict";
var Iconpicker = function (element, options) {
this.$element = $(element);
this.options  = $.extend({}, Iconpicker.DEFAULTS, this.$element.data());
this.options  = $.extend({}, this.options, options);
};
Iconpicker.ICONSET_EMPTY = {
iconClass: '',
iconClassFix: '',
icons: []
};
Iconpicker.ICONSET = {
_custom: null,
elusiveicon: $.iconset_elusiveicon || Iconpicker.ICONSET_EMPTY,
fontawesome: $.iconset_fontawesome || Iconpicker.ICONSET_EMPTY,
ionicon: $.iconset_ionicon || Iconpicker.ICONSET_EMPTY,
glyphicon: $.iconset_glyphicon || Iconpicker.ICONSET_EMPTY,
mapicon: $.iconset_mapicon || Iconpicker.ICONSET_EMPTY,
materialdesign: $.iconset_materialdesign || Iconpicker.ICONSET_EMPTY,
octicon: $.iconset_octicon || Iconpicker.ICONSET_EMPTY,
typicon: $.iconset_typicon || Iconpicker.ICONSET_EMPTY,
weathericon: $.iconset_weathericon || Iconpicker.ICONSET_EMPTY
};
Iconpicker.DEFAULTS = {
align: 'center',
arrowClass: 'btn-primary',
arrowNextIconClass: 'glyphicon glyphicon-arrow-right',
arrowPrevIconClass: 'glyphicon glyphicon-arrow-left',
cols: 4,
icon: '',
iconset: 'glyphicon',
header: true,
labelHeader: '{0} / {1}',
footer: true,
labelFooter: '{0} - {1} of {2}',
placement: 'bottom',
rows: 4,
search: true,
searchText: 'Search icon',
selectedClass: 'btn-warning',
unselectedClass: 'btn-default'
};
Iconpicker.prototype.bindEvents = function () {
var op = this.options;
var el = this;
op.table.find('.btn-previous, .btn-next').off('click').on('click', function(e) {
if ($(this).hasClass('disabled'))
return;
e.preventDefault();
var inc = parseInt($(this).val(), 10);
el.changeList(op.page + inc);
});
op.table.find('.btn-icon').off('click').on('click', function(e) {
e.preventDefault();
el.select($(this).val());
if(op.inline === false){
el.$element.popover('destroy');
op.origEl.focus();
}
else{
op.table.find('i.' + $(this).val()).parent().addClass(op.selectedClass);
}
});
op.table.find('.search-control').off('keyup').on('keyup', function(e) {
if (e.which != 9)
el.changeList(1);
});
op.table.off('keyup').on('keyup', function(e) {
if (e.which == 27) {
el.$element.popover('destroy');
op.origEl.focus();
}
});
};
Iconpicker.prototype.changeList = function (page) {
this.filterIcons();
this.updateLabels(page);
this.updateIcons(page);
this.options.page = page;
this.bindEvents();
};
Iconpicker.prototype.filterIcons = function () {
var op = this.options;
var search = op.table.find('.search-control').val();
if (search === "") {
op.icons = Iconpicker.ICONSET[op.iconset].icons;
}
else {
var result = [];
$.each(Iconpicker.ICONSET[op.iconset].icons, function(i, v) {
if (v.indexOf(search) > -1) {
result.push(v);
}
});
op.icons = result;
}
};
Iconpicker.prototype.removeAddClass = function (target, remove, add) {
this.options.table.find(target).removeClass(remove).addClass(add);
return add;
};
Iconpicker.prototype.reset = function () {
this.updatePicker();
this.changeList(1);
};
Iconpicker.prototype.select = function (icon) {
var op = this.options;
var el = this.$element;
op.selected = $.inArray(icon.replace(op.iconClassFix, ''), op.icons);
if (op.selected === -1) {
op.selected = 0;
icon = op.iconClassFix + op.icons[op.selected];
}
if (icon !== '' && op.selected >= 0) {
op.icon = icon;
if(op.inline === false){
el.find('input').val(icon);
el.find('i').attr('class', '').addClass(op.iconClass).addClass(icon);
}
if(icon === op.iconClassFix){
el.trigger({ type: "change", icon: 'empty' });
}
else {
el.trigger({ type: "change", icon: icon });
}
op.table.find('button.' + op.selectedClass).removeClass(op.selectedClass);
}
};
Iconpicker.prototype.switchPage = function (icon) {
var op = this.options;
op.selected = $.inArray(icon.replace(op.iconClassFix, ''), op.icons);
if(op.selected >= 0) {
var page = Math.ceil((op.selected + 1) / this.totalIconsPerPage());
this.changeList(page);
}
if(icon === ''){
op.table.find('i.' + op.iconClassFix).parent().addClass(op.selectedClass);
}
else{
op.table.find('i.' + icon).parent().addClass(op.selectedClass);
}
};
Iconpicker.prototype.totalPages = function () {
return Math.ceil(this.totalIcons() / this.totalIconsPerPage());
};
Iconpicker.prototype.totalIcons = function () {
return this.options.icons.length;
};
Iconpicker.prototype.totalIconsPerPage = function () {
if(this.options.rows === 0){
return this.options.icons.length;
}
else{
return this.options.cols * this.options.rows;
}
};
Iconpicker.prototype.updateArrows = function (page) {
var op = this.options;
var total_pages = this.totalPages();
if (page === 1) {
op.table.find('.btn-previous').addClass('disabled');
}
else {
op.table.find('.btn-previous').removeClass('disabled');
}
if (page === total_pages || total_pages === 0) {
op.table.find('.btn-next').addClass('disabled');
}
else {
op.table.find('.btn-next').removeClass('disabled');
}
};
Iconpicker.prototype.updateIcons = function (page) {
var op = this.options;
var tbody = op.table.find('tbody').empty();
var offset = (page - 1) * this.totalIconsPerPage();
var length = op.rows;
if(op.rows === 0){
length = op.icons.length;
}
for (var i = 0; i < length; i++) {
var tr = $('<tr></tr>');
for (var j = 0; j < op.cols; j++) {
var pos = offset + (i * op.cols) + j;
var btn = $('<button class="btn ' + op.unselectedClass + ' btn-icon"></button>').hide();
if (pos < op.icons.length) {
var v = op.iconClassFix + op.icons[pos];
btn.val(v).attr('title', v).append('<i class="' + op.iconClass + ' ' + v + '"></i>').show();
if (op.icon === v) {
btn.addClass(op.selectedClass).addClass('btn-icon-selected');
}
}
tr.append($('<td></td>').append(btn));
}
tbody.append(tr);
}
};
Iconpicker.prototype.updateIconsCount = function () {
var op = this.options;
if(op.footer === true){
var icons_count = [
'<tr>',
'   <td colspan="' + op.cols + '" class="text-center">',
'       <span class="icons-count"></span>',
'   </td>',
'</tr>'
];
op.table.find('tfoot').empty().append(icons_count.join(''));
}
};
Iconpicker.prototype.updateLabels = function (page) {
var op = this.options;
var total_icons = this.totalIcons();
var total_pages = this.totalPages();
op.table.find('.page-count').html(op.labelHeader.replace('{0}', (total_pages === 0 ) ? 0 : page).replace('{1}', total_pages));
var offset = (page - 1) * this.totalIconsPerPage();
var total = page * this.totalIconsPerPage();
op.table.find('.icons-count').html(op.labelFooter.replace('{0}', total_icons ? offset + 1 : 0).replace('{1}', (total < total_icons) ? total: total_icons).replace('{2}', total_icons));
this.updateArrows(page);
};
Iconpicker.prototype.updatePagesCount = function () {
var op = this.options;
if(op.header === true){
var tr = $('<tr></tr>');
for (var i = 0; i < op.cols; i++) {
var td = $('<td class="text-center"></td>');
if (i === 0 || i === op.cols - 1) {
var arrow = [
'<button class="btn btn-arrow ' + ((i === 0) ? 'btn-previous' : 'btn-next') + ' ' + op.arrowClass + '" value="' + ((i === 0) ? -1 : 1) + '">',
'<span class="' + ((i === 0) ? op.arrowPrevIconClass : op.arrowNextIconClass) + '"></span>',
'</button>'
];
td.append(arrow.join(''));
tr.append(td);
}
else if (tr.find('.page-count').length === 0) {
td.attr('colspan', op.cols - 2).append('<span class="page-count"></span>');
tr.append(td);
}
}
op.table.find('thead').append(tr);
}
};
Iconpicker.prototype.updatePicker = function () {
var op = this.options;
if (op.cols < 4) {
throw 'Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = ' + op.cols + ']';
}
else if (op.rows < 0) {
throw 'Iconpicker => The number of rows must be greater than or equal to 0. [option.rows = ' + op.rows + ']';
}
else {
this.updateSearch();
this.updatePagesCount();
this.updateIconsCount();
}
};
Iconpicker.prototype.updateSearch = function () {
var op = this.options;
var search = [
'<tr style="display: table-row;">',
'   <td colspan="' + op.cols + '">',
'       <input type="text" class="form-control search-control" style="width: ' + op.cols * 39 + 'px;" placeholder="' + op.searchText + '">',
'   </td>',
'</tr>'
];
search = $(search.join(''));
if (op.search === true) {
search.show();
}
else {
search.hide();
}
op.table.find('thead').empty().append(search);
};
Iconpicker.prototype.setAlign = function (value) {
this.$element.removeClass(this.options.align).addClass(value);
this.options.align = value;
};
Iconpicker.prototype.setArrowClass = function (value) {
this.options.arrowClass = this.removeAddClass('.btn-arrow', this.options.arrowClass, value);
};
Iconpicker.prototype.setArrowNextIconClass = function (value) {
this.options.arrowNextIconClass = this.removeAddClass('.btn-next > span', this.options.arrowNextIconClass, value);
};
Iconpicker.prototype.setArrowPrevIconClass = function (value) {
this.options.arrowPrevIconClass = this.removeAddClass('.btn-previous > span', this.options.arrowPrevIconClass, value);
};
Iconpicker.prototype.setCols = function (value) {
this.options.cols = value;
this.reset();
};
Iconpicker.prototype.setFooter = function (value) {
var footer = this.options.table.find('tfoot');
if (value === true) {
footer.show();
}
else {
footer.hide();
}
this.options.footer = value;
};
Iconpicker.prototype.setHeader = function (value) {
var header = this.options.table.find('thead');
if (value === true) {
header.show();
}
else {
header.hide();
}
this.options.header = value;
};
Iconpicker.prototype.setIcon = function (value) {
this.select(value);
};
Iconpicker.prototype.setIconset = function (value) {
var op = this.options;
if ($.isPlainObject(value)) {
Iconpicker.ICONSET._custom = $.extend(Iconpicker.ICONSET_EMPTY, value);
op.iconset = '_custom';
}
else if (!Iconpicker.ICONSET.hasOwnProperty(value)) {
op.iconset = Iconpicker.DEFAULTS.iconset;
}
else {
op.iconset = value;
}
op = $.extend(op, Iconpicker.ICONSET[op.iconset]);
this.reset();
this.select(op.icon);
};
Iconpicker.prototype.setLabelHeader = function (value) {
this.options.labelHeader = value;
this.updateLabels(this.options.page);
};
Iconpicker.prototype.setLabelFooter = function (value) {
this.options.labelFooter = value;
this.updateLabels(this.options.page);
};
Iconpicker.prototype.setPlacement = function (value) {
this.options.placement = value;
};
Iconpicker.prototype.setRows = function (value) {
this.options.rows = value;
this.reset();
};
Iconpicker.prototype.setSearch = function (value) {
var search = this.options.table.find('.search-control');
if (value === true) {
search.show();
}
else {
search.hide();
}
search.val('');
this.changeList(1);
this.options.search = value;
};
Iconpicker.prototype.setSearchText = function (value) {
this.options.table.find('.search-control').attr('placeholder', value);
this.options.searchText = value;
};
Iconpicker.prototype.setSelectedClass = function (value) {
this.options.selectedClass = this.removeAddClass('.btn-icon-selected', this.options.selectedClass, value);
};
Iconpicker.prototype.setUnselectedClass = function (value) {
this.options.unselectedClass = this.removeAddClass('.btn-icon', this.options.unselectedClass, value);
};
var old = $.fn.iconpicker;
$.fn.iconpicker = function (option, params) {
return this.each(function () {
var $this = $(this);
var data = $this.data('bs.iconpicker');
var options = typeof option === 'object' && option;
if (!data) {
$this.data('bs.iconpicker', (data = new Iconpicker(this, options)));
}
if (typeof option === 'string') {
if (typeof data[option] === 'undefined') {
throw 'Iconpicker => The "' + option + '" method does not exists.';
}
else {
data[option](params);
}
}
else{
var op = data.options;
op = $.extend(op, {
inline: false,
page: 1,
selected: -1,
table: $('<table class="table-icons"><thead></thead><tbody></tbody><tfoot></tfoot></table>')
});
var name = (typeof $this.attr('name') !== 'undefined') ? 'name="' + $this.attr('name') + '"' : '';
if($this.prop('tagName') === 'BUTTON'){
op.origEl = $this;
$this.empty()
.append('<i></i>')
.append('<input type="hidden" ' + name + '></input>')
.append('<span class="caret"></span>')
.addClass('iconpicker');
data.setIconset(op.iconset);
$this.on('click', function(e) {
e.preventDefault();
if ($this.data('bs.popover')) {
$this.popover('destroy');
return;
}
$this.popover({
animation: false,
trigger: 'manual',
html: true,
content: op.table,
container: 'body',
placement: op.placement
}).on('shown.bs.popover', function () {
data.switchPage(op.icon);
data.bindEvents();
op.table.find('.search-control').focus();
});
$this.data('bs.popover').tip().addClass('iconpicker-popover');
$this.popover('show');
}).keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
$(this).click();
}
});
}
else{
op.inline = true;
data.setIconset(op.iconset);
$this.empty()
.append('<input type="hidden" ' + name + '></input>')
.append(op.table)
.addClass('iconpicker')
.addClass(op.align);
data.switchPage(op.icon);
data.bindEvents();
}
}
});
};
$.fn.iconpicker.Constructor = Iconpicker;
$.fn.iconpicker.noConflict = function () {
$.fn.iconpicker = old;
return this;
};
$(document).on('click', 'body', function (e) {
$('.iconpicker').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('destroy');
}
});
});
$('button[role="iconpicker"],div[role="iconpicker"],button[class="iconpicker"]').iconpicker();
})(jQuery);
;
/*! RESOURCE: /scripts/angularjs-1.4/thirdparty/angular-ui-bootstrap/ui-bootstrap-tpls-1.1.2.js */
angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.debounce","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]);
angular.module("ui.bootstrap.tpls", ["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/popup.html","uib/template/datepicker/year.html","uib/template/modal/backdrop.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]);
angular.module('ui.bootstrap.collapse', [])
.directive('uibCollapse', ['$animate', '$q', '$parse', '$injector', function($animate, $q, $parse, $injector) {
var $animateCss = $injector.has('$animateCss') ? $injector.get('$animateCss') : null;
return {
link: function(scope, element, attrs) {
var expandingExpr = $parse(attrs.expanding),
expandedExpr = $parse(attrs.expanded),
collapsingExpr = $parse(attrs.collapsing),
collapsedExpr = $parse(attrs.collapsed);
if (!scope.$eval(attrs.uibCollapse)) {
element.addClass('in')
.addClass('collapse')
.attr('aria-expanded', true)
.attr('aria-hidden', false)
.css({height: 'auto'});
}
function expand() {
if (element.hasClass('collapse') && element.hasClass('in')) {
return;
}
$q.resolve(expandingExpr(scope))
.then(function() {
element.removeClass('collapse')
.addClass('collapsing')
.attr('aria-expanded', true)
.attr('aria-hidden', false);
if ($animateCss) {
$animateCss(element, {
addClass: 'in',
easing: 'ease',
to: { height: element[0].scrollHeight + 'px' }
}).start()['finally'](expandDone);
} else {
$animate.addClass(element, 'in', {
to: { height: element[0].scrollHeight + 'px' }
}).then(expandDone);
}
});
}
function expandDone() {
element.removeClass('collapsing')
.addClass('collapse')
.css({height: 'auto'});
expandedExpr(scope);
}
function collapse() {
if (!element.hasClass('collapse') && !element.hasClass('in')) {
return collapseDone();
}
$q.resolve(collapsingExpr(scope))
.then(function() {
element
.css({height: element[0].scrollHeight + 'px'})
.removeClass('collapse')
.addClass('collapsing')
.attr('aria-expanded', false)
.attr('aria-hidden', true);
if ($animateCss) {
$animateCss(element, {
removeClass: 'in',
to: {height: '0'}
}).start()['finally'](collapseDone);
} else {
$animate.removeClass(element, 'in', {
to: {height: '0'}
}).then(collapseDone);
}
});
}
function collapseDone() {
element.css({height: '0'});
element.removeClass('collapsing')
.addClass('collapse');
collapsedExpr(scope);
}
scope.$watch(attrs.uibCollapse, function(shouldCollapse) {
if (shouldCollapse) {
collapse();
} else {
expand();
}
});
}
};
}]);
angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
.constant('uibAccordionConfig', {
closeOthers: true
})
.controller('UibAccordionController', ['$scope', '$attrs', 'uibAccordionConfig', function($scope, $attrs, accordionConfig) {
this.groups = [];
this.closeOthers = function(openGroup) {
var closeOthers = angular.isDefined($attrs.closeOthers) ?
$scope.$eval($attrs.closeOthers) : accordionConfig.closeOthers;
if (closeOthers) {
angular.forEach(this.groups, function(group) {
if (group !== openGroup) {
group.isOpen = false;
}
});
}
};
this.addGroup = function(groupScope) {
var that = this;
this.groups.push(groupScope);
groupScope.$on('$destroy', function(event) {
that.removeGroup(groupScope);
});
};
this.removeGroup = function(group) {
var index = this.groups.indexOf(group);
if (index !== -1) {
this.groups.splice(index, 1);
}
};
}])
.directive('uibAccordion', function() {
return {
controller: 'UibAccordionController',
controllerAs: 'accordion',
transclude: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/accordion/accordion.html';
}
};
})
.directive('uibAccordionGroup', function() {
return {
require: '^uibAccordion',
transclude: true,
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/accordion/accordion-group.html';
},
scope: {
heading: '@',
isOpen: '=?',
isDisabled: '=?'
},
controller: function() {
this.setHeading = function(element) {
this.heading = element;
};
},
link: function(scope, element, attrs, accordionCtrl) {
accordionCtrl.addGroup(scope);
scope.openClass = attrs.openClass || 'panel-open';
scope.panelClass = attrs.panelClass || 'panel-default';
scope.$watch('isOpen', function(value) {
element.toggleClass(scope.openClass, !!value);
if (value) {
accordionCtrl.closeOthers(scope);
}
});
scope.toggleOpen = function($event) {
if (!scope.isDisabled) {
if (!$event || $event.which === 32) {
scope.isOpen = !scope.isOpen;
}
}
};
var id = 'accordiongroup-' + scope.$id + '-' + Math.floor(Math.random() * 10000);
scope.headingId = id + '-tab';
scope.panelId = id + '-panel';
}
};
})
.directive('uibAccordionHeading', function() {
return {
transclude: true,
template: '',
replace: true,
require: '^uibAccordionGroup',
link: function(scope, element, attrs, accordionGroupCtrl, transclude) {
accordionGroupCtrl.setHeading(transclude(scope, angular.noop));
}
};
})
.directive('uibAccordionTransclude', function() {
return {
require: '^uibAccordionGroup',
link: function(scope, element, attrs, controller) {
scope.$watch(function() { return controller[attrs.uibAccordionTransclude]; }, function(heading) {
if (heading) {
element.find('span').html('');
element.find('span').append(heading);
}
});
}
};
});
angular.module('ui.bootstrap.alert', [])
.controller('UibAlertController', ['$scope', '$attrs', '$interpolate', '$timeout', function($scope, $attrs, $interpolate, $timeout) {
$scope.closeable = !!$attrs.close;
var dismissOnTimeout = angular.isDefined($attrs.dismissOnTimeout) ?
$interpolate($attrs.dismissOnTimeout)($scope.$parent) : null;
if (dismissOnTimeout) {
$timeout(function() {
$scope.close();
}, parseInt(dismissOnTimeout, 10));
}
}])
.directive('uibAlert', function() {
return {
controller: 'UibAlertController',
controllerAs: 'alert',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/alert/alert.html';
},
transclude: true,
replace: true,
scope: {
type: '@',
close: '&'
}
};
});
angular.module('ui.bootstrap.buttons', [])
.constant('uibButtonConfig', {
activeClass: 'active',
toggleEvent: 'click'
})
.controller('UibButtonsController', ['uibButtonConfig', function(buttonConfig) {
this.activeClass = buttonConfig.activeClass || 'active';
this.toggleEvent = buttonConfig.toggleEvent || 'click';
}])
.directive('uibBtnRadio', ['$parse', function($parse) {
return {
require: ['uibBtnRadio', 'ngModel'],
controller: 'UibButtonsController',
controllerAs: 'buttons',
link: function(scope, element, attrs, ctrls) {
var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1];
var uncheckableExpr = $parse(attrs.uibUncheckable);
element.find('input').css({display: 'none'});
ngModelCtrl.$render = function() {
element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, scope.$eval(attrs.uibBtnRadio)));
};
element.on(buttonsCtrl.toggleEvent, function() {
if (attrs.disabled) {
return;
}
var isActive = element.hasClass(buttonsCtrl.activeClass);
if (!isActive || angular.isDefined(attrs.uncheckable)) {
scope.$apply(function() {
ngModelCtrl.$setViewValue(isActive ? null : scope.$eval(attrs.uibBtnRadio));
ngModelCtrl.$render();
});
}
});
if (attrs.uibUncheckable) {
scope.$watch(uncheckableExpr, function(uncheckable) {
attrs.$set('uncheckable', uncheckable ? '' : null);
});
}
}
};
}])
.directive('uibBtnCheckbox', function() {
return {
require: ['uibBtnCheckbox', 'ngModel'],
controller: 'UibButtonsController',
controllerAs: 'button',
link: function(scope, element, attrs, ctrls) {
var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1];
element.find('input').css({display: 'none'});
function getTrueValue() {
return getCheckboxValue(attrs.btnCheckboxTrue, true);
}
function getFalseValue() {
return getCheckboxValue(attrs.btnCheckboxFalse, false);
}
function getCheckboxValue(attribute, defaultValue) {
return angular.isDefined(attribute) ? scope.$eval(attribute) : defaultValue;
}
ngModelCtrl.$render = function() {
element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, getTrueValue()));
};
element.on(buttonsCtrl.toggleEvent, function() {
if (attrs.disabled) {
return;
}
scope.$apply(function() {
ngModelCtrl.$setViewValue(element.hasClass(buttonsCtrl.activeClass) ? getFalseValue() : getTrueValue());
ngModelCtrl.$render();
});
});
}
};
});
angular.module('ui.bootstrap.carousel', [])
.controller('UibCarouselController', ['$scope', '$element', '$interval', '$timeout', '$animate', function($scope, $element, $interval, $timeout, $animate) {
var self = this,
slides = self.slides = $scope.slides = [],
SLIDE_DIRECTION = 'uib-slideDirection',
currentIndex = -1,
currentInterval, isPlaying, bufferedTransitions = [];
self.currentSlide = null;
var destroyed = false;
self.addSlide = function(slide, element) {
slide.$element = element;
slides.push(slide);
if (slides.length === 1 || slide.active) {
if ($scope.$currentTransition) {
$scope.$currentTransition = null;
}
self.select(slides[slides.length - 1]);
if (slides.length === 1) {
$scope.play();
}
} else {
slide.active = false;
}
};
self.getCurrentIndex = function() {
if (self.currentSlide && angular.isDefined(self.currentSlide.index)) {
return +self.currentSlide.index;
}
return currentIndex;
};
self.next = $scope.next = function() {
var newIndex = (self.getCurrentIndex() + 1) % slides.length;
if (newIndex === 0 && $scope.noWrap()) {
$scope.pause();
return;
}
return self.select(getSlideByIndex(newIndex), 'next');
};
self.prev = $scope.prev = function() {
var newIndex = self.getCurrentIndex() - 1 < 0 ? slides.length - 1 : self.getCurrentIndex() - 1;
if ($scope.noWrap() && newIndex === slides.length - 1) {
$scope.pause();
return;
}
return self.select(getSlideByIndex(newIndex), 'prev');
};
self.removeSlide = function(slide) {
if (angular.isDefined(slide.index)) {
slides.sort(function(a, b) {
return +a.index > +b.index;
});
}
var bufferedIndex = bufferedTransitions.indexOf(slide);
if (bufferedIndex !== -1) {
bufferedTransitions.splice(bufferedIndex, 1);
}
var index = slides.indexOf(slide);
slides.splice(index, 1);
$timeout(function() {
if (slides.length > 0 && slide.active) {
if (index >= slides.length) {
self.select(slides[index - 1]);
} else {
self.select(slides[index]);
}
} else if (currentIndex > index) {
currentIndex--;
}
});
if (slides.length === 0) {
self.currentSlide = null;
clearBufferedTransitions();
}
};
self.select = $scope.select = function(nextSlide, direction) {
var nextIndex = $scope.indexOfSlide(nextSlide);
if (direction === undefined) {
direction = nextIndex > self.getCurrentIndex() ? 'next' : 'prev';
}
if (nextSlide && nextSlide !== self.currentSlide && !$scope.$currentTransition) {
goNext(nextSlide, nextIndex, direction);
} else if (nextSlide && nextSlide !== self.currentSlide && $scope.$currentTransition) {
bufferedTransitions.push(nextSlide);
nextSlide.active = false;
}
};
$scope.indexOfSlide = function(slide) {
return angular.isDefined(slide.index) ? +slide.index : slides.indexOf(slide);
};
$scope.isActive = function(slide) {
return self.currentSlide === slide;
};
$scope.pause = function() {
if (!$scope.noPause) {
isPlaying = false;
resetTimer();
}
};
$scope.play = function() {
if (!isPlaying) {
isPlaying = true;
restartTimer();
}
};
$scope.$on('$destroy', function() {
destroyed = true;
resetTimer();
});
$scope.$watch('noTransition', function(noTransition) {
$animate.enabled($element, !noTransition);
});
$scope.$watch('interval', restartTimer);
$scope.$watchCollection('slides', resetTransition);
function clearBufferedTransitions() {
while (bufferedTransitions.length) {
bufferedTransitions.shift();
}
}
function getSlideByIndex(index) {
if (angular.isUndefined(slides[index].index)) {
return slides[index];
}
for (var i = 0, l = slides.length; i < l; ++i) {
if (slides[i].index === index) {
return slides[i];
}
}
}
function goNext(slide, index, direction) {
if (destroyed) { return; }
angular.extend(slide, {direction: direction, active: true});
angular.extend(self.currentSlide || {}, {direction: direction, active: false});
if ($animate.enabled($element) && !$scope.$currentTransition &&
slide.$element && self.slides.length > 1) {
slide.$element.data(SLIDE_DIRECTION, slide.direction);
if (self.currentSlide && self.currentSlide.$element) {
self.currentSlide.$element.data(SLIDE_DIRECTION, slide.direction);
}
$scope.$currentTransition = true;
$animate.on('addClass', slide.$element, function(element, phase) {
if (phase === 'close') {
$scope.$currentTransition = null;
$animate.off('addClass', element);
if (bufferedTransitions.length) {
var nextSlide = bufferedTransitions.pop();
var nextIndex = $scope.indexOfSlide(nextSlide);
var nextDirection = nextIndex > self.getCurrentIndex() ? 'next' : 'prev';
clearBufferedTransitions();
goNext(nextSlide, nextIndex, nextDirection);
}
}
});
}
self.currentSlide = slide;
currentIndex = index;
restartTimer();
}
function resetTimer() {
if (currentInterval) {
$interval.cancel(currentInterval);
currentInterval = null;
}
}
function resetTransition(slides) {
if (!slides.length) {
$scope.$currentTransition = null;
clearBufferedTransitions();
}
}
function restartTimer() {
resetTimer();
var interval = +$scope.interval;
if (!isNaN(interval) && interval > 0) {
currentInterval = $interval(timerFn, interval);
}
}
function timerFn() {
var interval = +$scope.interval;
if (isPlaying && !isNaN(interval) && interval > 0 && slides.length) {
$scope.next();
} else {
$scope.pause();
}
}
}])
.directive('uibCarousel', function() {
return {
transclude: true,
replace: true,
controller: 'UibCarouselController',
controllerAs: 'carousel',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/carousel/carousel.html';
},
scope: {
interval: '=',
noTransition: '=',
noPause: '=',
noWrap: '&'
}
};
})
.directive('uibSlide', function() {
return {
require: '^uibCarousel',
transclude: true,
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/carousel/slide.html';
},
scope: {
active: '=?',
actual: '=?',
index: '=?'
},
link: function (scope, element, attrs, carouselCtrl) {
carouselCtrl.addSlide(scope, element);
scope.$on('$destroy', function() {
carouselCtrl.removeSlide(scope);
});
scope.$watch('active', function(active) {
if (active) {
carouselCtrl.select(scope);
}
});
}
};
})
.animation('.item', ['$animateCss',
function($animateCss) {
var SLIDE_DIRECTION = 'uib-slideDirection';
function removeClass(element, className, callback) {
element.removeClass(className);
if (callback) {
callback();
}
}
return {
beforeAddClass: function(element, className, done) {
if (className === 'active') {
var stopped = false;
var direction = element.data(SLIDE_DIRECTION);
var directionClass = direction === 'next' ? 'left' : 'right';
var removeClassFn = removeClass.bind(this, element,
directionClass + ' ' + direction, done);
element.addClass(direction);
$animateCss(element, {addClass: directionClass})
.start()
.done(removeClassFn);
return function() {
stopped = true;
};
}
done();
},
beforeRemoveClass: function (element, className, done) {
if (className === 'active') {
var stopped = false;
var direction = element.data(SLIDE_DIRECTION);
var directionClass = direction === 'next' ? 'left' : 'right';
var removeClassFn = removeClass.bind(this, element, directionClass, done);
$animateCss(element, {addClass: directionClass})
.start()
.done(removeClassFn);
return function() {
stopped = true;
};
}
done();
}
};
}]);
angular.module('ui.bootstrap.dateparser', [])
.service('uibDateParser', ['$log', '$locale', 'dateFilter', 'orderByFilter', function($log, $locale, dateFilter, orderByFilter) {
var SPECIAL_CHARACTERS_REGEXP = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
var localeId;
var formatCodeToRegex;
this.init = function() {
localeId = $locale.id;
this.parsers = {};
this.formatters = {};
formatCodeToRegex = [
{
key: 'yyyy',
regex: '\\d{4}',
apply: function(value) { this.year = +value; },
formatter: function(date) {
var _date = new Date();
_date.setFullYear(Math.abs(date.getFullYear()));
return dateFilter(_date, 'yyyy');
}
},
{
key: 'yy',
regex: '\\d{2}',
apply: function(value) { this.year = +value + 2000; },
formatter: function(date) {
var _date = new Date();
_date.setFullYear(Math.abs(date.getFullYear()));
return dateFilter(_date, 'yy');
}
},
{
key: 'y',
regex: '\\d{1,4}',
apply: function(value) { this.year = +value; },
formatter: function(date) {
var _date = new Date();
_date.setFullYear(Math.abs(date.getFullYear()));
return dateFilter(_date, 'y');
}
},
{
key: 'M!',
regex: '0?[1-9]|1[0-2]',
apply: function(value) { this.month = value - 1; },
formatter: function(date) {
var value = date.getMonth();
if (/^[0-9]$/.test(value)) {
return dateFilter(date, 'MM');
}
return dateFilter(date, 'M');
}
},
{
key: 'MMMM',
regex: $locale.DATETIME_FORMATS.MONTH.join('|'),
apply: function(value) { this.month = $locale.DATETIME_FORMATS.MONTH.indexOf(value); },
formatter: function(date) { return dateFilter(date, 'MMMM'); }
},
{
key: 'MMM',
regex: $locale.DATETIME_FORMATS.SHORTMONTH.join('|'),
apply: function(value) { this.month = $locale.DATETIME_FORMATS.SHORTMONTH.indexOf(value); },
formatter: function(date) { return dateFilter(date, 'MMM'); }
},
{
key: 'MM',
regex: '0[1-9]|1[0-2]',
apply: function(value) { this.month = value - 1; },
formatter: function(date) { return dateFilter(date, 'MM'); }
},
{
key: 'M',
regex: '[1-9]|1[0-2]',
apply: function(value) { this.month = value - 1; },
formatter: function(date) { return dateFilter(date, 'M'); }
},
{
key: 'd!',
regex: '[0-2]?[0-9]{1}|3[0-1]{1}',
apply: function(value) { this.date = +value; },
formatter: function(date) {
var value = date.getDate();
if (/^[1-9]$/.test(value)) {
return dateFilter(date, 'dd');
}
return dateFilter(date, 'd');
}
},
{
key: 'dd',
regex: '[0-2][0-9]{1}|3[0-1]{1}',
apply: function(value) { this.date = +value; },
formatter: function(date) { return dateFilter(date, 'dd'); }
},
{
key: 'd',
regex: '[1-2]?[0-9]{1}|3[0-1]{1}',
apply: function(value) { this.date = +value; },
formatter: function(date) { return dateFilter(date, 'd'); }
},
{
key: 'EEEE',
regex: $locale.DATETIME_FORMATS.DAY.join('|'),
formatter: function(date) { return dateFilter(date, 'EEEE'); }
},
{
key: 'EEE',
regex: $locale.DATETIME_FORMATS.SHORTDAY.join('|'),
formatter: function(date) { return dateFilter(date, 'EEE'); }
},
{
key: 'HH',
regex: '(?:0|1)[0-9]|2[0-3]',
apply: function(value) { this.hours = +value; },
formatter: function(date) { return dateFilter(date, 'HH'); }
},
{
key: 'hh',
regex: '0[0-9]|1[0-2]',
apply: function(value) { this.hours = +value; },
formatter: function(date) { return dateFilter(date, 'hh'); }
},
{
key: 'H',
regex: '1?[0-9]|2[0-3]',
apply: function(value) { this.hours = +value; },
formatter: function(date) { return dateFilter(date, 'H'); }
},
{
key: 'h',
regex: '[0-9]|1[0-2]',
apply: function(value) { this.hours = +value; },
formatter: function(date) { return dateFilter(date, 'h'); }
},
{
key: 'mm',
regex: '[0-5][0-9]',
apply: function(value) { this.minutes = +value; },
formatter: function(date) { return dateFilter(date, 'mm'); }
},
{
key: 'm',
regex: '[0-9]|[1-5][0-9]',
apply: function(value) { this.minutes = +value; },
formatter: function(date) { return dateFilter(date, 'm'); }
},
{
key: 'sss',
regex: '[0-9][0-9][0-9]',
apply: function(value) { this.milliseconds = +value; },
formatter: function(date) { return dateFilter(date, 'sss'); }
},
{
key: 'ss',
regex: '[0-5][0-9]',
apply: function(value) { this.seconds = +value; },
formatter: function(date) { return dateFilter(date, 'ss'); }
},
{
key: 's',
regex: '[0-9]|[1-5][0-9]',
apply: function(value) { this.seconds = +value; },
formatter: function(date) { return dateFilter(date, 's'); }
},
{
key: 'a',
regex: $locale.DATETIME_FORMATS.AMPMS.join('|'),
apply: function(value) {
if (this.hours === 12) {
this.hours = 0;
}
if (value === 'PM') {
this.hours += 12;
}
},
formatter: function(date) { return dateFilter(date, 'a'); }
},
{
key: 'Z',
regex: '[+-]\\d{4}',
apply: function(value) {
var matches = value.match(/([+-])(\d{2})(\d{2})/),
sign = matches[1],
hours = matches[2],
minutes = matches[3];
this.hours += toInt(sign + hours);
this.minutes += toInt(sign + minutes);
},
formatter: function(date) {
return dateFilter(date, 'Z');
}
},
{
key: 'ww',
regex: '[0-4][0-9]|5[0-3]',
formatter: function(date) { return dateFilter(date, 'ww'); }
},
{
key: 'w',
regex: '[0-9]|[1-4][0-9]|5[0-3]',
formatter: function(date) { return dateFilter(date, 'w'); }
},
{
key: 'GGGG',
regex: $locale.DATETIME_FORMATS.ERANAMES.join('|').replace(/\s/g, '\\s'),
formatter: function(date) { return dateFilter(date, 'GGGG'); }
},
{
key: 'GGG',
regex: $locale.DATETIME_FORMATS.ERAS.join('|'),
formatter: function(date) { return dateFilter(date, 'GGG'); }
},
{
key: 'GG',
regex: $locale.DATETIME_FORMATS.ERAS.join('|'),
formatter: function(date) { return dateFilter(date, 'GG'); }
},
{
key: 'G',
regex: $locale.DATETIME_FORMATS.ERAS.join('|'),
formatter: function(date) { return dateFilter(date, 'G'); }
}
];
};
this.init();
function createParser(format, func) {
var map = [], regex = format.split('');
var quoteIndex = format.indexOf('\'');
if (quoteIndex > -1) {
var inLiteral = false;
format = format.split('');
for (var i = quoteIndex; i < format.length; i++) {
if (inLiteral) {
if (format[i] === '\'') {
if (i + 1 < format.length && format[i+1] === '\'') {
format[i+1] = '$';
regex[i+1] = '';
} else {
regex[i] = '';
inLiteral = false;
}
}
format[i] = '$';
} else {
if (format[i] === '\'') {
format[i] = '$';
regex[i] = '';
inLiteral = true;
}
}
}
format = format.join('');
}
angular.forEach(formatCodeToRegex, function(data) {
var index = format.indexOf(data.key);
if (index > -1) {
format = format.split('');
regex[index] = '(' + data.regex + ')';
format[index] = '$';
for (var i = index + 1, n = index + data.key.length; i < n; i++) {
regex[i] = '';
format[i] = '$';
}
format = format.join('');
map.push({
index: index,
key: data.key,
apply: data[func],
matcher: data.regex
});
}
});
return {
regex: new RegExp('^' + regex.join('') + '$'),
map: orderByFilter(map, 'index')
};
}
this.filter = function(date, format) {
if (!angular.isDate(date) || isNaN(date) || !format) {
return '';
}
format = $locale.DATETIME_FORMATS[format] || format;
if ($locale.id !== localeId) {
this.init();
}
if (!this.formatters[format]) {
this.formatters[format] = createParser(format, 'formatter');
}
var parser = this.formatters[format],
map = parser.map;
var _format = format;
return map.reduce(function(str, mapper, i) {
var match = _format.match(new RegExp('(.*)' + mapper.key));
if (match && angular.isString(match[1])) {
str += match[1];
_format = _format.replace(match[1] + mapper.key, '');
}
if (mapper.apply) {
return str + mapper.apply.call(null, date);
}
return str;
}, '');
};
this.parse = function(input, format, baseDate) {
if (!angular.isString(input) || !format) {
return input;
}
format = $locale.DATETIME_FORMATS[format] || format;
format = format.replace(SPECIAL_CHARACTERS_REGEXP, '\\$&');
if ($locale.id !== localeId) {
this.init();
}
if (!this.parsers[format]) {
this.parsers[format] = createParser(format, 'apply');
}
var parser = this.parsers[format],
regex = parser.regex,
map = parser.map,
results = input.match(regex),
tzOffset = false;
if (results && results.length) {
var fields, dt;
if (angular.isDate(baseDate) && !isNaN(baseDate.getTime())) {
fields = {
year: baseDate.getFullYear(),
month: baseDate.getMonth(),
date: baseDate.getDate(),
hours: baseDate.getHours(),
minutes: baseDate.getMinutes(),
seconds: baseDate.getSeconds(),
milliseconds: baseDate.getMilliseconds()
};
} else {
if (baseDate) {
$log.warn('dateparser:', 'baseDate is not a valid date');
}
fields = { year: 1900, month: 0, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 };
}
for (var i = 1, n = results.length; i < n; i++) {
var mapper = map[i - 1];
if (mapper.matcher === 'Z') {
tzOffset = true;
}
if (mapper.apply) {
mapper.apply.call(fields, results[i]);
}
}
var datesetter = tzOffset ? Date.prototype.setUTCFullYear :
Date.prototype.setFullYear;
var timesetter = tzOffset ? Date.prototype.setUTCHours :
Date.prototype.setHours;
if (isValid(fields.year, fields.month, fields.date)) {
if (angular.isDate(baseDate) && !isNaN(baseDate.getTime()) && !tzOffset) {
dt = new Date(baseDate);
datesetter.call(dt, fields.year, fields.month, fields.date);
timesetter.call(dt, fields.hours, fields.minutes,
fields.seconds, fields.milliseconds);
} else {
dt = new Date(0);
datesetter.call(dt, fields.year, fields.month, fields.date);
timesetter.call(dt, fields.hours || 0, fields.minutes || 0,
fields.seconds || 0, fields.milliseconds || 0);
}
}
return dt;
}
};
function isValid(year, month, date) {
if (date < 1) {
return false;
}
if (month === 1 && date > 28) {
return date === 29 && (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0);
}
if (month === 3 || month === 5 || month === 8 || month === 10) {
return date < 31;
}
return true;
}
function toInt(str) {
return parseInt(str, 10);
}
this.toTimezone = toTimezone;
this.fromTimezone = fromTimezone;
this.timezoneToOffset = timezoneToOffset;
this.addDateMinutes = addDateMinutes;
this.convertTimezoneToLocal = convertTimezoneToLocal;
function toTimezone(date, timezone) {
return date && timezone ? convertTimezoneToLocal(date, timezone) : date;
}
function fromTimezone(date, timezone) {
return date && timezone ? convertTimezoneToLocal(date, timezone, true) : date;
}
function timezoneToOffset(timezone, fallback) {
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
}
function addDateMinutes(date, minutes) {
date = new Date(date.getTime());
date.setMinutes(date.getMinutes() + minutes);
return date;
}
function convertTimezoneToLocal(date, timezone, reverse) {
reverse = reverse ? -1 : 1;
var timezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());
return addDateMinutes(date, reverse * (timezoneOffset - date.getTimezoneOffset()));
}
}]);
angular.module('ui.bootstrap.isClass', [])
.directive('uibIsClass', [
'$animate',
function ($animate) {
var ON_REGEXP = /^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/;
var IS_REGEXP = /^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/;
var dataPerTracked = {};
return {
restrict: 'A',
compile: function (tElement, tAttrs) {
var linkedScopes = [];
var instances = [];
var expToData = {};
var lastActivated = null;
var onExpMatches = tAttrs.uibIsClass.match(ON_REGEXP);
var onExp = onExpMatches[2];
var expsStr = onExpMatches[1];
var exps = expsStr.split(',');
return linkFn;
function linkFn(scope, element, attrs) {
linkedScopes.push(scope);
instances.push({
scope: scope,
element: element
});
exps.forEach(function (exp, k) {
addForExp(exp, scope);
});
scope.$on('$destroy', removeScope);
}
function addForExp(exp, scope) {
var matches = exp.match(IS_REGEXP);
var clazz = scope.$eval(matches[1]);
var compareWithExp = matches[2];
var data = expToData[exp];
if (!data) {
var watchFn = function (compareWithVal) {
var newActivated = null;
instances.some(function (instance) {
var thisVal = instance.scope.$eval(onExp);
if (thisVal === compareWithVal) {
newActivated = instance;
return true;
}
});
if (data.lastActivated !== newActivated) {
if (data.lastActivated) {
$animate.removeClass(data.lastActivated.element, clazz);
}
if (newActivated) {
$animate.addClass(newActivated.element, clazz);
}
data.lastActivated = newActivated;
}
};
expToData[exp] = data = {
lastActivated: null,
scope: scope,
watchFn: watchFn,
compareWithExp: compareWithExp,
watcher: scope.$watch(compareWithExp, watchFn)
};
}
data.watchFn(scope.$eval(compareWithExp));
}
function removeScope(e) {
var removedScope = e.targetScope;
var index = linkedScopes.indexOf(removedScope);
linkedScopes.splice(index, 1);
instances.splice(index, 1);
if (linkedScopes.length) {
var newWatchScope = linkedScopes[0];
angular.forEach(expToData, function (data) {
if (data.scope === removedScope) {
data.watcher = newWatchScope.$watch(data.compareWithExp, data.watchFn);
data.scope = newWatchScope;
}
});
}
else {
expToData = {};
}
}
}
};
}]);
angular.module('ui.bootstrap.position', [])
.factory('$uibPosition', ['$document', '$window', function($document, $window) {
var SCROLLBAR_WIDTH;
var OVERFLOW_REGEX = {
normal: /(auto|scroll)/,
hidden: /(auto|scroll|hidden)/
};
var PLACEMENT_REGEX = {
auto: /\s?auto?\s?/i,
primary: /^(top|bottom|left|right)$/,
secondary: /^(top|bottom|left|right|center)$/,
vertical: /^(top|bottom)$/
};
return {
getRawNode: function(elem) {
return elem[0] || elem;
},
parseStyle: function(value) {
value = parseFloat(value);
return isFinite(value) ? value : 0;
},
offsetParent: function(elem) {
elem = this.getRawNode(elem);
var offsetParent = elem.offsetParent || $document[0].documentElement;
function isStaticPositioned(el) {
return ($window.getComputedStyle(el).position || 'static') === 'static';
}
while (offsetParent && offsetParent !== $document[0].documentElement && isStaticPositioned(offsetParent)) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || $document[0].documentElement;
},
scrollbarWidth: function() {
if (angular.isUndefined(SCROLLBAR_WIDTH)) {
var scrollElem = angular.element('<div style="position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll;"></div>');
$document.find('body').append(scrollElem);
SCROLLBAR_WIDTH = scrollElem[0].offsetWidth - scrollElem[0].clientWidth;
SCROLLBAR_WIDTH = isFinite(SCROLLBAR_WIDTH) ? SCROLLBAR_WIDTH : 0;
scrollElem.remove();
}
return SCROLLBAR_WIDTH;
},
scrollParent: function(elem, includeHidden) {
elem = this.getRawNode(elem);
var overflowRegex = includeHidden ? OVERFLOW_REGEX.hidden : OVERFLOW_REGEX.normal;
var documentEl = $document[0].documentElement;
var elemStyle = $window.getComputedStyle(elem);
var excludeStatic = elemStyle.position === 'absolute';
var scrollParent = elem.parentElement || documentEl;
if (scrollParent === documentEl || elemStyle.position === 'fixed') {
return documentEl;
}
while (scrollParent.parentElement && scrollParent !== documentEl) {
var spStyle = $window.getComputedStyle(scrollParent);
if (excludeStatic && spStyle.position !== 'static') {
excludeStatic = false;
}
if (!excludeStatic && overflowRegex.test(spStyle.overflow + spStyle.overflowY + spStyle.overflowX)) {
break;
}
scrollParent = scrollParent.parentElement;
}
return scrollParent;
},
position: function(elem, includeMagins) {
elem = this.getRawNode(elem);
var elemOffset = this.offset(elem);
if (includeMagins) {
var elemStyle = $window.getComputedStyle(elem);
elemOffset.top -= this.parseStyle(elemStyle.marginTop);
elemOffset.left -= this.parseStyle(elemStyle.marginLeft);
}
var parent = this.offsetParent(elem);
var parentOffset = {top: 0, left: 0};
if (parent !== $document[0].documentElement) {
parentOffset = this.offset(parent);
parentOffset.top += parent.clientTop - parent.scrollTop;
parentOffset.left += parent.clientLeft - parent.scrollLeft;
}
return {
width: Math.round(angular.isNumber(elemOffset.width) ? elemOffset.width : elem.offsetWidth),
height: Math.round(angular.isNumber(elemOffset.height) ? elemOffset.height : elem.offsetHeight),
top: Math.round(elemOffset.top - parentOffset.top),
left: Math.round(elemOffset.left - parentOffset.left)
};
},
offset: function(elem) {
elem = this.getRawNode(elem);
var elemBCR = elem.getBoundingClientRect();
return {
width: Math.round(angular.isNumber(elemBCR.width) ? elemBCR.width : elem.offsetWidth),
height: Math.round(angular.isNumber(elemBCR.height) ? elemBCR.height : elem.offsetHeight),
top: Math.round(elemBCR.top + ($window.pageYOffset || $document[0].documentElement.scrollTop)),
left: Math.round(elemBCR.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft))
};
},
viewportOffset: function(elem, useDocument, includePadding) {
elem = this.getRawNode(elem);
includePadding = includePadding !== false ? true : false;
var elemBCR = elem.getBoundingClientRect();
var offsetBCR = {top: 0, left: 0, bottom: 0, right: 0};
var offsetParent = useDocument ? $document[0].documentElement : this.scrollParent(elem);
var offsetParentBCR = offsetParent.getBoundingClientRect();
offsetBCR.top = offsetParentBCR.top + offsetParent.clientTop;
offsetBCR.left = offsetParentBCR.left + offsetParent.clientLeft;
if (offsetParent === $document[0].documentElement) {
offsetBCR.top += $window.pageYOffset;
offsetBCR.left += $window.pageXOffset;
}
offsetBCR.bottom = offsetBCR.top + offsetParent.clientHeight;
offsetBCR.right = offsetBCR.left + offsetParent.clientWidth;
if (includePadding) {
var offsetParentStyle = $window.getComputedStyle(offsetParent);
offsetBCR.top += this.parseStyle(offsetParentStyle.paddingTop);
offsetBCR.bottom -= this.parseStyle(offsetParentStyle.paddingBottom);
offsetBCR.left += this.parseStyle(offsetParentStyle.paddingLeft);
offsetBCR.right -= this.parseStyle(offsetParentStyle.paddingRight);
}
return {
top: Math.round(elemBCR.top - offsetBCR.top),
bottom: Math.round(offsetBCR.bottom - elemBCR.bottom),
left: Math.round(elemBCR.left - offsetBCR.left),
right: Math.round(offsetBCR.right - elemBCR.right)
};
},
parsePlacement: function(placement) {
var autoPlace = PLACEMENT_REGEX.auto.test(placement);
if (autoPlace) {
placement = placement.replace(PLACEMENT_REGEX.auto, '');
}
placement = placement.split('-');
placement[0] = placement[0] || 'top';
if (!PLACEMENT_REGEX.primary.test(placement[0])) {
placement[0] = 'top';
}
placement[1] = placement[1] || 'center';
if (!PLACEMENT_REGEX.secondary.test(placement[1])) {
placement[1] = 'center';
}
if (autoPlace) {
placement[2] = true;
} else {
placement[2] = false;
}
return placement;
},
positionElements: function(hostElem, targetElem, placement, appendToBody) {
hostElem = this.getRawNode(hostElem);
targetElem = this.getRawNode(targetElem);
var targetWidth = angular.isDefined(targetElem.offsetWidth) ? targetElem.offsetWidth : targetElem.prop('offsetWidth');
var targetHeight = angular.isDefined(targetElem.offsetHeight) ? targetElem.offsetHeight : targetElem.prop('offsetHeight');
placement = this.parsePlacement(placement);
var hostElemPos = appendToBody ? this.offset(hostElem) : this.position(hostElem);
var targetElemPos = {top: 0, left: 0, placement: ''};
if (placement[2]) {
var viewportOffset = this.viewportOffset(hostElem);
var targetElemStyle = $window.getComputedStyle(targetElem);
var adjustedSize = {
width: targetWidth + Math.round(Math.abs(this.parseStyle(targetElemStyle.marginLeft) + this.parseStyle(targetElemStyle.marginRight))),
height: targetHeight + Math.round(Math.abs(this.parseStyle(targetElemStyle.marginTop) + this.parseStyle(targetElemStyle.marginBottom)))
};
placement[0] = placement[0] === 'top' && adjustedSize.height > viewportOffset.top && adjustedSize.height <= viewportOffset.bottom ? 'bottom' :
placement[0] === 'bottom' && adjustedSize.height > viewportOffset.bottom && adjustedSize.height <= viewportOffset.top ? 'top' :
placement[0] === 'left' && adjustedSize.width > viewportOffset.left && adjustedSize.width <= viewportOffset.right ? 'right' :
placement[0] === 'right' && adjustedSize.width > viewportOffset.right && adjustedSize.width <= viewportOffset.left ? 'left' :
placement[0];
placement[1] = placement[1] === 'top' && adjustedSize.height - hostElemPos.height > viewportOffset.bottom && adjustedSize.height - hostElemPos.height <= viewportOffset.top ? 'bottom' :
placement[1] === 'bottom' && adjustedSize.height - hostElemPos.height > viewportOffset.top && adjustedSize.height - hostElemPos.height <= viewportOffset.bottom ? 'top' :
placement[1] === 'left' && adjustedSize.width - hostElemPos.width > viewportOffset.right && adjustedSize.width - hostElemPos.width <= viewportOffset.left ? 'right' :
placement[1] === 'right' && adjustedSize.width - hostElemPos.width > viewportOffset.left && adjustedSize.width - hostElemPos.width <= viewportOffset.right ? 'left' :
placement[1];
if (placement[1] === 'center') {
if (PLACEMENT_REGEX.vertical.test(placement[0])) {
var xOverflow = hostElemPos.width / 2 - targetWidth / 2;
if (viewportOffset.left + xOverflow < 0 && adjustedSize.width - hostElemPos.width <= viewportOffset.right) {
placement[1] = 'left';
} else if (viewportOffset.right + xOverflow < 0 && adjustedSize.width - hostElemPos.width <= viewportOffset.left) {
placement[1] = 'right';
}
} else {
var yOverflow = hostElemPos.height / 2 - adjustedSize.height / 2;
if (viewportOffset.top + yOverflow < 0 && adjustedSize.height - hostElemPos.height <= viewportOffset.bottom) {
placement[1] = 'top';
} else if (viewportOffset.bottom + yOverflow < 0 && adjustedSize.height - hostElemPos.height <= viewportOffset.top) {
placement[1] = 'bottom';
}
}
}
}
switch (placement[0]) {
case 'top':
targetElemPos.top = hostElemPos.top - targetHeight;
break;
case 'bottom':
targetElemPos.top = hostElemPos.top + hostElemPos.height;
break;
case 'left':
targetElemPos.left = hostElemPos.left - targetWidth;
break;
case 'right':
targetElemPos.left = hostElemPos.left + hostElemPos.width;
break;
}
switch (placement[1]) {
case 'top':
targetElemPos.top = hostElemPos.top;
break;
case 'bottom':
targetElemPos.top = hostElemPos.top + hostElemPos.height - targetHeight;
break;
case 'left':
targetElemPos.left = hostElemPos.left;
break;
case 'right':
targetElemPos.left = hostElemPos.left + hostElemPos.width - targetWidth;
break;
case 'center':
if (PLACEMENT_REGEX.vertical.test(placement[0])) {
targetElemPos.left = hostElemPos.left + hostElemPos.width / 2 - targetWidth / 2;
} else {
targetElemPos.top = hostElemPos.top + hostElemPos.height / 2 - targetHeight / 2;
}
break;
}
targetElemPos.top = Math.round(targetElemPos.top);
targetElemPos.left = Math.round(targetElemPos.left);
targetElemPos.placement = placement[1] === 'center' ? placement[0] : placement[0] + '-' + placement[1];
return targetElemPos;
},
positionArrow: function(elem, placement) {
elem = this.getRawNode(elem);
var innerElem = elem.querySelector('.tooltip-inner, .popover-inner');
if (!innerElem) {
return;
}
var isTooltip = angular.element(innerElem).hasClass('tooltip-inner');
var arrowElem = isTooltip ? elem.querySelector('.tooltip-arrow') : elem.querySelector('.arrow');
if (!arrowElem) {
return;
}
placement = this.parsePlacement(placement);
if (placement[1] === 'center') {
angular.element(arrowElem).css({top: '', bottom: '', right: '', left: '', margin: ''});
return;
}
var borderProp = 'border-' + placement[0] + '-width';
var borderWidth = $window.getComputedStyle(arrowElem)[borderProp];
var borderRadiusProp = 'border-';
if (PLACEMENT_REGEX.vertical.test(placement[0])) {
borderRadiusProp += placement[0] + '-' + placement[1];
} else {
borderRadiusProp += placement[1] + '-' + placement[0];
}
borderRadiusProp += '-radius';
var borderRadius = $window.getComputedStyle(isTooltip ? innerElem : elem)[borderRadiusProp];
var arrowCss = {
top: 'auto',
bottom: 'auto',
left: 'auto',
right: 'auto',
margin: 0
};
switch (placement[0]) {
case 'top':
arrowCss.bottom = isTooltip ? '0' : '-' + borderWidth;
break;
case 'bottom':
arrowCss.top = isTooltip ? '0' : '-' + borderWidth;
break;
case 'left':
arrowCss.right = isTooltip ? '0' : '-' + borderWidth;
break;
case 'right':
arrowCss.left = isTooltip ? '0' : '-' + borderWidth;
break;
}
arrowCss[placement[1]] = borderRadius;
angular.element(arrowElem).css(arrowCss);
}
};
}]);
angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.isClass', 'ui.bootstrap.position'])
.value('$datepickerSuppressError', false)
.constant('uibDatepickerConfig', {
datepickerMode: 'day',
formatDay: 'dd',
formatMonth: 'MMMM',
formatYear: 'yyyy',
formatDayHeader: 'EEE',
formatDayTitle: 'MMMM yyyy',
formatMonthTitle: 'yyyy',
maxDate: null,
maxMode: 'year',
minDate: null,
minMode: 'day',
ngModelOptions: {},
shortcutPropagation: false,
showWeeks: true,
yearColumns: 5,
yearRows: 4
})
.controller('UibDatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$locale', '$log', 'dateFilter', 'uibDatepickerConfig', '$datepickerSuppressError', 'uibDateParser',
function($scope, $attrs, $parse, $interpolate, $locale, $log, dateFilter, datepickerConfig, $datepickerSuppressError, dateParser) {
var self = this,
ngModelCtrl = { $setViewValue: angular.noop },
ngModelOptions = {},
watchListeners = [];
this.modes = ['day', 'month', 'year'];
if ($attrs.datepickerOptions) {
angular.forEach([
'formatDay',
'formatDayHeader',
'formatDayTitle',
'formatMonth',
'formatMonthTitle',
'formatYear',
'initDate',
'maxDate',
'maxMode',
'minDate',
'minMode',
'showWeeks',
'shortcutPropagation',
'startingDay',
'yearColumns',
'yearRows'
], function(key) {
switch (key) {
case 'formatDay':
case 'formatDayHeader':
case 'formatDayTitle':
case 'formatMonth':
case 'formatMonthTitle':
case 'formatYear':
self[key] = angular.isDefined($scope.datepickerOptions[key]) ? $interpolate($scope.datepickerOptions[key])($scope.$parent) : datepickerConfig[key];
break;
case 'showWeeks':
case 'shortcutPropagation':
case 'yearColumns':
case 'yearRows':
self[key] = angular.isDefined($scope.datepickerOptions[key]) ?
$scope.datepickerOptions[key] : datepickerConfig[key];
break;
case 'startingDay':
if (angular.isDefined($scope.datepickerOptions.startingDay)) {
self.startingDay = $scope.datepickerOptions.startingDay;
} else if (angular.isNumber(datepickerConfig.startingDay)) {
self.startingDay = datepickerConfig.startingDay;
} else {
self.startingDay = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7;
}
break;
case 'maxDate':
case 'minDate':
if ($scope.datepickerOptions[key]) {
$scope.$watch(function() { return $scope.datepickerOptions[key]; }, function(value) {
if (value) {
if (angular.isDate(value)) {
self[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
} else {
self[key] = new Date(dateFilter(value, 'medium'));
}
} else {
self[key] = null;
}
self.refreshView();
});
} else {
self[key] = datepickerConfig[key] ? dateParser.fromTimezone(new Date(datepickerConfig[key]), ngModelOptions.timezone) : null;
}
break;
case 'maxMode':
case 'minMode':
if ($scope.datepickerOptions[key]) {
$scope.$watch(function() { return $scope.datepickerOptions[key]; }, function(value) {
self[key] = $scope[key] = angular.isDefined(value) ? value : datepickerOptions[key];
if (key === 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key]) ||
key === 'maxMode' && self.modes.indexOf($scope.datepickerMode) > self.modes.indexOf(self[key])) {
$scope.datepickerMode = self[key];
}
});
} else {
self[key] = $scope[key] = datepickerConfig[key] || null;
}
break;
case 'initDate':
if ($scope.datepickerOptions.initDate) {
this.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date();
$scope.$watch(function() { return $scope.datepickerOptions.initDate; }, function(initDate) {
if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {
self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone);
self.refreshView();
}
});
} else {
this.activeDate = new Date();
}
}
});
} else {
angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle'], function(key) {
self[key] = angular.isDefined($attrs[key]) ? $interpolate($attrs[key])($scope.$parent) : datepickerConfig[key];
});
angular.forEach(['showWeeks', 'yearRows', 'yearColumns', 'shortcutPropagation'], function(key) {
self[key] = angular.isDefined($attrs[key]) ?
$scope.$parent.$eval($attrs[key]) : datepickerConfig[key];
});
if (angular.isDefined($attrs.startingDay)) {
self.startingDay = $scope.$parent.$eval($attrs.startingDay);
} else if (angular.isNumber(datepickerConfig.startingDay)) {
self.startingDay = datepickerConfig.startingDay;
} else {
self.startingDay = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7;
}
angular.forEach(['minDate', 'maxDate'], function(key) {
if ($attrs[key]) {
watchListeners.push($scope.$parent.$watch($attrs[key], function(value) {
if (value) {
if (angular.isDate(value)) {
self[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
} else {
self[key] = new Date(dateFilter(value, 'medium'));
}
} else {
self[key] = null;
}
self.refreshView();
}));
} else {
self[key] = datepickerConfig[key] ? dateParser.fromTimezone(new Date(datepickerConfig[key]), ngModelOptions.timezone) : null;
}
});
angular.forEach(['minMode', 'maxMode'], function(key) {
if ($attrs[key]) {
watchListeners.push($scope.$parent.$watch($attrs[key], function(value) {
self[key] = $scope[key] = angular.isDefined(value) ? value : $attrs[key];
if (key === 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key]) ||
key === 'maxMode' && self.modes.indexOf($scope.datepickerMode) > self.modes.indexOf(self[key])) {
$scope.datepickerMode = self[key];
}
}));
} else {
self[key] = $scope[key] = datepickerConfig[key] || null;
}
});
if (angular.isDefined($attrs.initDate)) {
this.activeDate = dateParser.fromTimezone($scope.$parent.$eval($attrs.initDate), ngModelOptions.timezone) || new Date();
watchListeners.push($scope.$parent.$watch($attrs.initDate, function(initDate) {
if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {
self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone);
self.refreshView();
}
}));
} else {
this.activeDate = new Date();
}
}
$scope.datepickerMode = $scope.datepickerMode || datepickerConfig.datepickerMode;
$scope.uniqueId = 'datepicker-' + $scope.$id + '-' + Math.floor(Math.random() * 10000);
$scope.disabled = angular.isDefined($attrs.disabled) || false;
if (angular.isDefined($attrs.ngDisabled)) {
watchListeners.push($scope.$parent.$watch($attrs.ngDisabled, function(disabled) {
$scope.disabled = disabled;
self.refreshView();
}));
}
$scope.isActive = function(dateObject) {
if (self.compare(dateObject.date, self.activeDate) === 0) {
$scope.activeDateId = dateObject.uid;
return true;
}
return false;
};
this.init = function(ngModelCtrl_) {
ngModelCtrl = ngModelCtrl_;
ngModelOptions = ngModelCtrl_.$options || datepickerConfig.ngModelOptions;
if (ngModelCtrl.$modelValue) {
this.activeDate = ngModelCtrl.$modelValue;
}
ngModelCtrl.$render = function() {
self.render();
};
};
this.render = function() {
if (ngModelCtrl.$viewValue) {
var date = new Date(ngModelCtrl.$viewValue),
isValid = !isNaN(date);
if (isValid) {
this.activeDate = dateParser.fromTimezone(date, ngModelOptions.timezone);
} else if (!$datepickerSuppressError) {
$log.error('Datepicker directive: "ng-model" value must be a Date object');
}
}
this.refreshView();
};
this.refreshView = function() {
if (this.element) {
$scope.selectedDt = null;
this._refreshView();
if ($scope.activeDt) {
$scope.activeDateId = $scope.activeDt.uid;
}
var date = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;
date = dateParser.fromTimezone(date, ngModelOptions.timezone);
ngModelCtrl.$setValidity('dateDisabled', !date ||
this.element && !this.isDisabled(date));
}
};
this.createDateObject = function(date, format) {
var model = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;
model = dateParser.fromTimezone(model, ngModelOptions.timezone);
var dt = {
date: date,
label: dateParser.filter(date, format),
selected: model && this.compare(date, model) === 0,
disabled: this.isDisabled(date),
current: this.compare(date, new Date()) === 0,
customClass: this.customClass(date) || null
};
if (model && this.compare(date, model) === 0) {
$scope.selectedDt = dt;
}
if (self.activeDate && this.compare(dt.date, self.activeDate) === 0) {
$scope.activeDt = dt;
}
return dt;
};
this.isDisabled = function(date) {
return $scope.disabled ||
this.minDate && this.compare(date, this.minDate) < 0 ||
this.maxDate && this.compare(date, this.maxDate) > 0 ||
$attrs.dateDisabled && $scope.dateDisabled({date: date, mode: $scope.datepickerMode});
};
this.customClass = function(date) {
return $scope.customClass({date: date, mode: $scope.datepickerMode});
};
this.split = function(arr, size) {
var arrays = [];
while (arr.length > 0) {
arrays.push(arr.splice(0, size));
}
return arrays;
};
$scope.select = function(date) {
if ($scope.datepickerMode === self.minMode) {
var dt = ngModelCtrl.$viewValue ? dateParser.fromTimezone(new Date(ngModelCtrl.$viewValue), ngModelOptions.timezone) : new Date(0, 0, 0, 0, 0, 0, 0);
dt.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
dt = dateParser.toTimezone(dt, ngModelOptions.timezone);
ngModelCtrl.$setViewValue(dt);
ngModelCtrl.$render();
} else {
self.activeDate = date;
$scope.datepickerMode = self.modes[self.modes.indexOf($scope.datepickerMode) - 1];
}
};
$scope.move = function(direction) {
var year = self.activeDate.getFullYear() + direction * (self.step.years || 0),
month = self.activeDate.getMonth() + direction * (self.step.months || 0);
self.activeDate.setFullYear(year, month, 1);
self.refreshView();
};
$scope.toggleMode = function(direction) {
direction = direction || 1;
if ($scope.datepickerMode === self.maxMode && direction === 1 ||
$scope.datepickerMode === self.minMode && direction === -1) {
return;
}
$scope.datepickerMode = self.modes[self.modes.indexOf($scope.datepickerMode) + direction];
};
$scope.keys = { 13: 'enter', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down' };
var focusElement = function() {
self.element[0].focus();
};
$scope.$on('uib:datepicker.focus', focusElement);
$scope.keydown = function(evt) {
var key = $scope.keys[evt.which];
if (!key || evt.shiftKey || evt.altKey || $scope.disabled) {
return;
}
evt.preventDefault();
if (!self.shortcutPropagation) {
evt.stopPropagation();
}
if (key === 'enter' || key === 'space') {
if (self.isDisabled(self.activeDate)) {
return;
}
$scope.select(self.activeDate);
} else if (evt.ctrlKey && (key === 'up' || key === 'down')) {
$scope.toggleMode(key === 'up' ? 1 : -1);
} else {
self.handleKeyDown(key, evt);
self.refreshView();
}
};
$scope.$on("$destroy", function() {
while (watchListeners.length) {
watchListeners.shift()();
}
});
}])
.controller('UibDaypickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) {
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
this.step = { months: 1 };
this.element = $element;
function getDaysInMonth(year, month) {
return month === 1 && year % 4 === 0 &&
(year % 100 !== 0 || year % 400 === 0) ? 29 : DAYS_IN_MONTH[month];
}
this.init = function(ctrl) {
angular.extend(ctrl, this);
scope.showWeeks = ctrl.showWeeks;
ctrl.refreshView();
};
this.getDates = function(startDate, n) {
var dates = new Array(n), current = new Date(startDate), i = 0, date;
while (i < n) {
date = new Date(current);
dates[i++] = date;
current.setDate(current.getDate() + 1);
}
return dates;
};
this._refreshView = function() {
var year = this.activeDate.getFullYear(),
month = this.activeDate.getMonth(),
firstDayOfMonth = new Date(this.activeDate);
firstDayOfMonth.setFullYear(year, month, 1);
var difference = this.startingDay - firstDayOfMonth.getDay(),
numDisplayedFromPreviousMonth = difference > 0 ?
7 - difference : - difference,
firstDate = new Date(firstDayOfMonth);
if (numDisplayedFromPreviousMonth > 0) {
firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
}
var days = this.getDates(firstDate, 42);
for (var i = 0; i < 42; i ++) {
days[i] = angular.extend(this.createDateObject(days[i], this.formatDay), {
secondary: days[i].getMonth() !== month,
uid: scope.uniqueId + '-' + i
});
}
scope.labels = new Array(7);
for (var j = 0; j < 7; j++) {
scope.labels[j] = {
abbr: dateFilter(days[j].date, this.formatDayHeader),
full: dateFilter(days[j].date, 'EEEE')
};
}
scope.title = dateFilter(this.activeDate, this.formatDayTitle);
scope.rows = this.split(days, 7);
if (scope.showWeeks) {
scope.weekNumbers = [];
var thursdayIndex = (4 + 7 - this.startingDay) % 7,
numWeeks = scope.rows.length;
for (var curWeek = 0; curWeek < numWeeks; curWeek++) {
scope.weekNumbers.push(
getISO8601WeekNumber(scope.rows[curWeek][thursdayIndex].date));
}
}
};
this.compare = function(date1, date2) {
var _date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
var _date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
_date1.setFullYear(date1.getFullYear());
_date2.setFullYear(date2.getFullYear());
return _date1 - _date2;
};
function getISO8601WeekNumber(date) {
var checkDate = new Date(date);
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
var time = checkDate.getTime();
checkDate.setMonth(0);
checkDate.setDate(1);
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
}
this.handleKeyDown = function(key, evt) {
var date = this.activeDate.getDate();
if (key === 'left') {
date = date - 1;
} else if (key === 'up') {
date = date - 7;
} else if (key === 'right') {
date = date + 1;
} else if (key === 'down') {
date = date + 7;
} else if (key === 'pageup' || key === 'pagedown') {
var month = this.activeDate.getMonth() + (key === 'pageup' ? - 1 : 1);
this.activeDate.setMonth(month, 1);
date = Math.min(getDaysInMonth(this.activeDate.getFullYear(), this.activeDate.getMonth()), date);
} else if (key === 'home') {
date = 1;
} else if (key === 'end') {
date = getDaysInMonth(this.activeDate.getFullYear(), this.activeDate.getMonth());
}
this.activeDate.setDate(date);
};
}])
.controller('UibMonthpickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) {
this.step = { years: 1 };
this.element = $element;
this.init = function(ctrl) {
angular.extend(ctrl, this);
ctrl.refreshView();
};
this._refreshView = function() {
var months = new Array(12),
year = this.activeDate.getFullYear(),
date;
for (var i = 0; i < 12; i++) {
date = new Date(this.activeDate);
date.setFullYear(year, i, 1);
months[i] = angular.extend(this.createDateObject(date, this.formatMonth), {
uid: scope.uniqueId + '-' + i
});
}
scope.title = dateFilter(this.activeDate, this.formatMonthTitle);
scope.rows = this.split(months, 3);
};
this.compare = function(date1, date2) {
var _date1 = new Date(date1.getFullYear(), date1.getMonth());
var _date2 = new Date(date2.getFullYear(), date2.getMonth());
_date1.setFullYear(date1.getFullYear());
_date2.setFullYear(date2.getFullYear());
return _date1 - _date2;
};
this.handleKeyDown = function(key, evt) {
var date = this.activeDate.getMonth();
if (key === 'left') {
date = date - 1;
} else if (key === 'up') {
date = date - 3;
} else if (key === 'right') {
date = date + 1;
} else if (key === 'down') {
date = date + 3;
} else if (key === 'pageup' || key === 'pagedown') {
var year = this.activeDate.getFullYear() + (key === 'pageup' ? - 1 : 1);
this.activeDate.setFullYear(year);
} else if (key === 'home') {
date = 0;
} else if (key === 'end') {
date = 11;
}
this.activeDate.setMonth(date);
};
}])
.controller('UibYearpickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) {
var columns, range;
this.element = $element;
function getStartingYear(year) {
return parseInt((year - 1) / range, 10) * range + 1;
}
this.yearpickerInit = function() {
columns = this.yearColumns;
range = this.yearRows * columns;
this.step = { years: range };
};
this._refreshView = function() {
var years = new Array(range), date;
for (var i = 0, start = getStartingYear(this.activeDate.getFullYear()); i < range; i++) {
date = new Date(this.activeDate);
date.setFullYear(start + i, 0, 1);
years[i] = angular.extend(this.createDateObject(date, this.formatYear), {
uid: scope.uniqueId + '-' + i
});
}
scope.title = [years[0].label, years[range - 1].label].join(' - ');
scope.rows = this.split(years, columns);
scope.columns = columns;
};
this.compare = function(date1, date2) {
return date1.getFullYear() - date2.getFullYear();
};
this.handleKeyDown = function(key, evt) {
var date = this.activeDate.getFullYear();
if (key === 'left') {
date = date - 1;
} else if (key === 'up') {
date = date - columns;
} else if (key === 'right') {
date = date + 1;
} else if (key === 'down') {
date = date + columns;
} else if (key === 'pageup' || key === 'pagedown') {
date += (key === 'pageup' ? - 1 : 1) * range;
} else if (key === 'home') {
date = getStartingYear(this.activeDate.getFullYear());
} else if (key === 'end') {
date = getStartingYear(this.activeDate.getFullYear()) + range - 1;
}
this.activeDate.setFullYear(date);
};
}])
.directive('uibDatepicker', function() {
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/datepicker/datepicker.html';
},
scope: {
datepickerMode: '=?',
datepickerOptions: '=?',
dateDisabled: '&',
customClass: '&',
shortcutPropagation: '&?'
},
require: ['uibDatepicker', '^ngModel'],
controller: 'UibDatepickerController',
controllerAs: 'datepicker',
link: function(scope, element, attrs, ctrls) {
var datepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1];
datepickerCtrl.init(ngModelCtrl);
}
};
})
.directive('uibDaypicker', function() {
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/datepicker/day.html';
},
require: ['^uibDatepicker', 'uibDaypicker'],
controller: 'UibDaypickerController',
link: function(scope, element, attrs, ctrls) {
var datepickerCtrl = ctrls[0],
daypickerCtrl = ctrls[1];
daypickerCtrl.init(datepickerCtrl);
}
};
})
.directive('uibMonthpicker', function() {
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/datepicker/month.html';
},
require: ['^uibDatepicker', 'uibMonthpicker'],
controller: 'UibMonthpickerController',
link: function(scope, element, attrs, ctrls) {
var datepickerCtrl = ctrls[0],
monthpickerCtrl = ctrls[1];
monthpickerCtrl.init(datepickerCtrl);
}
};
})
.directive('uibYearpicker', function() {
return {
replace: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/datepicker/year.html';
},
require: ['^uibDatepicker', 'uibYearpicker'],
controller: 'UibYearpickerController',
link: function(scope, element, attrs, ctrls) {
var ctrl = ctrls[0];
angular.extend(ctrl, ctrls[1]);
ctrl.yearpickerInit();
ctrl.refreshView();
}
};
})
.constant('uibDatepickerPopupConfig', {
altInputFormats: [],
appendToBody: false,
clearText: 'Clear',
closeOnDateSelection: true,
closeText: 'Done',
currentText: 'Today',
datepickerPopup: 'yyyy-MM-dd',
datepickerPopupTemplateUrl: 'uib/template/datepicker/popup.html',
datepickerTemplateUrl: 'uib/template/datepicker/datepicker.html',
html5Types: {
date: 'yyyy-MM-dd',
'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
'month': 'yyyy-MM'
},
onOpenFocus: true,
showButtonBar: true
})
.controller('UibDatepickerPopupController', ['$scope', '$element', '$attrs', '$compile', '$parse', '$document', '$rootScope', '$uibPosition', 'dateFilter', 'uibDateParser', 'uibDatepickerPopupConfig', '$timeout', 'uibDatepickerConfig',
function(scope, element, attrs, $compile, $parse, $document, $rootScope, $position, dateFilter, dateParser, datepickerPopupConfig, $timeout, datepickerConfig) {
var cache = {},
isHtml5DateInput = false;
var dateFormat, closeOnDateSelection, appendToBody, onOpenFocus,
datepickerPopupTemplateUrl, datepickerTemplateUrl, popupEl, datepickerEl,
ngModel, ngModelOptions, $popup, altInputFormats, watchListeners = [];
scope.watchData = {};
this.init = function(_ngModel_) {
ngModel = _ngModel_;
ngModelOptions = _ngModel_.$options || datepickerConfig.ngModelOptions;
closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$parent.$eval(attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection;
appendToBody = angular.isDefined(attrs.datepickerAppendToBody) ? scope.$parent.$eval(attrs.datepickerAppendToBody) : datepickerPopupConfig.appendToBody;
onOpenFocus = angular.isDefined(attrs.onOpenFocus) ? scope.$parent.$eval(attrs.onOpenFocus) : datepickerPopupConfig.onOpenFocus;
datepickerPopupTemplateUrl = angular.isDefined(attrs.datepickerPopupTemplateUrl) ? attrs.datepickerPopupTemplateUrl : datepickerPopupConfig.datepickerPopupTemplateUrl;
datepickerTemplateUrl = angular.isDefined(attrs.datepickerTemplateUrl) ? attrs.datepickerTemplateUrl : datepickerPopupConfig.datepickerTemplateUrl;
altInputFormats = angular.isDefined(attrs.altInputFormats) ? scope.$parent.$eval(attrs.altInputFormats) : datepickerPopupConfig.altInputFormats;
scope.showButtonBar = angular.isDefined(attrs.showButtonBar) ? scope.$parent.$eval(attrs.showButtonBar) : datepickerPopupConfig.showButtonBar;
if (datepickerPopupConfig.html5Types[attrs.type]) {
dateFormat = datepickerPopupConfig.html5Types[attrs.type];
isHtml5DateInput = true;
} else {
dateFormat = attrs.uibDatepickerPopup || datepickerPopupConfig.datepickerPopup;
attrs.$observe('uibDatepickerPopup', function(value, oldValue) {
var newDateFormat = value || datepickerPopupConfig.datepickerPopup;
if (newDateFormat !== dateFormat) {
dateFormat = newDateFormat;
ngModel.$modelValue = null;
if (!dateFormat) {
throw new Error('uibDatepickerPopup must have a date format specified.');
}
}
});
}
if (!dateFormat) {
throw new Error('uibDatepickerPopup must have a date format specified.');
}
if (isHtml5DateInput && attrs.uibDatepickerPopup) {
throw new Error('HTML5 date input types do not support custom formats.');
}
popupEl = angular.element('<div uib-datepicker-popup-wrap><div uib-datepicker></div></div>');
scope.ngModelOptions = angular.copy(ngModelOptions);
scope.ngModelOptions.timezone = null;
popupEl.attr({
'ng-model': 'date',
'ng-model-options': 'ngModelOptions',
'ng-change': 'dateSelection(date)',
'template-url': datepickerPopupTemplateUrl
});
datepickerEl = angular.element(popupEl.children()[0]);
datepickerEl.attr('template-url', datepickerTemplateUrl);
if (isHtml5DateInput) {
if (attrs.type === 'month') {
datepickerEl.attr('datepicker-mode', '"month"');
datepickerEl.attr('min-mode', 'month');
}
}
if (scope.datepickerOptions) {
angular.forEach(scope.datepickerOptions, function(value, option) {
if (['minDate', 'maxDate', 'minMode', 'maxMode', 'initDate', 'datepickerMode'].indexOf(option) === -1) {
datepickerEl.attr(cameltoDash(option), value);
} else {
datepickerEl.attr(cameltoDash(option), 'datepickerOptions.' + option);
}
});
}
angular.forEach(['minMode', 'maxMode', 'datepickerMode', 'shortcutPropagation'], function(key) {
if (attrs[key]) {
var getAttribute = $parse(attrs[key]);
var propConfig = {
get: function() {
return getAttribute(scope.$parent);
}
};
datepickerEl.attr(cameltoDash(key), 'watchData.' + key);
if (key === 'datepickerMode') {
var setAttribute = getAttribute.assign;
propConfig.set = function(v) {
setAttribute(scope.$parent, v);
};
}
Object.defineProperty(scope.watchData, key, propConfig);
}
});
angular.forEach(['minDate', 'maxDate', 'initDate'], function(key) {
if (attrs[key]) {
var getAttribute = $parse(attrs[key]);
watchListeners.push(scope.$parent.$watch(getAttribute, function(value) {
if (key === 'minDate' || key === 'maxDate') {
if (value === null) {
cache[key] = null;
} else if (angular.isDate(value)) {
cache[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
} else {
cache[key] = new Date(dateFilter(value, 'medium'));
}
scope.watchData[key] = value === null ? null : cache[key];
} else {
scope.watchData[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
}
}));
datepickerEl.attr(cameltoDash(key), 'watchData.' + key);
}
});
if (attrs.dateDisabled) {
datepickerEl.attr('date-disabled', 'dateDisabled({ date: date, mode: mode })');
}
angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle', 'showWeeks', 'startingDay', 'yearRows', 'yearColumns'], function(key) {
if (angular.isDefined(attrs[key])) {
datepickerEl.attr(cameltoDash(key), attrs[key]);
}
});
if (attrs.customClass) {
datepickerEl.attr('custom-class', 'customClass({ date: date, mode: mode })');
}
if (!isHtml5DateInput) {
ngModel.$$parserName = 'date';
ngModel.$validators.date = validator;
ngModel.$parsers.unshift(parseDate);
ngModel.$formatters.push(function(value) {
if (ngModel.$isEmpty(value)) {
scope.date = value;
return value;
}
scope.date = dateParser.fromTimezone(value, ngModelOptions.timezone);
if (angular.isNumber(scope.date)) {
scope.date = new Date(scope.date);
}
return dateParser.filter(scope.date, dateFormat);
});
} else {
ngModel.$formatters.push(function(value) {
scope.date = dateParser.fromTimezone(value, ngModelOptions.timezone);
return value;
});
}
ngModel.$viewChangeListeners.push(function() {
scope.date = parseDateString(ngModel.$viewValue);
});
element.on('keydown', inputKeydownBind);
$popup = $compile(popupEl)(scope);
popupEl.remove();
if (appendToBody) {
$document.find('body').append($popup);
} else {
element.after($popup);
}
scope.$on('$destroy', function() {
if (scope.isOpen === true) {
if (!$rootScope.$$phase) {
scope.$apply(function() {
scope.isOpen = false;
});
}
}
$popup.remove();
element.off('keydown', inputKeydownBind);
$document.off('click', documentClickBind);
while (watchListeners.length) {
watchListeners.shift()();
}
});
};
scope.getText = function(key) {
return scope[key + 'Text'] || datepickerPopupConfig[key + 'Text'];
};
scope.isDisabled = function(date) {
if (date === 'today') {
date = new Date();
}
return scope.watchData.minDate && scope.compare(date, cache.minDate) < 0 ||
scope.watchData.maxDate && scope.compare(date, cache.maxDate) > 0;
};
scope.compare = function(date1, date2) {
return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate()) - new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
};
scope.dateSelection = function(dt) {
if (angular.isDefined(dt)) {
scope.date = dt;
}
var date = scope.date ? dateParser.filter(scope.date, dateFormat) : null;
element.val(date);
ngModel.$setViewValue(date);
if (closeOnDateSelection) {
scope.isOpen = false;
element[0].focus();
}
};
scope.keydown = function(evt) {
if (evt.which === 27) {
evt.stopPropagation();
scope.isOpen = false;
element[0].focus();
}
};
scope.select = function(date) {
if (date === 'today') {
var today = new Date();
if (angular.isDate(scope.date)) {
date = new Date(scope.date);
date.setFullYear(today.getFullYear(), today.getMonth(), today.getDate());
} else {
date = new Date(today.setHours(0, 0, 0, 0));
}
}
scope.dateSelection(date);
};
scope.close = function() {
scope.isOpen = false;
element[0].focus();
};
scope.disabled = angular.isDefined(attrs.disabled) || false;
if (attrs.ngDisabled) {
watchListeners.push(scope.$parent.$watch($parse(attrs.ngDisabled), function(disabled) {
scope.disabled = disabled;
}));
}
scope.$watch('isOpen', function(value) {
if (value) {
if (!scope.disabled) {
scope.position = appendToBody ? $position.offset(element) : $position.position(element);
scope.position.top = scope.position.top + element.prop('offsetHeight');
$timeout(function() {
if (onOpenFocus) {
scope.$broadcast('uib:datepicker.focus');
}
$document.on('click', documentClickBind);
}, 0, false);
} else {
scope.isOpen = false;
}
} else {
$document.off('click', documentClickBind);
}
});
function cameltoDash(string) {
return string.replace(/([A-Z])/g, function($1) { return '-' + $1.toLowerCase(); });
}
function parseDateString(viewValue) {
var date = dateParser.parse(viewValue, dateFormat, scope.date);
if (isNaN(date)) {
for (var i = 0; i < altInputFormats.length; i++) {
date = dateParser.parse(viewValue, altInputFormats[i], scope.date);
if (!isNaN(date)) {
return date;
}
}
}
return date;
}
function parseDate(viewValue) {
if (angular.isNumber(viewValue)) {
viewValue = new Date(viewValue);
}
if (!viewValue) {
return null;
}
if (angular.isDate(viewValue) && !isNaN(viewValue)) {
return viewValue;
}
if (angular.isString(viewValue)) {
var date = parseDateString(viewValue);
if (!isNaN(date)) {
return dateParser.toTimezone(date, ngModelOptions.timezone);
}
}
return ngModel.$options && ngModel.$options.allowInvalid ? viewValue : undefined;
}
function validator(modelValue, viewValue) {
var value = modelValue || viewValue;
if (!attrs.ngRequired && !value) {
return true;
}
if (angular.isNumber(value)) {
value = new Date(value);
}
if (!value) {
return true;
}
if (angular.isDate(value) && !isNaN(value)) {
return true;
}
if (angular.isString(value)) {
return !isNaN(parseDateString(viewValue));
}
return false;
}
function documentClickBind(event) {
if (!scope.isOpen && scope.disabled) {
return;
}
var popup = $popup[0];
var dpContainsTarget = element[0].contains(event.target);
var popupContainsTarget = popup.contains !== undefined && popup.contains(event.target);
if (scope.isOpen && !(dpContainsTarget || popupContainsTarget)) {
scope.$apply(function() {
scope.isOpen = false;
});
}
}
function inputKeydownBind(evt) {
if (evt.which === 27 && scope.isOpen) {
evt.preventDefault();
evt.stopPropagation();
scope.$apply(function() {
scope.isOpen = false;
});
element[0].focus();
} else if (evt.which === 40 && !scope.isOpen) {
evt.preventDefault();
evt.stopPropagation();
scope.$apply(function() {
scope.isOpen = true;
});
}
}
}])
.directive('uibDatepickerPopup', function() {
return {
require: ['ngModel', 'uibDatepickerPopup'],
controller: 'UibDatepickerPopupController',
scope: {
datepickerOptions: '=?',
isOpen: '=?',
currentText: '@',
clearText: '@',
closeText: '@',
dateDisabled: '&',
customClass: '&'
},
link: function(scope, element, attrs, ctrls) {
var ngModel = ctrls[0],
ctrl = ctrls[1];
ctrl.init(ngModel);
}
};
})
.directive('uibDatepickerPopupWrap', function() {
return {
replace: true,
transclude: true,
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/datepicker/popup.html';
}
};
});
angular.module('ui.bootstrap.debounce', [])
.factory('$$debounce', ['$timeout', function($timeout) {
return function(callback, debounceTime) {
var timeoutPromise;
return function() {
var self = this;
var args = Array.prototype.slice.call(arguments);
if (timeoutPromise) {
$timeout.cancel(timeoutPromise);
}
timeoutPromise = $timeout(function() {
callback.apply(self, args);
}, debounceTime);
};
};
}]);
angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
.constant('uibDropdownConfig', {
appendToOpenClass: 'uib-dropdown-open',
openClass: 'open'
})
.service('uibDropdownService', ['$document', '$rootScope', function($document, $rootScope) {
var openScope = null;
this.open = function(dropdownScope) {
if (!openScope) {
$document.on('click', closeDropdown);
$document.on('keydown', keybindFilter);
}
if (openScope && openScope !== dropdownScope) {
openScope.isOpen = false;
}
openScope = dropdownScope;
};
this.close = function(dropdownScope) {
if (openScope === dropdownScope) {
openScope = null;
$document.off('click', closeDropdown);
$document.off('keydown', keybindFilter);
}
};
var closeDropdown = function(evt) {
if (!openScope) { return; }
if (evt && openScope.getAutoClose() === 'disabled') { return; }
if (evt && evt.which === 3) { return; }
var toggleElement = openScope.getToggleElement();
if (evt && toggleElement && toggleElement[0].contains(evt.target)) {
return;
}
var dropdownElement = openScope.getDropdownElement();
if (evt && openScope.getAutoClose() === 'outsideClick' &&
dropdownElement && dropdownElement[0].contains(evt.target)) {
return;
}
openScope.isOpen = false;
if (!$rootScope.$$phase) {
openScope.$apply();
}
};
var keybindFilter = function(evt) {
if (evt.which === 27) {
openScope.focusToggleElement();
closeDropdown();
} else if (openScope.isKeynavEnabled() && [38, 40].indexOf(evt.which) !== -1 && openScope.isOpen) {
evt.preventDefault();
evt.stopPropagation();
openScope.focusDropdownEntry(evt.which);
}
};
}])
.controller('UibDropdownController', ['$scope', '$element', '$attrs', '$parse', 'uibDropdownConfig', 'uibDropdownService', '$animate', '$uibPosition', '$document', '$compile', '$templateRequest', function($scope, $element, $attrs, $parse, dropdownConfig, uibDropdownService, $animate, $position, $document, $compile, $templateRequest) {
var self = this,
scope = $scope.$new(),
templateScope,
appendToOpenClass = dropdownConfig.appendToOpenClass,
openClass = dropdownConfig.openClass,
getIsOpen,
setIsOpen = angular.noop,
toggleInvoker = $attrs.onToggle ? $parse($attrs.onToggle) : angular.noop,
appendToBody = false,
appendTo = null,
keynavEnabled = false,
selectedOption = null,
body = $document.find('body');
$element.addClass('dropdown');
this.init = function() {
if ($attrs.isOpen) {
getIsOpen = $parse($attrs.isOpen);
setIsOpen = getIsOpen.assign;
$scope.$watch(getIsOpen, function(value) {
scope.isOpen = !!value;
});
}
if (angular.isDefined($attrs.dropdownAppendTo)) {
var appendToEl = $parse($attrs.dropdownAppendTo)(scope);
if (appendToEl) {
appendTo = angular.element(appendToEl);
}
}
appendToBody = angular.isDefined($attrs.dropdownAppendToBody);
keynavEnabled = angular.isDefined($attrs.keyboardNav);
if (appendToBody && !appendTo) {
appendTo = body;
}
if (appendTo && self.dropdownMenu) {
appendTo.append(self.dropdownMenu);
$element.on('$destroy', function handleDestroyEvent() {
self.dropdownMenu.remove();
});
}
};
this.toggle = function(open) {
return scope.isOpen = arguments.length ? !!open : !scope.isOpen;
};
this.isOpen = function() {
return scope.isOpen;
};
scope.getToggleElement = function() {
return self.toggleElement;
};
scope.getAutoClose = function() {
return $attrs.autoClose || 'always';
};
scope.getElement = function() {
return $element;
};
scope.isKeynavEnabled = function() {
return keynavEnabled;
};
scope.focusDropdownEntry = function(keyCode) {
var elems = self.dropdownMenu ?
angular.element(self.dropdownMenu).find('a') :
$element.find('ul').eq(0).find('a');
switch (keyCode) {
case 40: {
if (!angular.isNumber(self.selectedOption)) {
self.selectedOption = 0;
} else {
self.selectedOption = self.selectedOption === elems.length - 1 ?
self.selectedOption :
self.selectedOption + 1;
}
break;
}
case 38: {
if (!angular.isNumber(self.selectedOption)) {
self.selectedOption = elems.length - 1;
} else {
self.selectedOption = self.selectedOption === 0 ?
0 : self.selectedOption - 1;
}
break;
}
}
elems[self.selectedOption].focus();
};
scope.getDropdownElement = function() {
return self.dropdownMenu;
};
scope.focusToggleElement = function() {
if (self.toggleElement) {
self.toggleElement[0].focus();
}
};
scope.$watch('isOpen', function(isOpen, wasOpen) {
if (appendTo && self.dropdownMenu) {
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
css,
rightalign;
css = {
top: pos.top + 'px',
display: isOpen ? 'block' : 'none'
};
rightalign = self.dropdownMenu.hasClass('dropdown-menu-right');
if (!rightalign) {
css.left = pos.left + 'px';
css.right = 'auto';
} else {
css.left = 'auto';
css.right = window.innerWidth -
(pos.left + $element.prop('offsetWidth')) + 'px';
}
if (!appendToBody) {
var appendOffset = $position.offset(appendTo);
css.top = pos.top - appendOffset.top + 'px';
if (!rightalign) {
css.left = pos.left - appendOffset.left + 'px';
} else {
css.right = window.innerWidth -
(pos.left - appendOffset.left + $element.prop('offsetWidth')) + 'px';
}
}
self.dropdownMenu.css(css);
}
var openContainer = appendTo ? appendTo : $element;
$animate[isOpen ? 'addClass' : 'removeClass'](openContainer, appendTo ? appendToOpenClass : openClass).then(function() {
if (angular.isDefined(isOpen) && isOpen !== wasOpen) {
toggleInvoker($scope, { open: !!isOpen });
}
});
if (isOpen) {
if (self.dropdownMenuTemplateUrl) {
$templateRequest(self.dropdownMenuTemplateUrl).then(function(tplContent) {
templateScope = scope.$new();
$compile(tplContent.trim())(templateScope, function(dropdownElement) {
var newEl = dropdownElement;
self.dropdownMenu.replaceWith(newEl);
self.dropdownMenu = newEl;
});
});
}
scope.focusToggleElement();
uibDropdownService.open(scope);
} else {
if (self.dropdownMenuTemplateUrl) {
if (templateScope) {
templateScope.$destroy();
}
var newEl = angular.element('<ul class="dropdown-menu"></ul>');
self.dropdownMenu.replaceWith(newEl);
self.dropdownMenu = newEl;
}
uibDropdownService.close(scope);
self.selectedOption = null;
}
if (angular.isFunction(setIsOpen)) {
setIsOpen($scope, isOpen);
}
});
$scope.$on('$locationChangeSuccess', function() {
if (scope.getAutoClose() !== 'disabled') {
scope.isOpen = false;
}
});
}])
.directive('uibDropdown', function() {
return {
controller: 'UibDropdownController',
link: function(scope, element, attrs, dropdownCtrl) {
dropdownCtrl.init();
}
};
})
.directive('uibDropdownMenu', function() {
return {
restrict: 'A',
require: '?^uibDropdown',
link: function(scope, element, attrs, dropdownCtrl) {
if (!dropdownCtrl || angular.isDefined(attrs.dropdownNested)) {
return;
}
element.addClass('dropdown-menu');
var tplUrl = attrs.templateUrl;
if (tplUrl) {
dropdownCtrl.dropdownMenuTemplateUrl = tplUrl;
}
if (!dropdownCtrl.dropdownMenu) {
dropdownCtrl.dropdownMenu = element;
}
}
};
})
.directive('uibDropdownToggle', function() {
return {
require: '?^uibDropdown',
link: function(scope, element, attrs, dropdownCtrl) {
if (!dropdownCtrl) {
return;
}
element.addClass('dropdown-toggle');
dropdownCtrl.toggleElement = element;
var toggleDropdown = function(event) {
event.preventDefault();
if (!element.hasClass('disabled') && !attrs.disabled) {
scope.$apply(function() {
dropdownCtrl.toggle();
});
}
};
element.bind('click', toggleDropdown);
element.attr({ 'aria-haspopup': true, 'aria-expanded': false });
scope.$watch(dropdownCtrl.isOpen, function(isOpen) {
element.attr('aria-expanded', !!isOpen);
});
scope.$on('$destroy', function() {
element.unbind('click', toggleDropdown);
});
}
};
});
angular.module('ui.bootstrap.stackedMap', [])
.factory('$$stackedMap', function() {
return {
createNew: function() {
var stack = [];
return {
add: function(key, value) {
stack.push({
key: key,
value: value
});
},
get: function(key) {
for (var i = 0; i < stack.length; i++) {
if (key === stack[i].key) {
return stack[i];
}
}
},
keys: function() {
var keys = [];
for (var i = 0; i < stack.length; i++) {
keys.push(stack[i].key);
}
return keys;
},
top: function() {
return stack[stack.length - 1];
},
remove: function(key) {
var idx = -1;
for (var i = 0; i < stack.length; i++) {
if (key === stack[i].key) {
idx = i;
break;
}
}
return stack.splice(idx, 1)[0];
},
removeTop: function() {
return stack.splice(stack.length - 1, 1)[0];
},
length: function() {
return stack.length;
}
};
}
};
});
angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
.factory('$$multiMap', function() {
return {
createNew: function() {
var map = {};
return {
entries: function() {
return Object.keys(map).map(function(key) {
return {
key: key,
value: map[key]
};
});
},
get: function(key) {
return map[key];
},
hasKey: function(key) {
return !!map[key];
},
keys: function() {
return Object.keys(map);
},
put: function(key, value) {
if (!map[key]) {
map[key] = [];
}
map[key].push(value);
},
remove: function(key, value) {
var values = map[key];
if (!values) {
return;
}
var idx = values.indexOf(value);
if (idx !== -1) {
values.splice(idx, 1);
}
if (!values.length) {
delete map[key];
}
}
};
}
};
})
.provider('$uibResolve', function() {
var resolve = this;
this.resolver = null;
this.setResolver = function(resolver) {
this.resolver = resolver;
};
this.$get = ['$injector', '$q', function($injector, $q) {
var resolver = resolve.resolver ? $injector.get(resolve.resolver) : null;
return {
resolve: function(invocables, locals, parent, self) {
if (resolver) {
return resolver.resolve(invocables, locals, parent, self);
}
var promises = [];
angular.forEach(invocables, function(value) {
if (angular.isFunction(value) || angular.isArray(value)) {
promises.push($q.resolve($injector.invoke(value)));
} else if (angular.isString(value)) {
promises.push($q.resolve($injector.get(value)));
} else {
promises.push($q.resolve(value));
}
});
return $q.all(promises).then(function(resolves) {
var resolveObj = {};
var resolveIter = 0;
angular.forEach(invocables, function(value, key) {
resolveObj[key] = resolves[resolveIter++];
});
return resolveObj;
});
}
};
}];
})
.directive('uibModalBackdrop', ['$animateCss', '$injector', '$uibModalStack',
function($animateCss, $injector, $modalStack) {
return {
replace: true,
templateUrl: 'uib/template/modal/backdrop.html',
compile: function(tElement, tAttrs) {
tElement.addClass(tAttrs.backdropClass);
return linkFn;
}
};
function linkFn(scope, element, attrs) {
if (attrs.modalInClass) {
$animateCss(element, {
addClass: attrs.modalInClass
}).start();
scope.$on($modalStack.NOW_CLOSING_EVENT, function(e, setIsAsync) {
var done = setIsAsync();
if (scope.modalOptions.animation) {
$animateCss(element, {
removeClass: attrs.modalInClass
}).start().then(done);
} else {
done();
}
});
}
}
}])
.directive('uibModalWindow', ['$uibModalStack', '$q', '$animate', '$animateCss', '$document',
function($modalStack, $q, $animate, $animateCss, $document) {
return {
scope: {
index: '@'
},
replace: true,
transclude: true,
templateUrl: function(tElement, tAttrs) {
return tAttrs.templateUrl || 'uib/template/modal/window.html';
},
link: function(scope, element, attrs) {
element.addClass(attrs.windowClass || '');
element.addClass(attrs.windowTopClass || '');
scope.size = attrs.size;
scope.close = function(evt) {
var modal = $modalStack.getTop();
if (modal && modal.value.backdrop &&
modal.value.backdrop !== 'static' &&
evt.target === evt.currentTarget) {
evt.preventDefault();
evt.stopPropagation();
$modalStack.dismiss(modal.key, 'backdrop click');
}
};
element.on('click', scope.close);
scope.$isRendered = true;
var modalRenderDeferObj = $q.defer();
attrs.$observe('modalRender', function(value) {
if (value === 'true') {
modalRenderDeferObj.resolve();
}
});
modalRenderDeferObj.promise.then(function() {
var animationPromise = null;
if (attrs.modalInClass) {
animationPromise = $animateCss(element, {
addClass: attrs.modalInClass
}).start();
scope.$on($modalStack.NOW_CLOSING_EVENT, function(e, setIsAsync) {
var done = setIsAsync();
if ($animateCss) {
$animateCss(element, {
removeClass: attrs.modalInClass
}).start().then(done);
} else {
$animate.removeClass(element, attrs.modalInClass).then(done);
}
});
}
$q.when(animationPromise).then(function() {
if (!($document[0].activeElement && element[0].contains($document[0].activeElement))) {
var inputWithAutofocus = element[0].querySelector('[autofocus]');
if (inputWithAutofocus) {
inputWithAutofocus.focus();
} else {
element[0].focus();
}
}
});
var modal = $modalStack.getTop();
if (modal) {
$modalStack.modalRendered(modal.key);
}
});
}
};
}])
.directive('uibModalAnimationClass', function() {
return {
compile: function(tElement, tAttrs) {
if (tAttrs.modalAnimation) {
tElement.addClass(tAttrs.uibModalAnimationClass);
}
}
};
})
.directive('uibModalTransclude', function() {
return {
link: function(scope, element, attrs, controller, transclude) {
transclude(scope.$parent, function(clone) {
element.empty();
element.append(clone);
});
}
};
})
.factory('$uibModalStack', ['$animate', '$animateCss', '$document',
'$compile', '$rootScope', '$q', '$$multiMap', '$$stackedMap',
function($animate, $animateCss, $document, $compile, $rootScope, $q, $$multiMap, $$stackedMap) {
var OPENED_MODAL_CLASS = 'modal-open';
var backdropDomEl, backdropScope;
var openedWindows = $$stackedMap.createNew();
var openedClasses = $$multiMap.createNew();
var $modalStack = {
NOW_CLOSING_EVENT: 'modal.stack.now-closing'
};
var focusableElementList;
var focusIndex = 0;
var tababbleSelector = 'a[href], area[href], input:not([disabled]), ' +
'button:not([disabled]),select:not([disabled]), textarea:not([disabled]), ' +
'iframe, object, embed, *[tabindex], *[contenteditable=true]';
function backdropIndex() {
var topBackdropIndex = -1;
var opened = openedWindows.keys();
for (var i = 0; i < opened.length; i++) {
if (openedWindows.get(opened[i]).value.backdrop) {
topBackdropIndex = i;
}
}
return topBackdropIndex;
}
$rootScope.$watch(backdropIndex, function(newBackdropIndex) {
if (backdropScope) {
backdropScope.index = newBackdropIndex;
}
});
function removeModalWindow(modalInstance, elementToReceiveFocus) {
var modalWindow = openedWindows.get(modalInstance).value;
var appendToElement = modalWindow.appendTo;
openedWindows.remove(modalInstance);
removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, function() {
var modalBodyClass = modalWindow.openedClass || OPENED_MODAL_CLASS;
openedClasses.remove(modalBodyClass, modalInstance);
appendToElement.toggleClass(modalBodyClass, openedClasses.hasKey(modalBodyClass));
toggleTopWindowClass(true);
}, modalWindow.closedDeferred);
checkRemoveBackdrop();
if (elementToReceiveFocus && elementToReceiveFocus.focus) {
elementToReceiveFocus.focus();
} else if (appendToElement.focus) {
appendToElement.focus();
}
}
function toggleTopWindowClass(toggleSwitch) {
var modalWindow;
if (openedWindows.length() > 0) {
modalWindow = openedWindows.top().value;
modalWindow.modalDomEl.toggleClass(modalWindow.windowTopClass || '', toggleSwitch);
}
}
function checkRemoveBackdrop() {
if (backdropDomEl && backdropIndex() === -1) {
var backdropScopeRef = backdropScope;
removeAfterAnimate(backdropDomEl, backdropScope, function() {
backdropScopeRef = null;
});
backdropDomEl = undefined;
backdropScope = undefined;
}
}
function removeAfterAnimate(domEl, scope, done, closedDeferred) {
var asyncDeferred;
var asyncPromise = null;
var setIsAsync = function() {
if (!asyncDeferred) {
asyncDeferred = $q.defer();
asyncPromise = asyncDeferred.promise;
}
return function asyncDone() {
asyncDeferred.resolve();
};
};
scope.$broadcast($modalStack.NOW_CLOSING_EVENT, setIsAsync);
return $q.when(asyncPromise).then(afterAnimating);
function afterAnimating() {
if (afterAnimating.done) {
return;
}
afterAnimating.done = true;
$animateCss(domEl, {
event: 'leave'
}).start().then(function() {
domEl.remove();
if (closedDeferred) {
closedDeferred.resolve();
}
});
scope.$destroy();
if (done) {
done();
}
}
}
$document.on('keydown', keydownListener);
$rootScope.$on('$destroy', function() {
$document.off('keydown', keydownListener);
});
function keydownListener(evt) {
if (evt.isDefaultPrevented()) {
return evt;
}
var modal = openedWindows.top();
if (modal) {
switch (evt.which) {
case 27: {
if (modal.value.keyboard) {
evt.preventDefault();
$rootScope.$apply(function() {
$modalStack.dismiss(modal.key, 'escape key press');
});
}
break;
}
case 9: {
$modalStack.loadFocusElementList(modal);
var focusChanged = false;
if (evt.shiftKey) {
if ($modalStack.isFocusInFirstItem(evt) || $modalStack.isModalFocused(evt, modal)) {
focusChanged = $modalStack.focusLastFocusableElement();
}
} else {
if ($modalStack.isFocusInLastItem(evt)) {
focusChanged = $modalStack.focusFirstFocusableElement();
}
}
if (focusChanged) {
evt.preventDefault();
evt.stopPropagation();
}
break;
}
}
}
}
$modalStack.open = function(modalInstance, modal) {
var modalOpener = $document[0].activeElement,
modalBodyClass = modal.openedClass || OPENED_MODAL_CLASS;
toggleTopWindowClass(false);
openedWindows.add(modalInstance, {
deferred: modal.deferred,
renderDeferred: modal.renderDeferred,
closedDeferred: modal.closedDeferred,
modalScope: modal.scope,
backdrop: modal.backdrop,
keyboard: modal.keyboard,
openedClass: modal.openedClass,
windowTopClass: modal.windowTopClass,
animation: modal.animation,
appendTo: modal.appendTo
});
openedClasses.put(modalBodyClass, modalInstance);
var appendToElement = modal.appendTo,
currBackdropIndex = backdropIndex();
if (!appendToElement.length) {
throw new Error('appendTo element not found. Make sure that the element passed is in DOM.');
}
if (currBackdropIndex >= 0 && !backdropDomEl) {
backdropScope = $rootScope.$new(true);
backdropScope.modalOptions = modal;
backdropScope.index = currBackdropIndex;
backdropDomEl = angular.element('<div uib-modal-backdrop="modal-backdrop"></div>');
backdropDomEl.attr('backdrop-class', modal.backdropClass);
if (modal.animation) {
backdropDomEl.attr('modal-animation', 'true');
}
$compile(backdropDomEl)(backdropScope);
$animate.enter(backdropDomEl, appendToElement);
}
var angularDomEl = angular.element('<div uib-modal-window="modal-window"></div>');
angularDomEl.attr({
'template-url': modal.windowTemplateUrl,
'window-class': modal.windowClass,
'window-top-class': modal.windowTopClass,
'size': modal.size,
'index': openedWindows.length() - 1,
'animate': 'animate'
}).html(modal.content);
if (modal.animation) {
angularDomEl.attr('modal-animation', 'true');
}
$animate.enter($compile(angularDomEl)(modal.scope), appendToElement)
.then(function() {
$animate.addClass(appendToElement, modalBodyClass);
});
openedWindows.top().value.modalDomEl = angularDomEl;
openedWindows.top().value.modalOpener = modalOpener;
$modalStack.clearFocusListCache();
};
function broadcastClosing(modalWindow, resultOrReason, closing) {
return !modalWindow.value.modalScope.$broadcast('modal.closing', resultOrReason, closing).defaultPrevented;
}
$modalStack.close = function(modalInstance, result) {
var modalWindow = openedWindows.get(modalInstance);
if (modalWindow && broadcastClosing(modalWindow, result, true)) {
modalWindow.value.modalScope.$$uibDestructionScheduled = true;
modalWindow.value.deferred.resolve(result);
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
return true;
}
return !modalWindow;
};
$modalStack.dismiss = function(modalInstance, reason) {
var modalWindow = openedWindows.get(modalInstance);
if (modalWindow && broadcastClosing(modalWindow, reason, false)) {
modalWindow.value.modalScope.$$uibDestructionScheduled = true;
modalWindow.value.deferred.reject(reason);
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
return true;
}
return !modalWindow;
};
$modalStack.dismissAll = function(reason) {
var topModal = this.getTop();
while (topModal && this.dismiss(topModal.key, reason)) {
topModal = this.getTop();
}
};
$modalStack.getTop = function() {
return openedWindows.top();
};
$modalStack.modalRendered = function(modalInstance) {
var modalWindow = openedWindows.get(modalInstance);
if (modalWindow) {
modalWindow.value.renderDeferred.resolve();
}
};
$modalStack.focusFirstFocusableElement = function() {
if (focusableElementList.length > 0) {
focusableElementList[0].focus();
return true;
}
return false;
};
$modalStack.focusLastFocusableElement = function() {
if (focusableElementList.length > 0) {
focusableElementList[focusableElementList.length - 1].focus();
return true;
}
return false;
};
$modalStack.isModalFocused = function(evt, modalWindow) {
if (evt && modalWindow) {
var modalDomEl = modalWindow.value.modalDomEl;
if (modalDomEl && modalDomEl.length) {
return (evt.target || evt.srcElement) === modalDomEl[0];
}
}
return false;
};
$modalStack.isFocusInFirstItem = function(evt) {
if (focusableElementList.length > 0) {
return (evt.target || evt.srcElement) === focusableElementList[0];
}
return false;
};
$modalStack.isFocusInLastItem = function(evt) {
if (focusableElementList.length > 0) {
return (evt.target || evt.srcElement) === focusableElementList[focusableElementList.length - 1];
}
return false;
};
$modalStack.clearFocusListCache = function() {
focusableElementList = [];
focusIndex = 0;
};
$modalStack.loadFocusElementList = function(modalWindow) {
if (focusableElementList === undefined || !focusableElementList.length) {
if (modalWindow) {
var modalDomE1 = modalWindow.value.modalDomEl;
if (modalDomE1 && modalDomE1.length) {
focusableElementList = modalDomE1[0].querySelectorAll(tababbleSelector);
}
}
}
};
return $modalStack;
}])
.provider('$uibModal', function() {
var $modalProvider = {
options: {
animation: true,
backdrop: true,
keyboard: true
},
$get: ['$rootScope', '$q', '$document', '$templateRequest', '$controller', '$uibResolve', '$uibModalStack',
function ($rootScope, $q, $document, $templateRequest, $controller, $uibResolve, $modalStack) {
var $modal = {};
function getTemplatePromise(options) {
return options.template ? $q.when(options.template) :
$templateRequest(angular.isFunction(options.templateUrl) ?
options.templateUrl() : options.templateUrl);
}
var promiseChain = null;
$modal.getPromiseChain = function() {
return promiseChain;
};
$modal.open = function(modalOptions) {
var modalResultDeferred = $q.defer();
var modalOpenedDeferred = $q.defer();
var modalClosedDeferred = $q.defer();
var modalRenderDeferred = $q.defer();
var modalInstance = {
result: modalResultDeferred.promise,
opened: modalOpenedDeferred.promise,
closed: modalClosedDeferred.promise,
rendered: modalRenderDeferred.promise,
close: function (result) {
return $modalStack.close(modalInstance, result);
},
dismiss: function (reason) {
return $modalStack.dismiss(modalInstance, reason);
}
};
modalOptions = angular.extend({}, $modalProvider.options, modalOptions);
modalOptions.resolve = modalOptions.resolve || {};
modalOptions.appendTo = modalOptions.appendTo || $document.find('body').eq(0);
if (!modalOptions.template && !modalOptions.templateUrl) {
throw new Error('One of template or templateUrl options is required.');
}
var templateAndResolvePromise =
$q.all([getTemplatePromise(modalOptions), $uibResolve.resolve(modalOptions.resolve, {}, null, null)]);
function resolveWithTemplate() {
return templateAndResolvePromise;
}
var samePromise;
samePromise = promiseChain = $q.all([promiseChain])
.then(resolveWithTemplate, resolveWithTemplate)
.then(function resolveSuccess(tplAndVars) {
var providedScope = modalOptions.scope || $rootScope;
var modalScope = providedScope.$new();
modalScope.$close = modalInstance.close;
modalScope.$dismiss = modalInstance.dismiss;
modalScope.$on('$destroy', function() {
if (!modalScope.$$uibDestructionScheduled) {
modalScope.$dismiss('$uibUnscheduledDestruction');
}
});
var ctrlInstance, ctrlLocals = {};
if (modalOptions.controller) {
ctrlLocals.$scope = modalScope;
ctrlLocals.$uibModalInstance = modalInstance;
angular.forEach(tplAndVars[1], function(value, key) {
ctrlLocals[key] = value;
});
ctrlInstance = $controller(modalOptions.controller, ctrlLocals);
if (modalOptions.controllerAs) {
if (modalOptions.bindToController) {
ctrlInstance.$close = modalScope.$close;
ctrlInstance.$dismiss = modalScope.$dismiss;
angular.extend(ctrlInstance, providedScope);
}
modalScope[modalOptions.controllerAs] = ctrlInstance;
}
}
$modalStack.open(modalInstance, {
scope: modalScope,
deferred: modalResultDeferred,
renderDeferred: modalRenderDeferred,
closedDeferred: modalClosedDeferred,
content: tplAndVars[0],
animation: modalOptions.animation,
backdrop: modalOptions.backdrop,
keyboard: modalOptions.keyboard,
backdropClass: modalOptions.backdropClass,
windowTopClass: modalOptions.windowTopClass,
windowClass: modalOptions.windowClass,
windowTemplateUrl: modalOptions.windowTemplateUrl,
size: modalOptions.size,
openedClass: modalOptions.openedClass,
appendTo: modalOptions.appendTo
});
modalOpenedDeferred.resolve(true);
}, function resolveError(reason) {
modalOpenedDeferred.reject(reason);
modalResultDeferred.reject(reason);
})['finally'](function() {
if (promiseChain === samePromise) {
promiseChain = null;
}
});
return modalInstance;
};
return $modal;
}
]
};
return $modalProvider;
});
angular.module('ui.bootstrap.paging', [])
.factory('uibPaging', ['$parse', function($parse) {
return {
create: function(ctrl, $scope, $attrs) {
ctrl.setNumPages = $attrs.numPages ? $parse($attrs.numPages).assign : angular.noop;
ctrl.ngModelCtrl = { $setViewValue: angular.noop };
ctrl._watchers = [];
ctrl.init = function(ngModelCtrl, config) {
ctrl.ngModelCtrl = ngModelCtrl;
ctrl.config = config;
ngModelCtrl.$render = function() {
ctrl.render();
};
if ($attrs.itemsPerPage) {
ctrl._watchers.push($scope.$parent.$watch($parse($attrs.itemsPerPage), function(value) {
ctrl.itemsPerPage = parseInt(value, 10);
$scope.totalPages = ctrl.calculateTotalPages();
ctrl.updatePage();
}));
} else {
ctrl.itemsPerPage = config.itemsPerPage;
}
$scope.$watch('totalItems', function(newTotal, oldTotal) {
if (angular.isDefined(newTotal) || newTotal !== oldTotal) {
$scope.totalPages = ctrl.calculateTotalPages();
ctrl.updatePage();
}
});
};
ctrl.calculateTotalPages = function() {
var totalPages = ctrl.itemsPerPage < 1 ? 1 : Math.ceil($scope.totalItems / ctrl.itemsPerPage);
return Math.max(totalPages || 0, 1);
};
ctrl.render = function() {
$scope.page = parseInt(ctrl.ngModelCtrl.$viewValue, 10) || 1;
};
$scope.selectPage = function(page, evt) {
if (evt) {
evt.preventDefault();
}
var clickAllowed = !$scope.ngDisabled || !evt;
if (clickAllowed && $scope.page !== page && page > 0 && page <= $scope.totalPages) {
if (evt && evt.target) {
evt.target.blur();
}
ctrl.ngModelCtrl.$setViewValue(page);
ctrl.ngModelCtrl.$render();
}
};
$scope.getText = function(key) {
return $scope[key + 'Text'] || ctrl.config[key + 'Text'];
};
$scope.noPrevious = function() {
return $scope.page === 1;
};
$scope.noNext = function() {
return $scope.page === $scope.totalPages;
};
ctrl.updatePage = function() {
ctrl.setNumPages($scope.$parent, $scope.totalPages);
if ($scope.page > $scope.totalPages) {
$scope.selectPage($scope.totalPages);
} else {
ctrl.ngModelCtrl.$render();
}
};
$scope.$on('$destroy', function() {
while (ctrl._watchers.length) {
ctrl._watchers.shift()();
}
});
}
};
}]);
angular.module('ui.bootstrap.pager', ['ui.bootstrap.paging'])
.controller('UibPagerController', ['$scope', '$attrs', 'uibPaging', 'uibPagerConfig', function($scope, $attrs, uibPaging, uibPagerConfig) {
$scope.align = angular.isDefined($attrs.align) ? $scope.$parent.$eval($attrs.align) : uibPagerConfig.align;
uibPaging.create(this, $scope, $attrs);
}])
.constant('uibPagerConfig', {
itemsPerPage: 10,
previousText: '« Previous',
nextText: 'Next »',
align: true
})
.directive('uibPager', ['uibPagerConfig', function(uibPagerConfig) {
return {
scope: {
totalItems: '=',
previousText: '@',
nextText: '@',
ngDisabled: '='
},
require: ['uibPager', '?ngModel'],
controller: 'UibPagerController',
controllerAs: 'pager',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/pager/pager.html';
},
replace: true,
link: function(scope, element, attrs, ctrls) {
var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1];
if (!ngModelCtrl) {
return;
}
paginationCtrl.init(ngModelCtrl, uibPagerConfig);
}
};
}]);
angular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging'])
.controller('UibPaginationController', ['$scope', '$attrs', '$parse', 'uibPaging', 'uibPaginationConfig', function($scope, $attrs, $parse, uibPaging, uibPaginationConfig) {
var ctrl = this;
var maxSize = angular.isDefined($attrs.maxSize) ? $scope.$parent.$eval($attrs.maxSize) : uibPaginationConfig.maxSize,
rotate = angular.isDefined($attrs.rotate) ? $scope.$parent.$eval($attrs.rotate) : uibPaginationConfig.rotate,
forceEllipses = angular.isDefined($attrs.forceEllipses) ? $scope.$parent.$eval($attrs.forceEllipses) : uibPaginationConfig.forceEllipses,
boundaryLinkNumbers = angular.isDefined($attrs.boundaryLinkNumbers) ? $scope.$parent.$eval($attrs.boundaryLinkNumbers) : uibPaginationConfig.boundaryLinkNumbers;
$scope.boundaryLinks = angular.isDefined($attrs.boundaryLinks) ? $scope.$parent.$eval($attrs.boundaryLinks) : uibPaginationConfig.boundaryLinks;
$scope.directionLinks = angular.isDefined($attrs.directionLinks) ? $scope.$parent.$eval($attrs.directionLinks) : uibPaginationConfig.directionLinks;
uibPaging.create(this, $scope, $attrs);
if ($attrs.maxSize) {
ctrl._watchers.push($scope.$parent.$watch($parse($attrs.maxSize), function(value) {
maxSize = parseInt(value, 10);
ctrl.render();
}));
}
function makePage(number, text, isActive) {
return {
number: number,
text: text,
active: isActive
};
}
function getPages(currentPage, totalPages) {
var pages = [];
var startPage = 1, endPage = totalPages;
var isMaxSized = angular.isDefined(maxSize) && maxSize < totalPages;
if (isMaxSized) {
if (rotate) {
startPage = Math.max(currentPage - Math.floor(maxSize / 2), 1);
endPage = startPage + maxSize - 1;
if (endPage > totalPages) {
endPage = totalPages;
startPage = endPage - maxSize + 1;
}
} else {
startPage = (Math.ceil(currentPage / maxSize) - 1) * maxSize + 1;
endPage = Math.min(startPage + maxSize - 1, totalPages);
}
}
for (var number = startPage; number <= endPage; number++) {
var page = makePage(number, number, number === currentPage);
pages.push(page);
}
if (isMaxSized && maxSize > 0 && (!rotate || forceEllipses || boundaryLinkNumbers)) {
if (startPage > 1) {
if (!boundaryLinkNumbers || startPage > 3) {
var previousPageSet = makePage(startPage - 1, '...', false);
pages.unshift(previousPageSet);
}
if (boundaryLinkNumbers) {
if (startPage === 3) {
var secondPageLink = makePage(2, '2', false);
pages.unshift(secondPageLink);
}
var firstPageLink = makePage(1, '1', false);
pages.unshift(firstPageLink);
}
}
if (endPage < totalPages) {
if (!boundaryLinkNumbers || endPage < totalPages - 2) {
var nextPageSet = makePage(endPage + 1, '...', false);
pages.push(nextPageSet);
}
if (boundaryLinkNumbers) {
if (endPage === totalPages - 2) {
var secondToLastPageLink = makePage(totalPages - 1, totalPages - 1, false);
pages.push(secondToLastPageLink);
}
var lastPageLink = makePage(totalPages, totalPages, false);
pages.push(lastPageLink);
}
}
}
return pages;
}
var originalRender = this.render;
this.render = function() {
originalRender();
if ($scope.page > 0 && $scope.page <= $scope.totalPages) {
$scope.pages = getPages($scope.page, $scope.totalPages);
}
};
}])
.constant('uibPaginationConfig', {
itemsPerPage: 10,
boundaryLinks: false,
boundaryLinkNumbers: false,
directionLinks: true,
firstText: 'First',
previousText: 'Previous',
nextText: 'Next',
lastText: 'Last',
rotate: true,
forceEllipses: false
})
.directive('uibPagination', ['$parse', 'uibPaginationConfig', function($parse, uibPaginationConfig) {
return {
scope: {
totalItems: '=',
firstText: '@',
previousText: '@',
nextText: '@',
lastText: '@',
ngDisabled:'='
},
require: ['uibPagination', '?ngModel'],
controller: 'UibPaginationController',
controllerAs: 'pagination',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'uib/template/pagination/pagination.html';
},
replace: true,
link: function(scope, element, attrs, ctrls) {
var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1];
if (!ngModelCtrl) {
return;
}
paginationCtrl.init(ngModelCtrl, uibPaginationConfig);
}
};
}]);
angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.stackedMap'])
.provider('$uibTooltip', function() {
var defaultOptions = {
placement: 'top',
placementClassPrefix: '',
animation: true,
popupDelay: 0,
popupCloseDelay: 0,
useContentExp: false
};
var triggerMap = {
'mouseenter': 'mouseleave',
'click': 'click',
'outsideClick': 'outsideClick',
'focus': 'blur',
'none': ''
};
var globalOptions = {};
this.options = function(value) {
angular.extend(globalOptions, value);
};
this.setTriggers = function setTriggers(triggers) {
angular.extend(triggerMap, triggers);
};
function snake_case(name) {
var regexp = /[A-Z]/g;
var separator = '-';
return name.replace(regexp, function(letter, pos) {
return (pos ? separator : '') + letter.toLowerCase();
});
}
this.$get = ['$window', '$compile', '$timeout', '$document', '$uibPosition', '$interpolate', '$rootScope', '$parse', '$$stackedMap', function($window, $compile, $timeout, $document, $position, $interpolate, $rootScope, $parse, $$stackedMap) {
var openedTooltips = $$stackedMap.createNew();
$document.on('keypress', keypressListener);
$rootScope.$on('$destroy', function() {
$document.off('keypress', keypressListener);
});
function keypressListener(e) {
if (e.which === 27) {
var last = openedTooltips.top();
if (last) {
last.value.close();
openedTooltips.removeTop();
last = null;
}
}
}
return function $tooltip(ttType, prefix, defaultTriggerShow, options) {
options = angular.extend({}, defaultOptions, globalOptions, options);
function getTriggers(trigger) {
var show = (trigger || options.trigger || defaultTriggerShow).split(' ');
var hide = show.map(function(trigger) {
return triggerMap[trigger] || trigger;
});
return {
show: show,
hide: hide
};
}
var directiveName = snake_case(ttType);
var startSym = $interpolate.startSymbol();
var endSym = $interpolate.endSymbol();
var template =
'<div '+ directiveName + '-popup '+
'title="' + startSym + 'title' + endSym + '" '+
(options.useContentExp ?
'content-exp="contentExp()" ' :
'content="' + startSym + 'content' + endSym + '" ') +
'placement="' + startSym + 'placement' + endSym + '" '+
'popup-class="' + startSym + 'popupClass' + endSym + '" '+
'animation="animation" ' +
'is-open="isOpen"' +
'origin-scope="origScope" ' +
'style="visibility: hidden; display: block; top: -9999px; left: -9999px;"' +
'>' +
'</div>';
return {
compile: function(tElem, tAttrs) {
var tooltipLinker = $compile(template);
return function link(scope, element, attrs, tooltipCtrl) {
var tooltip;
var tooltipLinkedScope;
var transitionTimeout;
var showTimeout;
var hideTimeout;
var positionTimeout;
var appendToBody = angular.isDefined(options.appendToBody) ? options.appendToBody : false;
var triggers = getTriggers(undefined);
var hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']);
var ttScope = scope.$new(true);
var repositionScheduled = false;
var isOpenParse = angular.isDefined(attrs[prefix + 'IsOpen']) ? $parse(attrs[prefix + 'IsOpen']) : false;
var contentParse = options.useContentExp ? $parse(attrs[ttType]) : false;
var observers = [];
var positionTooltip = function() {
if (!tooltip || !tooltip.html()) { return; }
if (!positionTimeout) {
positionTimeout = $timeout(function() {
tooltip.css({ top: 0, left: 0 });
var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
tooltip.css({ top: ttPosition.top + 'px', left: ttPosition.left + 'px', visibility: 'visible' });
if (options.placementClassPrefix) {
tooltip.removeClass('top bottom left right');
}
tooltip.removeClass(
options.placementClassPrefix + 'top ' +
options.placementClassPrefix + 'top-left ' +
options.placementClassPrefix + 'top-right ' +
options.placementClassPrefix + 'bottom ' +
options.placementClassPrefix + 'bottom-left ' +
options.placementClassPrefix + 'bottom-right ' +
options.placementClassPrefix + 'left ' +
options.placementClassPrefix + 'left-top ' +
options.placementClassPrefix + 'left-bottom ' +
options.placementClassPrefix + 'right ' +
options.placementClassPrefix + 'right-top ' +
options.placementClassPrefix + 'right-bottom');
var placement = ttPosition.placement.split('-');
tooltip.addClass(placement[0] + ' ' + options.placementClassPrefix + ttPosition.placement);
$position.positionArrow(tooltip, ttPosition.placement);
positionTimeout = null;
}, 0, false);
}
};
ttScope.origScope = scope;
ttScope.isOpen = false;
openedTooltips.add(ttScope, {
close: hide
});
function toggleTooltipBind() {
if (!ttScope.isOpen) {
showTooltipBind();
} else {
hideTooltipBind();
}
}
function showTooltipBind() {
if (hasEnableExp && !scope.$eval(attrs[prefix + 'Enable'])) {
return;
}
cancelHide();
prepareTooltip();
if (ttScope.popupDelay) {
if (!showTimeout) {
showTimeout = $timeout(show, ttScope.popupDelay, false);
}
} else {
show();
}
}
function hideTooltipBind() {
cancelShow();
if (ttScope.popupCloseDelay) {
if (!hideTimeout) {
hideTimeout = $timeout(hide, ttScope.popupCloseDelay, false);
}
} else {
hide();
}
}
function show() {
cancelShow();
cancelHide();
if (!ttScope.content) {
return angular.noop;
}
createTooltip();
ttScope.$evalAsync(function() {
ttScope.isOpen = true;
assignIsOpen(true);
positionTooltip();
});
}
function cancelShow() {
if (showTimeout) {
$timeout.cancel(showTimeout);
showTimeout = null;
}
if (positionTimeout) {
$timeout.cancel(positionTimeout);
positionTimeout = null;
}
}
function hide() {
if (!ttScope) {
return;
}
ttScope.$evalAsync(function() {
if (ttScope) {
ttScope.isOpen = false;
assignIsOpen(false);
if (ttScope.animation) {
if (!transitionTimeout) {
transitionTimeout = $timeout(removeTooltip, 150, false);
}
} else {
removeTooltip();
}
}
});
}
function cancelHide() {
if (hideTimeout) {
$timeout.cancel(hideTimeout);
hideTimeout = null;
}
if (transitionTimeout) {
$timeout.cancel(transitionTimeout);
transitionTimeout = null;
}
}
function createTooltip() {
if (tooltip) {
return;
}
tooltipLinkedScope = ttScope.$new();
tooltip = tooltipLinker(tooltipLinkedScope, function(tooltip) {
if (appendToBody) {
$document.find('body').append(tooltip);
} else {
element.after(tooltip);
}
});
prepObservers();
}
function removeTooltip() {
cancelShow();
cancelHide();
unregisterObservers();
if (tooltip) {
tooltip.remove();
tooltip = null;
}
if (tooltipLinkedScope) {
tooltipLinkedScope.$destroy();
tooltipLinkedScope = null;
}
}
function prepareTooltip() {
ttScope.title = attrs[prefix + 'Title'];
if (contentParse) {
ttScope.content = contentParse(scope);
} else {
ttScope.content = attrs[ttType];
}
ttScope.popupClass = attrs[prefix + 'Class'];
ttScope.placement = angular.isDefined(attrs[prefix + 'Placement']) ? attrs[prefix + 'Placement'] : options.placement;
var delay = parseInt(attrs[prefix + 'PopupDelay'], 10);
var closeDelay = parseInt(attrs[prefix + 'PopupCloseDelay'], 10);
ttScope.popupDelay = !isNaN(delay) ? delay : options.popupDelay;
ttScope.popupCloseDelay = !isNaN(closeDelay) ? closeDelay : options.popupCloseDelay;
}
function assignIsOpen(isOpen) {
if (isOpenParse && angular.isFunction(isOpenParse.assign)) {
isOpenParse.assign(scope, isOpen);
}
}
ttScope.contentExp = function() {
return ttScope.content;
};
attrs.$observe('disabled', function(val) {
if (val) {
cancelShow();
}
if (val && ttScope.isOpen) {
hide();
}
});
if (isOpenParse) {
scope.$watch(isOpenParse, function(val) {
if (ttScope && !val === ttScope.isOpen) {
toggleTooltipBind();
}
});
}
function prepObservers() {
observers.length = 0;
if (contentParse) {
observers.push(
scope.$watch(contentParse, function(val) {
ttScope.content = val;
if (!val && ttScope.isOpen) {
hide();
}
})
);
observers.push(
tooltipLinkedScope.$watch(function() {
if (!repositionScheduled) {
repositionScheduled = true;
tooltipLinkedScope.$$postDigest(function() {
repositionScheduled = false;
if (ttScope && ttScope.isOpen) {
positionTooltip();
}
});
}
})
);
} else {
observers.push(
attrs.$observe(ttType, function(val) {
ttScope.content = val;
if (!val && ttScope.isOpen) {
hide();
} else {
positionTooltip();
}
})
);
}
observers.push(
attrs.$observe(prefix + 'Title', function(val) {
ttScope.title = val;
if (ttScope.isOpen) {
positionTooltip();
}
})
);
observers.push(
attrs.$observe(prefix + 'Placement', function(val) {
ttScope.placement = val ? val : options.placement;
if (ttScope.isOpen) {
positionTooltip();
}
})
);
}
function unregisterObservers() {
if (observers.length) {
angular.forEach(observers, function(observer) {
observer();
});
observers.length = 0;
}
}
function bodyHideTooltipBind(e) {
if (!ttScope || !ttScope.isOpen || !tooltip) {
return;
}
if (!element[0].contains(e.target) && !tooltip[0].contains(e.target)) {
hideTooltipBind();
}
}
var unregisterTriggers = function() {
triggers.show.forEach(function(trigger) {
if (trigger === 'outsideClick') {
element.off('click', toggleTooltipBind);
} else {
element.off(trigger, showTooltipBind);
element.off(trigger, toggleTooltipBind);
}
});
triggers.hide.forEach(function(trigger) {
if (trigger === 'outsideClick') {
$document.off('click', bodyHideTooltipBind);
} else {
element.off(trigger, hideTooltipBind);
}
});
};
function prepTriggers() {
var val = attrs[prefix + 'Trigger'];
unregisterTriggers();
triggers = getTriggers(val);
if (triggers.show !== 'none') {
triggers.show.forEach(function(trigger, idx) {
if (trigger === 'outsideClick') {
element.on('click', toggleTooltipBind);
$document.on('click', bodyHideTooltipBind);
} else if (trigger === triggers.hide[idx]) {
element.on(trigger, toggleTooltipBind);
} else if (trigger) {
element.on(trigger, showTooltipBind);
element.on(triggers.hide[idx], hideTooltipBind);
}
element.on('keypress', function(e) {
if (e.which === 27) {
hideTooltipBind();
}
});
});
}
}
prepTriggers();
var animation = scope.$eval(attrs[prefix + 'Animation']);
ttScope.animation = angular.isDefined(animation) ? !!animation : options.animation;
var appendToBodyVal;
var appendKey = prefix + 'AppendToBody';
if (appendKey in attrs && attrs[appendKey] === undefined) {
appendToBodyVal = true;
} else {
appendToBodyVal = scope.$eval(attrs[appendKey]);
}
appendToBody = angular.isDefined(appendToBodyVal) ? appendToBodyVal : appendToBody;
scope.$on('$destroy', function onDestroyTooltip() {
unregisterTriggers();
removeTooltip();
openedTooltips.remove(ttScope);
ttScope = null;
});
};
}
};
};
}];
})
.directive('uibTooltipTemplateTransclude', [
'$animate', '$sce', '$compile', '$templateRequest',
function ($animate, $sce, $compile, $templateRequest) {
return {
link: function(scope, elem, attrs) {
var origScope = scope.$eval(attrs.tooltipTemplateTranscludeScope);
var changeCounter = 0,
currentScope,
previousElement,
currentElement;
var cleanupLastIncludeContent = function() {
if (previousElement) {
previousElement.remove();
previousElement = null;
}
if (currentScope) {
currentScope.$destroy();
currentScope = null;
}
if (currentElement) {
$animate.leave(currentElement).then(function() {
previousElement = null;
});
previousElement = currentElement;
currentElement = null;
}
};
scope.$watch($sce.parseAsResourceUrl(attrs.uibTooltipTemplateTransclude), function(src) {
var thisChangeId = ++changeCounter;
if (src) {
$templateRequest(src, true).then(function(response) {
if (thisChangeId !== changeCounter) { return; }
var newScope = origScope.$new();
var template = response;
var clone = $compile(template)(newScope, function(clone) {
cleanupLastIncludeContent();
$animate.enter(clone, elem);
});
currentScope = newScope;
currentElement = clone;
currentScope.$emit('$includeContentLoaded', src);
}, function() {
if (thisChangeId === changeCounter) {
cleanupLastIncludeContent();
scope.$emit('$includeContentError', src);
}
});
scope.$emit('$includeContentRequested', src);
} else {
cleanupLastIncludeContent();
}
});
scope.$on('$destroy', cleanupLastIncludeContent);
}
};
}])
.directive('uibTooltipClasses', ['$uibPosition', function($uibPosition) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
if (scope.placement) {
var position = $uibPosition.parsePlacement(scope.placement);
element.addClass(position[0]);
} else {
element.addClass('top');
}
if (scope.popupClass) {
element.addClass(scope.popupClass);
}
if (scope.animation()) {
element.addClass(attrs.tooltipAnimationClass);
}
}
};
}])
.directive('uibTooltipPopup', function() {
return {
replace: true,
scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
templateUrl: 'uib/template/tooltip/tooltip-popup.html'
};
})
.directive('uibTooltip', [ '$uibTooltip', function($uibTooltip) {
return $uibTooltip('uibTooltip', 'tooltip', 'mouseenter');
}])
.directive('uibTooltipTemplatePopup', function() {
return {
replace: true,
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
originScope: '&' },
templateUrl: 'uib/template/tooltip/tooltip-template-popup.html'
};
})
.directive('uibTooltipTemplate', ['$uibTooltip', function($uibTooltip) {
return $uibTooltip('uibTooltipTemplate', 'tooltip', 'mouseenter', {
useContentExp: true
});
}])
.directive('uibTooltipHtmlPopup', function() {
return {
replace: true,
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
templateUrl: 'uib/template/tooltip/tooltip-html-popup.html'
};
})
.directive('uibTooltipHtml', ['$uibTooltip', function($uibTooltip) {
return $uibTooltip('uibTooltipHtml', 'tooltip', 'mouseenter', {
useContentExp: true
});
}]);
angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
.directive('uibPopoverTemplatePopup', function() {
return {
replace: true,
scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
originScope: '&' },
templateUrl: 'uib/template/popover/popover-template.html'
};
})
.directive('uibPopoverTemplate', ['$uibTooltip', function($uibTooltip) {
return $uibTooltip('uibPopoverTemplate', 'popover', 'click', {
useContentExp: true
});
}])
.directive('uibPopoverHtmlPopup', function() {
return {
replace: true,
scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
templateUrl: 'uib/template/popover/popover-html.html'
};
})
.directive('uibPopoverHtml', ['$uibTooltip', function($uibTooltip) {
return $uibTooltip('uibPopoverHtml', 'popover', 'click', {
useContentExp: true
});
}])
.directive('uibPopoverPopup', function() {
return {
replace: true,
scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
templateUrl: 'uib/template/popover/popover.html'
};
})
.directive('uibPopover', ['$uibTooltip', function($uibTooltip) {
return $uibTooltip('uibPopover', 'popover', 'click');
}]);
angular.module('ui.bootstrap.progressbar', [])
.constant('uibProgressConfig', {
animate: true,
max: 100
})
.controller('UibProgressController', ['$scope', '$attrs', 'uibProgressConfig', function($scope, $attrs, progressConfig) {
var self = this,
animate = angular.isDefined($attrs.animate) ? $scope.$parent.$eval($attrs.animate) : progressConfig.animate;
this.bars = [];
$scope.max = angular.isDefined($scope.max) ? $scope.max : progressConfig.max;
this.addBar = function(bar, element, attrs) {
if (!animate) {
element.css({'transition': 'none'});
}
this.bars.push(bar);
bar.max = $scope.max;
bar.title = attrs && angular.isDefined(attrs.title) ? attrs.title : 'progressbar';
bar.$watch('value', function(value) {
bar.recalculatePercentage();
});
bar.recalculatePercentage = function() {
var totalPercentage = self.bars.reduce(function(total, bar) {
bar.percent = +(100 * bar.value / bar.max).toFixed(2);
return total + bar.percent;
}, 0);
if (totalPercentage > 100) {
bar.percent -= totalPercentage - 100;
}
};
bar.$on('$destroy', function() {
element = null;
self.removeBar(bar);
});
};
this.removeBar = function(bar) {
this.bars.splice(this.bars.indexOf(bar), 1);
this.bars.forEach(function (bar) {
bar.recalculatePercentage();
});
};
$scope.$watch('max', function(max) {
self.bars.forEach(function(bar) {
bar.max = $scope.max;
bar.recalculatePercentage();
});
});
}])
.directive('uibProgress', function() {
return {
replace: true,
transclude: true,
controller: 'UibProgressController',
require: 'uibProgress',
scope: {
max: '=?'
},
templateUrl: 'uib/template/progressbar/progress.html'
};
})
.directive('uibBar', function() {
return {
replace: true,
transclude: true,
require: '^uibProgress',
scope: {
value: '=',
type: '@'
},
templateUrl: 'uib/template/progressbar/bar.html',
link: function(scope, element, attrs, progressCtrl) {
progressCtrl.addBar(scope, element, attrs);
}
};
})
.directive('uibProgressbar', function() {
return {
replace: true,
transclude: true,
controller: 'UibProgressController',
scope: {
value: '=',
max: '=?',
type: '@'
},
templateUrl: 'uib/template/progressbar/progressbar.html',
link: function(scope, element, attrs, progressCtrl) {
progressCtrl.addBar(scope, angular.element(element.children()[0]), {title: attrs.title});
}
};
});
angular.module('ui.bootstrap.rating', [])
.constant('uibRatingConfig', {
max: 5,
stateOn: null,
stateOff: null,
titles : ['1', '2', '3', '4', '5']
})
.controller('UibRatingController', ['$scope', '$attrs', 'uibRatingConfig', function($scope, $attrs, ratingConfig) {
var ngModelCtrl = { $setViewValue: angular.noop };
this.init = function(ngModelCtrl_) {
ngModelCtrl = ngModelCtrl_;
ngModelCtrl.$render = this.render;
ngModelCtrl.$formatters.push(function(value) {
if (angular.isNumber(value) && value << 0 !== value) {
value = Math.round(value);
}
return value;
});
this.stateOn = angular.isDefined($attrs.stateOn) ? $scope.$parent.$eval($attrs.stateOn) : ratingConfig.stateOn;
this.stateOff = angular.isDefined($attrs.stateOff) ? $scope.$parent.$eval($attrs.stateOff) : ratingConfig.stateOff;
var tmpTitles = angular.isDefined($attrs.titles) ? $scope.$parent.$eval($attrs.titles) : ratingConfig.titles ;
this.titles = angular.isArray(tmpTitles) && tmpTitles.length > 0 ?
tmpTitles : ratingConfig.titles;
var ratingStates = angular.isDefined($attrs.ratingStates) ?
$scope.$parent.$eval($attrs.ratingStates) :
new Array(angular.isDefined($attrs.max) ? $scope.$parent.$eval($attrs.max) : ratingConfig.max);
$scope.range = this.buildTemplateObjects(ratingStates);
};
this.buildTemplateObjects = function(states) {
for (var i = 0, n = states.length; i < n; i++) {
states[i] = angular.extend({ index: i }, { stateOn: this.stateOn, stateOff: this.stateOff, title: this.getTitle(i) }, states[i]);
}
return states;
};
this.getTitle = function(index) {
if (index >= this.titles.length) {
return index + 1;
}
return this.titles[index];
};
$scope.rate = function(value) {
if (!$scope.readonly && value >= 0 && value <= $scope.range.length) {
ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue === value ? 0 : value);
ngModelCtrl.$render();
}
};
$scope.enter = function(value) {
if (!$scope.readonly) {
$scope.value = value;
}
$scope.onHover({value: value});
};
$scope.reset = function() {
$scope.value = ngModelCtrl.$viewValue;
$scope.onLeave();
};
$scope.onKeydown = function(evt) {
if (/(37|38|39|40)/.test(evt.which)) {
evt.preventDefault();
evt.stopPropagation();
$scope.rate($scope.value + (evt.which === 38 || evt.which === 39 ? 1 : -1));
}
};
this.render = function() {
$scope.value = ngModelCtrl.$viewValue;
};
}])
.directive('uibRating', function() {
return {
require: ['uibRating', 'ngModel'],
scope: {
readonly: '=?',
onHover: '&',
onLeave: '&'
},
controller: 'UibRatingController',
templateUrl: 'uib/template/rating/rating.html',
replace: true,
link: function(scope, element, attrs, ctrls) {
var ratingCtrl = ctrls[0], ngModelCtrl = ctrls[1];
ratingCtrl.init(ngModelCtrl);
}
};
});
angular.module('ui.bootstrap.tabs', [])
.controller('UibTabsetController', ['$scope', function ($scope) {
var ctrl = this,
tabs = ctrl.tabs = $scope.tabs = [];
ctrl.select = function(selectedTab) {
angular.forEach(tabs, function(tab) {
if (tab.active && tab !== selectedTab) {
tab.active = false;
tab.onDeselect();
selectedTab.selectCalled = false;
}
});
selectedTab.active = true;
if (!selectedTab.selectCalled) {
selectedTab.onSelect();
selectedTab.selectCalled = true;
}
};
ctrl.addTab = function addTab(tab) {
tabs.push(tab);
if (tabs.length === 1 && tab.active !== false) {
tab.active = true;
} else if (tab.active) {
ctrl.select(tab);
} else {
tab.active = false;
}
};
ctrl.removeTab = function removeTab(tab) {
var index = tabs.indexOf(tab);
if (tab.active && tabs.length > 1 && !destroyed) {
var newActiveIndex = index === tabs.length - 1 ? index - 1 : index + 1;
ctrl.select(tabs[newActiveIndex]);
}
tabs.splice(index, 1);
};
var destroyed;
$scope.$on('$destroy', function() {
destroyed = true;
});
}])
.directive('uibTabset', function() {
return {
transclude: true,
replace: true,
scope: {
type: '@'
},
controller: 'UibTabsetController',
templateUrl: 'uib/template/tabs/tabset.html',
link: function(scope, element, attrs) {
scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false;
scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false;
}
};
})
.directive('uibTab', ['$parse', function($parse) {
return {
require: '^uibTabset',
replace: true,
templateUrl: 'uib/template/tabs/tab.html',
transclude: true,
scope: {
active: '=?',
heading: '@',
onSelect: '&select',
onDeselect: '&deselect'
},
controller: function() {
},
controllerAs: 'tab',
link: function(scope, elm, attrs, tabsetCtrl, transclude) {
scope.$watch('active', function(active) {
if (active) {
tabsetCtrl.select(scope);
}
});
scope.disabled = false;
if (attrs.disable) {
scope.$parent.$watch($parse(attrs.disable), function(value) {
scope.disabled = !! value;
});
}
scope.select = function() {
if (!scope.disabled) {
scope.active = true;
}
};
tabsetCtrl.addTab(scope);
scope.$on('$destroy', function() {
tabsetCtrl.removeTab(scope);
});
scope.$transcludeFn = transclude;
}
};
}])
.directive('uibTabHeadingTransclude', function() {
return {
restrict: 'A',
require: '^uibTab',
link: function(scope, elm) {
scope.$watch('headingElement', function updateHeadingElement(heading) {
if (heading) {
elm.html('');
elm.append(heading);
}
});
}
};
})
.directive('uibTabContentTransclude', function() {
return {
restrict: 'A',
require: '^uibTabset',
link: function(scope, elm, attrs) {
var tab = scope.$eval(attrs.uibTabContentTransclude);
tab.$transcludeFn(tab.$parent, function(contents) {
angular.forEach(contents, function(node) {
if (isTabHeading(node)) {
tab.headingElement = node;
} else {
elm.append(node);
}
});
});
}
};
function isTabHeading(node) {
return node.tagName && (
node.hasAttribute('uib-tab-heading') ||
node.hasAttribute('data-uib-tab-heading') ||
node.hasAttribute('x-uib-tab-heading') ||
node.tagName.toLowerCase() === 'uib-tab-heading' ||
node.tagName.toLowerCase() === 'data-uib-tab-heading' ||
node.tagName.toLowerCase() === 'x-uib-tab-heading'
);
}
});
angular.module('ui.bootstrap.timepicker', [])
.constant('uibTimepickerConfig', {
hourStep: 1,
minuteStep: 1,
secondStep: 1,
showMeridian: true,
showSeconds: false,
meridians: null,
readonlyInput: false,
mousewheel: true,
arrowkeys: true,
showSpinners: true,
templateUrl: 'uib/template/timepicker/timepicker.html'
})
.controller('UibTimepickerController', ['$scope', '$element', '$attrs', '$parse', '$log', '$locale', 'uibTimepickerConfig', function($scope, $element, $attrs, $parse, $log, $locale, timepickerConfig) {
var selected = new Date(),
watchers = [],
ngModelCtrl = { $setViewValue: angular.noop },
meridians = angular.isDefined($attrs.meridians) ? $scope.$parent.$eval($attrs.meridians) : timepickerConfig.meridians || $locale.DATETIME_FORMATS.AMPMS;
$scope.tabindex = angular.isDefined($attrs.tabindex) ? $attrs.tabindex : 0;
$element.removeAttr('tabindex');
this.init = function(ngModelCtrl_, inputs) {
ngModelCtrl = ngModelCtrl_;
ngModelCtrl.$render = this.render;
ngModelCtrl.$formatters.unshift(function(modelValue) {
return modelValue ? new Date(modelValue) : null;
});
var hoursInputEl = inputs.eq(0),
minutesInputEl = inputs.eq(1),
secondsInputEl = inputs.eq(2);
var mousewheel = angular.isDefined($attrs.mousewheel) ? $scope.$parent.$eval($attrs.mousewheel) : timepickerConfig.mousewheel;
if (mousewheel) {
this.setupMousewheelEvents(hoursInputEl, minutesInputEl, secondsInputEl);
}
var arrowkeys = angular.isDefined($attrs.arrowkeys) ? $scope.$parent.$eval($attrs.arrowkeys) : timepickerConfig.arrowkeys;
if (arrowkeys) {
this.setupArrowkeyEvents(hoursInputEl, minutesInputEl, secondsInputEl);
}
$scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? $scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput;
this.setupInputEvents(hoursInputEl, minutesInputEl, secondsInputEl);
};
var hourStep = timepickerConfig.hourStep;
if ($attrs.hourStep) {
watchers.push($scope.$parent.$watch($parse($attrs.hourStep), function(value) {
hourStep = +value;
}));
}
var minuteStep = timepickerConfig.minuteStep;
if ($attrs.minuteStep) {
watchers.push($scope.$parent.$watch($parse($attrs.minuteStep), function(value) {
minuteStep = +value;
}));
}
var min;
watchers.push($scope.$parent.$watch($parse($attrs.min), function(value) {
var dt = new Date(value);
min = isNaN(dt) ? undefined : dt;
}));
var max;
watchers.push($scope.$parent.$watch($parse($attrs.max), function(value) {
var dt = new Date(value);
max = isNaN(dt) ? undefined : dt;
}));
var disabled = false;
if ($attrs.ngDisabled) {
watchers.push($scope.$parent.$watch($parse($attrs.ngDisabled), function(value) {
disabled = value;
}));
}
$scope.noIncrementHours = function() {
var incrementedSelected = addMinutes(selected, hourStep * 60);
return disabled || incrementedSelected > max ||
incrementedSelected < selected && incrementedSelected < min;
};
$scope.noDecrementHours = function() {
var decrementedSelected = addMinutes(selected, -hourStep * 60);
return disabled || decrementedSelected < min ||
decrementedSelected > selected && decrementedSelected > max;
};
$scope.noIncrementMinutes = function() {
var incrementedSelected = addMinutes(selected, minuteStep);
return disabled || incrementedSelected > max ||
incrementedSelected < selected && incrementedSelected < min;
};
$scope.noDecrementMinutes = function() {
var decrementedSelected = addMinutes(selected, -minuteStep);
return disabled || decrementedSelected < min ||
decrementedSelected > selected && decrementedSelected > max;
};
$scope.noIncrementSeconds = function() {
var incrementedSelected = addSeconds(selected, secondStep);
return disabled || incrementedSelected > max ||
incrementedSelected < selected && incrementedSelected < min;
};
$scope.noDecrementSeconds = function() {
var decrementedSelected = addSeconds(selected, -secondStep);
return disabled || decrementedSelected < min ||
decrementedSelected > selected && decrementedSelected > max;
};
$scope.noToggleMeridian = function() {
if (selected.getHours() < 12) {
return disabled || addMinutes(selected, 12 * 60) > max;
}
return disabled || addMinutes(selected, -12 * 60) < min;
};
var secondStep = timepickerConfig.secondStep;
if ($attrs.secondStep) {
watchers.push($scope.$parent.$watch($parse($attrs.secondStep), function(value) {
secondStep = +value;
}));
}
$scope.showSeconds = timepickerConfig.showSeconds;
if ($attrs.showSeconds) {
watchers.push($scope.$parent.$watch($parse($attrs.showSeconds), function(value) {
$scope.showSeconds = !!value;
}));
}
$scope.showMeridian = timepickerConfig.showMeridian;
if ($attrs.showMeridian) {
watchers.push($scope.$parent.$watch($parse($attrs.showMeridian), function(value) {
$scope.showMeridian = !!value;
if (ngModelCtrl.$error.time) {
var hours = getHoursFromTemplate(), minutes = getMinutesFromTemplate();
if (angular.isDefined(hours) && angular.isDefined(minutes)) {
selected.setHours(hours);
refresh();
}
} else {
updateTemplate();
}
}));
}
function getHoursFromTemplate() {
var hours = +$scope.hours;
var valid = $scope.showMeridian ? hours > 0 && hours < 13 :
hours >= 0 && hours < 24;
if (!valid) {
return undefined;
}
if ($scope.showMeridian) {
if (hours === 12) {
hours = 0;
}
if ($scope.meridian === meridians[1]) {
hours = hours + 12;
}
}
return hours;
}
function getMinutesFromTemplate() {
var minutes = +$scope.minutes;
return minutes >= 0 && minutes < 60 ? minutes : undefined;
}
function getSecondsFromTemplate() {
var seconds = +$scope.seconds;
return seconds >= 0 && seconds < 60 ? seconds : undefined;
}
function pad(value) {
if (value === null) {
return '';
}
return angular.isDefined(value) && value.toString().length < 2 ?
'0' + value : value.toString();
}
this.setupMousewheelEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) {
var isScrollingUp = function(e) {
if (e.originalEvent) {
e = e.originalEvent;
}
var delta = e.wheelDelta ? e.wheelDelta : -e.deltaY;
return e.detail || delta > 0;
};
hoursInputEl.bind('mousewheel wheel', function(e) {
if (!disabled) {
$scope.$apply(isScrollingUp(e) ? $scope.incrementHours() : $scope.decrementHours());
}
e.preventDefault();
});
minutesInputEl.bind('mousewheel wheel', function(e) {
if (!disabled) {
$scope.$apply(isScrollingUp(e) ? $scope.incrementMinutes() : $scope.decrementMinutes());
}
e.preventDefault();
});
secondsInputEl.bind('mousewheel wheel', function(e) {
if (!disabled) {
$scope.$apply(isScrollingUp(e) ? $scope.incrementSeconds() : $scope.decrementSeconds());
}
e.preventDefault();
});
};
this.setupArrowkeyEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) {
hoursInputEl.bind('keydown', function(e) {
if (!disabled) {
if (e.which === 38) {
e.preventDefault();
$scope.incrementHours();
$scope.$apply();
} else if (e.which === 40) {
e.preventDefault();
$scope.decrementHours();
$scope.$apply();
}
}
});
minutesInputEl.bind('keydown', function(e) {
if (!disabled) {
if (e.which === 38) {
e.preventDefault();
$scope.incrementMinutes();
$scope.$apply();
} else if (e.which === 40) {
e.preventDefault();
$scope.decrementMinutes();
$scope.$apply();
}
}
});
secondsInputEl.bind('keydown', function(e) {
if (!disabled) {
if (e.which === 38) {
e.preventDefault();
$scope.incrementSeconds();
$scope.$apply();
} else if (e.which === 40) {
e.preventDefault();
$scope.decrementSeconds();
$scope.$apply();
}
}
});
};
this.setupInputEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) {
if ($scope.readonlyInput) {
$scope.updateHours = angular.noop;
$scope.updateMinutes = angular.noop;
$scope.updateSeconds = angular.noop;
return;
}
var invalidate = function(invalidHours, invalidMinutes, invalidSeconds) {
ngModelCtrl.$setViewValue(null);
ngModelCtrl.$setValidity('time', false);
if (angular.isDefined(invalidHours)) {
$scope.invalidHours = invalidHours;
}
if (angular.isDefined(invalidMinutes)) {
$scope.invalidMinutes = invalidMinutes;
}
if (angular.isDefined(invalidSeconds)) {
$scope.invalidSeconds = invalidSeconds;
}
};
$scope.updateHours = function() {
var hours = getHoursFromTemplate(),
minutes = getMinutesFromTemplate();
ngModelCtrl.$setDirty();
if (angular.isDefined(hours) && angular.isDefined(minutes)) {
selected.setHours(hours);
selected.setMinutes(minutes);
if (selected < min || selected > max) {
invalidate(true);
} else {
refresh('h');
}
} else {
invalidate(true);
}
};
hoursInputEl.bind('blur', function(e) {
ngModelCtrl.$setTouched();
if ($scope.hours === null || $scope.hours === '') {
invalidate(true);
} else if (!$scope.invalidHours && $scope.hours < 10) {
$scope.$apply(function() {
$scope.hours = pad($scope.hours);
});
}
});
$scope.updateMinutes = function() {
var minutes = getMinutesFromTemplate(),
hours = getHoursFromTemplate();
ngModelCtrl.$setDirty();
if (angular.isDefined(minutes) && angular.isDefined(hours)) {
selected.setHours(hours);
selected.setMinutes(minutes);
if (selected < min || selected > max) {
invalidate(undefined, true);
} else {
refresh('m');
}
} else {
invalidate(undefined, true);
}
};
minutesInputEl.bind('blur', function(e) {
ngModelCtrl.$setTouched();
if ($scope.minutes === null) {
invalidate(undefined, true);
} else if (!$scope.invalidMinutes && $scope.minutes < 10) {
$scope.$apply(function() {
$scope.minutes = pad($scope.minutes);
});
}
});
$scope.updateSeconds = function() {
var seconds = getSecondsFromTemplate();
ngModelCtrl.$setDirty();
if (angular.isDefined(seconds)) {
selected.setSeconds(seconds);
refresh('s');
} else {
invalidate(undefined, undefined, true);
}
};
secondsInputEl.bind('blur', function(e) {
if (!$scope.invalidSeconds && $scope.seconds < 10) {
$scope.$apply( function() {
$scope.seconds = pad($scope.seconds);
});
}
});
};
this.render = function() {
var date = ngModelCtrl.$viewValue;
if (isNaN(date)) {
ngModelCtrl.$setValidity('time', false);
$log.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.');
} else {
if (date) {
selected = date;
}
if (selected < min || selected > max) {
ngModelCtrl.$setValidity('time', false);
$scope.invalidHours = true;
$scope.invalidMinutes = true;
} else {
makeValid();
}
updateTemplate();
}
};
function refresh(keyboardChange) {
makeValid();
ngModelCtrl.$setViewValue(new Date(selected));
updateTemplate(keyboardChange);
}
function makeValid() {
ngModelCtrl.$setValidity('time', true);
$scope.invalidHours = false;
$scope.invalidMinutes = false;
$scope.invalidSeconds = false;
}
function updateTemplate(keyboardChange) {
if (!ngModelCtrl.$modelValue) {
$scope.hours = null;
$scope.minutes = null;
$scope.seconds = null;
$scope.meridian = meridians[0];
} else {
var hours = selected.getHours(),
minutes = selected.getMinutes(),
seconds = selected.getSeconds();
if ($scope.showMeridian) {
hours = hours === 0 || hours === 12 ? 12 : hours % 12;
}
$scope.hours = keyboardChange === 'h' ? hours : pad(hours);
if (keyboardChange !== 'm') {
$scope.minutes = pad(minutes);
}
$scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];
if (keyboardChange !== 's') {
$scope.seconds = pad(seconds);
}
$scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];
}
}
function addSecondsToSelected(seconds) {
selected = addSeconds(selected, seconds);
refresh();
}
function addMinutes(selected, minutes) {
return addSeconds(selected, minutes*60);
}
function addSeconds(date, seconds) {
var dt = new Date(date.getTime() + seconds * 1000);
var newDate = new Date(date);
newDate.setHours(dt.getHours(), dt.getMinutes(), dt.getSeconds());
return newDate;
}
$scope.showSpinners = angular.isDefined($attrs.showSpinners) ?
$scope.$parent.$eval($attrs.showSpinners) : timepickerConfig.showSpinners;
$scope.incrementHours = function() {
if (!$scope.noIncrementHours()) {
addSecondsToSelected(hourStep * 60 * 60);
}
};
$scope.decrementHours = function() {
if (!$scope.noDecrementHours()) {
addSecondsToSelected(-hourStep * 60 * 60);
}
};
$scope.incrementMinutes = function() {
if (!$scope.noIncrementMinutes()) {
addSecondsToSelected(minuteStep * 60);
}
};
$scope.decrementMinutes = function() {
if (!$scope.noDecrementMinutes()) {
addSecondsToSelected(-minuteStep * 60);
}
};
$scope.incrementSeconds = function() {
if (!$scope.noIncrementSeconds()) {
addSecondsToSelected(secondStep);
}
};
$scope.decrementSeconds = function() {
if (!$scope.noDecrementSeconds()) {
addSecondsToSelected(-secondStep);
}
};
$scope.toggleMeridian = function() {
var minutes = getMinutesFromTemplate(),
hours = getHoursFromTemplate();
if (!$scope.noToggleMeridian()) {
if (angular.isDefined(minutes) && angular.isDefined(hours)) {
addSecondsToSelected(12 * 60 * (selected.getHours() < 12 ? 60 : -60));
} else {
$scope.meridian = $scope.meridian === meridians[0] ? meridians[1] : meridians[0];
}
}
};
$scope.blur = function() {
ngModelCtrl.$setTouched();
};
$scope.$on('$destroy', function() {
while (watchers.length) {
watchers.shift()();
}
});
}])
.directive('uibTimepicker', ['uibTimepickerConfig', function(uibTimepickerConfig) {
return {
require: ['uibTimepicker', '?^ngModel'],
controller: 'UibTimepickerController',
controllerAs: 'timepicker',
replace: true,
scope: {},
templateUrl: function(element, attrs) {
return attrs.templateUrl || uibTimepickerConfig.templateUrl;
},
link: function(scope, element, attrs, ctrls) {
var timepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1];
if (ngModelCtrl) {
timepickerCtrl.init(ngModelCtrl, element.find('input'));
}
}
};
}]);
angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap.position'])
.factory('uibTypeaheadParser', ['$parse', function($parse) {
var TYPEAHEAD_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;
return {
parse: function(input) {
var match = input.match(TYPEAHEAD_REGEXP);
if (!match) {
throw new Error(
'Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_"' +
' but got "' + input + '".');
}
return {
itemName: match[3],
source: $parse(match[4]),
viewMapper: $parse(match[2] || match[1]),
modelMapper: $parse(match[1])
};
}
};
}])
.controller('UibTypeaheadController', ['$scope', '$element', '$attrs', '$compile', '$parse', '$q', '$timeout', '$document', '$window', '$rootScope', '$$debounce', '$uibPosition', 'uibTypeaheadParser',
function(originalScope, element, attrs, $compile, $parse, $q, $timeout, $document, $window, $rootScope, $$debounce, $position, typeaheadParser) {
var HOT_KEYS = [9, 13, 27, 38, 40];
var eventDebounceTime = 200;
var modelCtrl, ngModelOptions;
var minLength = originalScope.$eval(attrs.typeaheadMinLength);
if (!minLength && minLength !== 0) {
minLength = 1;
}
var waitTime = originalScope.$eval(attrs.typeaheadWaitMs) || 0;
var isEditable = originalScope.$eval(attrs.typeaheadEditable) !== false;
originalScope.$watch(attrs.typeaheadEditable, function (newVal) {
isEditable = newVal !== false;
});
var isLoadingSetter = $parse(attrs.typeaheadLoading).assign || angular.noop;
var onSelectCallback = $parse(attrs.typeaheadOnSelect);
var isSelectOnBlur = angular.isDefined(attrs.typeaheadSelectOnBlur) ? originalScope.$eval(attrs.typeaheadSelectOnBlur) : false;
var isNoResultsSetter = $parse(attrs.typeaheadNoResults).assign || angular.noop;
var inputFormatter = attrs.typeaheadInputFormatter ? $parse(attrs.typeaheadInputFormatter) : undefined;
var appendToBody = attrs.typeaheadAppendToBody ? originalScope.$eval(attrs.typeaheadAppendToBody) : false;
var appendTo = attrs.typeaheadAppendTo ?
originalScope.$eval(attrs.typeaheadAppendTo) : null;
var focusFirst = originalScope.$eval(attrs.typeaheadFocusFirst) !== false;
var selectOnExact = attrs.typeaheadSelectOnExact ? originalScope.$eval(attrs.typeaheadSelectOnExact) : false;
var isOpenSetter = $parse(attrs.typeaheadIsOpen).assign || angular.noop;
var showHint = originalScope.$eval(attrs.typeaheadShowHint) || false;
var parsedModel = $parse(attrs.ngModel);
var invokeModelSetter = $parse(attrs.ngModel + '($$$p)');
var $setModelValue = function(scope, newValue) {
if (angular.isFunction(parsedModel(originalScope)) &&
ngModelOptions && ngModelOptions.$options && ngModelOptions.$options.getterSetter) {
return invokeModelSetter(scope, {$$$p: newValue});
}
return parsedModel.assign(scope, newValue);
};
var parserResult = typeaheadParser.parse(attrs.uibTypeahead);
var hasFocus;
var selected;
var scope = originalScope.$new();
var offDestroy = originalScope.$on('$destroy', function() {
scope.$destroy();
});
scope.$on('$destroy', offDestroy);
var popupId = 'typeahead-' + scope.$id + '-' + Math.floor(Math.random() * 10000);
var expandedAttr = 'aria-expanded';
if (element.attr('type') === 'text')
expandedAttr = 'data-aria-expanded';
element.attr({
'aria-autocomplete': 'list',
'aria-owns': popupId
});
element.attr(expandedAttr, false);
var inputsContainer, hintInputElem;
if (showHint) {
inputsContainer = angular.element('<div></div>');
inputsContainer.css('position', 'relative');
element.after(inputsContainer);
hintInputElem = element.clone();
hintInputElem.attr('placeholder', '');
hintInputElem.val('');
hintInputElem.css({
'position': 'absolute',
'top': '0px',
'left': '0px',
'border-color': 'transparent',
'box-shadow': 'none',
'opacity': 1,
'background': 'none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)',
'color': '#999'
});
element.css({
'position': 'relative',
'vertical-align': 'top',
'background-color': 'transparent'
});
inputsContainer.append(hintInputElem);
hintInputElem.after(element);
}
var popUpEl = angular.element('<div uib-typeahead-popup></div>');
popUpEl.attr({
id: popupId,
matches: 'matches',
active: 'activeIdx',
select: 'select(activeIdx, evt)',
'move-in-progress': 'moveInProgress',
query: 'query',
position: 'position',
'assign-is-open': 'assignIsOpen(isOpen)',
debounce: 'debounceUpdate'
});
if (angular.isDefined(attrs.typeaheadTemplateUrl)) {
popUpEl.attr('template-url', attrs.typeaheadTemplateUrl);
}
if (angular.isDefined(attrs.typeaheadPopupTemplateUrl)) {
popUpEl.attr('popup-template-url', attrs.typeaheadPopupTemplateUrl);
}
var resetHint = function() {
if (showHint) {
hintInputElem.val('');
}
};
var resetMatches = function() {
scope.matches = [];
scope.activeIdx = -1;
element.attr(expandedAttr, false);
resetHint();
};
var getMatchId = function(index) {
return popupId + '-option-' + index;
};
scope.$watch('activeIdx', function(index) {
if (index < 0) {
element.removeAttr('aria-activedescendant');
} else {
element.attr('aria-activedescendant', getMatchId(index));
}
});
var inputIsExactMatch = function(inputValue, index) {
if (scope.matches.length > index && inputValue) {
return inputValue.toUpperCase() === scope.matches[index].label.toUpperCase();
}
return false;
};
var getMatchesAsync = function(inputValue, evt) {
var locals = {$viewValue: inputValue};
isLoadingSetter(originalScope, true);
isNoResultsSetter(originalScope, false);
$q.when(parserResult.source(originalScope, locals)).then(function(matches) {
var onCurrentRequest = inputValue === modelCtrl.$viewValue;
if (onCurrentRequest && hasFocus) {
if (matches && matches.length > 0) {
scope.activeIdx = focusFirst ? 0 : -1;
isNoResultsSetter(originalScope, false);
scope.matches.length = 0;
for (var i = 0; i < matches.length; i++) {
locals[parserResult.itemName] = matches[i];
scope.matches.push({
id: getMatchId(i),
label: parserResult.viewMapper(scope, locals),
model: matches[i]
});
}
scope.query = inputValue;
recalculatePosition();
element.attr(expandedAttr, true);
if (selectOnExact && scope.matches.length === 1 && inputIsExactMatch(inputValue, 0)) {
if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) {
$$debounce(function() {
scope.select(0, evt);
}, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']);
} else {
scope.select(0, evt);
}
}
if (showHint) {
var firstLabel = scope.matches[0].label;
if (angular.isString(inputValue) &&
inputValue.length > 0 &&
firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) {
hintInputElem.val(inputValue + firstLabel.slice(inputValue.length));
} else {
hintInputElem.val('');
}
}
} else {
resetMatches();
isNoResultsSetter(originalScope, true);
}
}
if (onCurrentRequest) {
isLoadingSetter(originalScope, false);
}
}, function() {
resetMatches();
isLoadingSetter(originalScope, false);
isNoResultsSetter(originalScope, true);
});
};
if (appendToBody) {
angular.element($window).on('resize', fireRecalculating);
$document.find('body').on('scroll', fireRecalculating);
}
var debouncedRecalculate = $$debounce(function() {
if (scope.matches.length) {
recalculatePosition();
}
scope.moveInProgress = false;
}, eventDebounceTime);
scope.moveInProgress = false;
function fireRecalculating() {
if (!scope.moveInProgress) {
scope.moveInProgress = true;
scope.$digest();
}
debouncedRecalculate();
}
function recalculatePosition() {
scope.position = appendToBody ? $position.offset(element) : $position.position(element);
scope.position.top += element.prop('offsetHeight');
}
scope.query = undefined;
var timeoutPromise;
var scheduleSearchWithTimeout = function(inputValue) {
timeoutPromise = $timeout(function() {
getMatchesAsync(inputValue);
}, waitTime);
};
var cancelPreviousTimeout = function() {
if (timeoutPromise) {
$timeout.cancel(timeoutPromise);
}
};
resetMatches();
scope.assignIsOpen = function (isOpen) {
isOpenSetter(originalScope, isOpen);
};
scope.select = function(activeIdx, evt) {
var locals = {};
var model, item;
selected = true;
locals[parserResult.itemName] = item = scope.matches[activeIdx].model;
model = parserResult.modelMapper(originalScope, locals);
$setModelValue(originalScope, model);
modelCtrl.$setValidity('editable', true);
modelCtrl.$setValidity('parse', true);
onSelectCallback(originalScope, {
$item: item,
$model: model,
$label: parserResult.viewMapper(originalScope, locals),
$event: evt
});
resetMatches();
if (scope.$eval(attrs.typeaheadFocusOnSelect) !== false) {
$timeout(function() { element[0].focus(); }, 0, false);
}
};
element.on('keydown', function(evt) {
if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) {
return;
}
if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13)) {
resetMatches();
scope.$digest();
return;
}
evt.preventDefault();
var target;
switch (evt.which) {
case 9:
case 13:
scope.$apply(function () {
if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) {
$$debounce(function() {
scope.select(scope.activeIdx, evt);
}, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']);
} else {
scope.select(scope.activeIdx, evt);
}
});
break;
case 27:
evt.stopPropagation();
resetMatches();
scope.$digest();
break;
case 38:
scope.activeIdx = (scope.activeIdx > 0 ? scope.activeIdx : scope.matches.length) - 1;
scope.$digest();
target = popUpEl.find('li')[scope.activeIdx];
target.parentNode.scrollTop = target.offsetTop;
break;
case 40:
scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length;
scope.$digest();
target = popUpEl.find('li')[scope.activeIdx];
target.parentNode.scrollTop = target.offsetTop;
break;
}
});
element.bind('focus', function (evt) {
hasFocus = true;
if (minLength === 0 && !modelCtrl.$viewValue) {
$timeout(function() {
getMatchesAsync(modelCtrl.$viewValue, evt);
}, 0);
}
});
element.bind('blur', function(evt) {
if (isSelectOnBlur && scope.matches.length && scope.activeIdx !== -1 && !selected) {
selected = true;
scope.$apply(function() {
if (angular.isObject(scope.debounceUpdate) && angular.isNumber(scope.debounceUpdate.blur)) {
$$debounce(function() {
scope.select(scope.activeIdx, evt);
}, scope.debounceUpdate.blur);
} else {
scope.select(scope.activeIdx, evt);
}
});
}
if (!isEditable && modelCtrl.$error.editable) {
modelCtrl.$viewValue = '';
element.val('');
}
hasFocus = false;
selected = false;
});
var dismissClickHandler = function(evt) {
if (element[0] !== evt.target && evt.which !== 3 && scope.matches.length !== 0) {
resetMatches();
if (!$rootScope.$$phase) {
scope.$digest();
}
}
};
$document.on('click', dismissClickHandler);
originalScope.$on('$destroy', function() {
$document.off('click', dismissClickHandler);
if (appendToBody || appendTo) {
$popup.remove();
}
if (appendToBody) {
angular.element($window).off('resize', fireRecalculating);
$document.find('body').off('scroll', fireRecalculating);
}
popUpEl.remove();
if (showHint) {
inputsContainer.remove();
}
});
var $popup = $compile(popUpEl)(scope);
if (appendToBody) {
$document.find('body').append($popup);
} else if (appendTo) {
angular.element(appendTo).eq(0).append($popup);
} else {
element.after($popup);
}
this.init = function(_modelCtrl, _ngModelOptions) {
modelCtrl = _modelCtrl;
ngModelOptions = _ngModelOptions;
scope.debounceUpdate = modelCtrl.$options && $parse(modelCtrl.$options.debounce)(originalScope);
modelCtrl.$parsers.unshift(function(inputValue) {
hasFocus = true;
if (minLength === 0 || inputValue && inputValue.length >= minLength) {
if (waitTime > 0) {
cancelPreviousTimeout();
scheduleSearchWithTimeout(inputValue);
} else {
getMatchesAsync(inputValue);
}
} else {
isLoadingSetter(originalScope, false);
cancelPreviousTimeout();
resetMatches();
}
if (isEditable) {
return inputValue;
}
if (!inputValue) {
modelCtrl.$setValidity('editable', true);
return null;
}
modelCtrl.$setValidity('editable', false);
return undefined;
});
modelCtrl.$formatters.push(function(modelValue) {
var candidateViewValue, emptyViewValue;
var locals = {};
if (!isEditable) {
modelCtrl.$setValidity('editable', true);
}
if (inputFormatter) {
locals.$model = modelValue;
return inputFormatter(originalScope, locals);
}
locals[parserResult.itemName] = modelValue;
candidateViewValue = parserResult.viewMapper(originalScope, locals);
locals[parserResult.itemName] = undefined;
emptyViewValue = parserResult.viewMapper(originalScope, locals);
return candidateViewValue !== emptyViewValue ? candidateViewValue : modelValue;
});
};
}])
.directive('uibTypeahead', function() {
return {
controller: 'UibTypeaheadController',
require: ['ngModel', '^?ngModelOptions', 'uibTypeahead'],
link: function(originalScope, element, attrs, ctrls) {
ctrls[2].init(ctrls[0], ctrls[1]);
}
};
})
.directive('uibTypeaheadPopup', ['$$debounce', function($$debounce) {
return {
scope: {
matches: '=',
query: '=',
active: '=',
position: '&',
moveInProgress: '=',
select: '&',
assignIsOpen: '&',
debounce: '&'
},
replace: true,
templateUrl: function(element, attrs) {
return attrs.popupTemplateUrl || 'uib/template/typeahead/typeahead-popup.html';
},
link: function(scope, element, attrs) {
scope.templateUrl = attrs.templateUrl;
scope.isOpen = function() {
var isDropdownOpen = scope.matches.length > 0;
scope.assignIsOpen({ isOpen: isDropdownOpen });
return isDropdownOpen;
};
scope.isActive = function(matchIdx) {
return scope.active === matchIdx;
};
scope.selectActive = function(matchIdx) {
scope.active = matchIdx;
};
scope.selectMatch = function(activeIdx, evt) {
var debounce = scope.debounce();
if (angular.isNumber(debounce) || angular.isObject(debounce)) {
$$debounce(function() {
scope.select({activeIdx: activeIdx, evt: evt});
}, angular.isNumber(debounce) ? debounce : debounce['default']);
} else {
scope.select({activeIdx: activeIdx, evt: evt});
}
};
}
};
}])
.directive('uibTypeaheadMatch', ['$templateRequest', '$compile', '$parse', function($templateRequest, $compile, $parse) {
return {
scope: {
index: '=',
match: '=',
query: '='
},
link: function(scope, element, attrs) {
var tplUrl = $parse(attrs.templateUrl)(scope.$parent) || 'uib/template/typeahead/typeahead-match.html';
$templateRequest(tplUrl).then(function(tplContent) {
var tplEl = angular.element(tplContent.trim());
element.replaceWith(tplEl);
$compile(tplEl)(scope);
});
}
};
}])
.filter('uibTypeaheadHighlight', ['$sce', '$injector', '$log', function($sce, $injector, $log) {
var isSanitizePresent;
isSanitizePresent = $injector.has('$sanitize');
function escapeRegexp(queryToEscape) {
return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
}
function containsHtml(matchItem) {
return /<.*>/g.test(matchItem);
}
return function(matchItem, query) {
if (!isSanitizePresent && containsHtml(matchItem)) {
$log.warn('Unsafe use of typeahead please use ngSanitize');
}
matchItem = query ? ('' + matchItem).replace(new RegExp(escapeRegexp(query), 'gi'), '<strong>$&</strong>') : matchItem;
if (!isSanitizePresent) {
matchItem = $sce.trustAsHtml(matchItem);
}
return matchItem;
};
}]);
angular.module("uib/template/accordion/accordion-group.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/accordion/accordion-group.html",
"<div class=\"panel\" ng-class=\"panelClass || 'panel-default'\">\n" +
"  <div role=\"tab\" id=\"{{::headingId}}\" aria-selected=\"{{isOpen}}\" class=\"panel-heading\" ng-keypress=\"toggleOpen($event)\">\n" +
"    <h4 class=\"panel-title\">\n" +
"      <a role=\"button\" data-toggle=\"collapse\" href aria-expanded=\"{{isOpen}}\" aria-controls=\"{{::panelId}}\" tabindex=\"0\" class=\"accordion-toggle\" ng-click=\"toggleOpen()\" uib-accordion-transclude=\"heading\"><span ng-class=\"{'text-muted': isDisabled}\">{{heading}}</span></a>\n" +
"    </h4>\n" +
"  </div>\n" +
"  <div id=\"{{::panelId}}\" aria-labelledby=\"{{::headingId}}\" aria-hidden=\"{{!isOpen}}\" role=\"tabpanel\" class=\"panel-collapse collapse\" uib-collapse=\"!isOpen\">\n" +
"    <div class=\"panel-body\" ng-transclude></div>\n" +
"  </div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/accordion/accordion.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/accordion/accordion.html",
"<div role=\"tablist\" class=\"panel-group\" ng-transclude></div>");
}]);
angular.module("uib/template/alert/alert.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/alert/alert.html",
"<div class=\"alert\" ng-class=\"['alert-' + (type || 'warning'), closeable ? 'alert-dismissible' : null]\" role=\"alert\">\n" +
"    <button ng-show=\"closeable\" type=\"button\" class=\"close\" ng-click=\"close({$event: $event})\">\n" +
"        <span aria-hidden=\"true\">&times;</span>\n" +
"        <span class=\"sr-only\">Close</span>\n" +
"    </button>\n" +
"    <div ng-transclude></div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/carousel/carousel.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/carousel/carousel.html",
"<div ng-mouseenter=\"pause()\" ng-mouseleave=\"play()\" class=\"carousel\" ng-swipe-right=\"prev()\" ng-swipe-left=\"next()\">\n" +
"  <div class=\"carousel-inner\" ng-transclude></div>\n" +
"  <a role=\"button\" href class=\"left carousel-control\" ng-click=\"prev()\" ng-show=\"slides.length > 1\">\n" +
"    <span aria-hidden=\"true\" class=\"glyphicon glyphicon-chevron-left\"></span>\n" +
"    <span class=\"sr-only\">previous</span>\n" +
"  </a>\n" +
"  <a role=\"button\" href class=\"right carousel-control\" ng-click=\"next()\" ng-show=\"slides.length > 1\">\n" +
"    <span aria-hidden=\"true\" class=\"glyphicon glyphicon-chevron-right\"></span>\n" +
"    <span class=\"sr-only\">next</span>\n" +
"  </a>\n" +
"  <ol class=\"carousel-indicators\" ng-show=\"slides.length > 1\">\n" +
"    <li ng-repeat=\"slide in slides | orderBy:indexOfSlide track by $index\" ng-class=\"{ active: isActive(slide) }\" ng-click=\"select(slide)\">\n" +
"      <span class=\"sr-only\">slide {{ $index + 1 }} of {{ slides.length }}<span ng-if=\"isActive(slide)\">, currently active</span></span>\n" +
"    </li>\n" +
"  </ol>\n" +
"</div>");
}]);
angular.module("uib/template/carousel/slide.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/carousel/slide.html",
"<div ng-class=\"{\n" +
"    'active': active\n" +
"  }\" class=\"item text-center\" ng-transclude></div>\n" +
"");
}]);
angular.module("uib/template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/datepicker.html",
"<div class=\"uib-datepicker\" ng-switch=\"datepickerMode\" role=\"application\" ng-keydown=\"keydown($event)\">\n" +
"  <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" +
"  <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" +
"  <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" +
"</div>");
}]);
angular.module("uib/template/datepicker/day.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/day.html",
"<table class=\"uib-daypicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" +
"  <thead>\n" +
"    <tr>\n" +
"      <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" +
"      <th colspan=\"{{::5 + showWeeks}}\"><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" +
"      <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" +
"    </tr>\n" +
"    <tr>\n" +
"      <th ng-if=\"showWeeks\" class=\"text-center\"></th>\n" +
"      <th ng-repeat=\"label in ::labels track by $index\" class=\"text-center\"><small aria-label=\"{{::label.full}}\">{{::label.abbr}}</small></th>\n" +
"    </tr>\n" +
"  </thead>\n" +
"  <tbody>\n" +
"    <tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\">\n" +
"      <td ng-if=\"showWeeks\" class=\"text-center h6\"><em>{{ weekNumbers[$index] }}</em></td>\n" +
"      <td ng-repeat=\"dt in row\" class=\"uib-day text-center\" role=\"gridcell\"\n" +
"        id=\"{{::dt.uid}}\"\n" +
"        ng-class=\"::dt.customClass\">\n" +
"        <button type=\"button\" class=\"btn btn-default btn-sm\"\n" +
"          uib-is-class=\"\n" +
"            'btn-info' for selectedDt,\n" +
"            'active' for activeDt\n" +
"            on dt\"\n" +
"          ng-click=\"select(dt.date)\"\n" +
"          ng-disabled=\"::dt.disabled\"\n" +
"          tabindex=\"-1\"><span ng-class=\"::{'text-muted': dt.secondary, 'text-info': dt.current}\">{{::dt.label}}</span></button>\n" +
"      </td>\n" +
"    </tr>\n" +
"  </tbody>\n" +
"</table>\n" +
"");
}]);
angular.module("uib/template/datepicker/month.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/month.html",
"<table class=\"uib-monthpicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" +
"  <thead>\n" +
"    <tr>\n" +
"      <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" +
"      <th><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" +
"      <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" +
"    </tr>\n" +
"  </thead>\n" +
"  <tbody>\n" +
"    <tr class=\"uib-months\" ng-repeat=\"row in rows track by $index\">\n" +
"      <td ng-repeat=\"dt in row\" class=\"uib-month text-center\" role=\"gridcell\"\n" +
"        id=\"{{::dt.uid}}\"\n" +
"        ng-class=\"::dt.customClass\">\n" +
"        <button type=\"button\" class=\"btn btn-default\"\n" +
"          uib-is-class=\"\n" +
"            'btn-info' for selectedDt,\n" +
"            'active' for activeDt\n" +
"            on dt\"\n" +
"          ng-click=\"select(dt.date)\"\n" +
"          ng-disabled=\"::dt.disabled\"\n" +
"          tabindex=\"-1\"><span ng-class=\"::{'text-info': dt.current}\">{{::dt.label}}</span></button>\n" +
"      </td>\n" +
"    </tr>\n" +
"  </tbody>\n" +
"</table>\n" +
"");
}]);
angular.module("uib/template/datepicker/popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/popup.html",
"<div>\n" +
"  <ul class=\"uib-datepicker-popup dropdown-menu\" dropdown-nested ng-if=\"isOpen\" ng-style=\"{top: position.top+'px', left: position.left+'px'}\" ng-keydown=\"keydown($event)\" ng-click=\"$event.stopPropagation()\">\n" +
"    <li ng-transclude></li>\n" +
"    <li ng-if=\"showButtonBar\" class=\"uib-button-bar\">\n" +
"    <span class=\"btn-group pull-left\">\n" +
"      <button type=\"button\" class=\"btn btn-sm btn-info uib-datepicker-current\" ng-click=\"select('today')\" ng-disabled=\"isDisabled('today')\">{{ getText('current') }}</button>\n" +
"      <button type=\"button\" class=\"btn btn-sm btn-danger uib-clear\" ng-click=\"select(null)\">{{ getText('clear') }}</button>\n" +
"    </span>\n" +
"      <button type=\"button\" class=\"btn btn-sm btn-success pull-right uib-close\" ng-click=\"close()\">{{ getText('close') }}</button>\n" +
"    </li>\n" +
"  </ul>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/datepicker/year.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/year.html",
"<table class=\"uib-yearpicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" +
"  <thead>\n" +
"    <tr>\n" +
"      <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" +
"      <th colspan=\"{{::columns - 2}}\"><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" +
"      <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" +
"    </tr>\n" +
"  </thead>\n" +
"  <tbody>\n" +
"    <tr class=\"uib-years\" ng-repeat=\"row in rows track by $index\">\n" +
"      <td ng-repeat=\"dt in row\" class=\"uib-year text-center\" role=\"gridcell\"\n" +
"        id=\"{{::dt.uid}}\"\n" +
"        ng-class=\"::dt.customClass\">\n" +
"        <button type=\"button\" class=\"btn btn-default\"\n" +
"          uib-is-class=\"\n" +
"            'btn-info' for selectedDt,\n" +
"            'active' for activeDt\n" +
"            on dt\"\n" +
"          ng-click=\"select(dt.date)\"\n" +
"          ng-disabled=\"::dt.disabled\"\n" +
"          tabindex=\"-1\"><span ng-class=\"::{'text-info': dt.current}\">{{::dt.label}}</span></button>\n" +
"      </td>\n" +
"    </tr>\n" +
"  </tbody>\n" +
"</table>\n" +
"");
}]);
angular.module("uib/template/modal/backdrop.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/modal/backdrop.html",
"<div class=\"modal-backdrop\"\n" +
"     uib-modal-animation-class=\"fade\"\n" +
"     modal-in-class=\"in\"\n" +
"     ng-style=\"{'z-index': 1040 + (index && 1 || 0) + index*10}\"\n" +
"></div>\n" +
"");
}]);
angular.module("uib/template/modal/window.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/modal/window.html",
"<div modal-render=\"{{$isRendered}}\" tabindex=\"-1\" role=\"dialog\" class=\"modal\"\n" +
"    uib-modal-animation-class=\"fade\"\n" +
"    modal-in-class=\"in\"\n" +
"    ng-style=\"{'z-index': 1050 + index*10, display: 'block'}\">\n" +
"    <div class=\"modal-dialog {{size ? 'modal-' + size : ''}}\"><div class=\"modal-content\" uib-modal-transclude></div></div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/pager/pager.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/pager/pager.html",
"<ul class=\"pager\">\n" +
"  <li ng-class=\"{disabled: noPrevious()||ngDisabled, previous: align}\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" +
"  <li ng-class=\"{disabled: noNext()||ngDisabled, next: align}\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" +
"</ul>\n" +
"");
}]);
angular.module("uib/template/pagination/pagination.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/pagination/pagination.html",
"<ul class=\"pagination\">\n" +
"  <li ng-if=\"::boundaryLinks\" ng-class=\"{disabled: noPrevious()||ngDisabled}\" class=\"pagination-first\"><a href ng-click=\"selectPage(1, $event)\">{{::getText('first')}}</a></li>\n" +
"  <li ng-if=\"::directionLinks\" ng-class=\"{disabled: noPrevious()||ngDisabled}\" class=\"pagination-prev\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" +
"  <li ng-repeat=\"page in pages track by $index\" ng-class=\"{active: page.active,disabled: ngDisabled&&!page.active}\" class=\"pagination-page\"><a href ng-click=\"selectPage(page.number, $event)\">{{page.text}}</a></li>\n" +
"  <li ng-if=\"::directionLinks\" ng-class=\"{disabled: noNext()||ngDisabled}\" class=\"pagination-next\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" +
"  <li ng-if=\"::boundaryLinks\" ng-class=\"{disabled: noNext()||ngDisabled}\" class=\"pagination-last\"><a href ng-click=\"selectPage(totalPages, $event)\">{{::getText('last')}}</a></li>\n" +
"</ul>\n" +
"");
}]);
angular.module("uib/template/tooltip/tooltip-html-popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tooltip/tooltip-html-popup.html",
"<div class=\"tooltip\"\n" +
"  tooltip-animation-class=\"fade\"\n" +
"  uib-tooltip-classes\n" +
"  ng-class=\"{ in: isOpen() }\">\n" +
"  <div class=\"tooltip-arrow\"></div>\n" +
"  <div class=\"tooltip-inner\" ng-bind-html=\"contentExp()\"></div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/tooltip/tooltip-popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tooltip/tooltip-popup.html",
"<div class=\"tooltip\"\n" +
"  tooltip-animation-class=\"fade\"\n" +
"  uib-tooltip-classes\n" +
"  ng-class=\"{ in: isOpen() }\">\n" +
"  <div class=\"tooltip-arrow\"></div>\n" +
"  <div class=\"tooltip-inner\" ng-bind=\"content\"></div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/tooltip/tooltip-template-popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tooltip/tooltip-template-popup.html",
"<div class=\"tooltip\"\n" +
"  tooltip-animation-class=\"fade\"\n" +
"  uib-tooltip-classes\n" +
"  ng-class=\"{ in: isOpen() }\">\n" +
"  <div class=\"tooltip-arrow\"></div>\n" +
"  <div class=\"tooltip-inner\"\n" +
"    uib-tooltip-template-transclude=\"contentExp()\"\n" +
"    tooltip-template-transclude-scope=\"originScope()\"></div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/popover/popover-html.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/popover/popover-html.html",
"<div class=\"popover\"\n" +
"  tooltip-animation-class=\"fade\"\n" +
"  uib-tooltip-classes\n" +
"  ng-class=\"{ in: isOpen() }\">\n" +
"  <div class=\"arrow\"></div>\n" +
"\n" +
"  <div class=\"popover-inner\">\n" +
"      <h3 class=\"popover-title\" ng-bind=\"title\" ng-if=\"title\"></h3>\n" +
"      <div class=\"popover-content\" ng-bind-html=\"contentExp()\"></div>\n" +
"  </div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/popover/popover-template.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/popover/popover-template.html",
"<div class=\"popover\"\n" +
"  tooltip-animation-class=\"fade\"\n" +
"  uib-tooltip-classes\n" +
"  ng-class=\"{ in: isOpen() }\">\n" +
"  <div class=\"arrow\"></div>\n" +
"\n" +
"  <div class=\"popover-inner\">\n" +
"      <h3 class=\"popover-title\" ng-bind=\"title\" ng-if=\"title\"></h3>\n" +
"      <div class=\"popover-content\"\n" +
"        uib-tooltip-template-transclude=\"contentExp()\"\n" +
"        tooltip-template-transclude-scope=\"originScope()\"></div>\n" +
"  </div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/popover/popover.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/popover/popover.html",
"<div class=\"popover\"\n" +
"  tooltip-animation-class=\"fade\"\n" +
"  uib-tooltip-classes\n" +
"  ng-class=\"{ in: isOpen() }\">\n" +
"  <div class=\"arrow\"></div>\n" +
"\n" +
"  <div class=\"popover-inner\">\n" +
"      <h3 class=\"popover-title\" ng-bind=\"title\" ng-if=\"title\"></h3>\n" +
"      <div class=\"popover-content\" ng-bind=\"content\"></div>\n" +
"  </div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/progressbar/bar.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/progressbar/bar.html",
"<div class=\"progress-bar\" ng-class=\"type && 'progress-bar-' + type\" role=\"progressbar\" aria-valuenow=\"{{value}}\" aria-valuemin=\"0\" aria-valuemax=\"{{max}}\" ng-style=\"{width: (percent < 100 ? percent : 100) + '%'}\" aria-valuetext=\"{{percent | number:0}}%\" aria-labelledby=\"{{::title}}\" ng-transclude></div>\n" +
"");
}]);
angular.module("uib/template/progressbar/progress.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/progressbar/progress.html",
"<div class=\"progress\" ng-transclude aria-labelledby=\"{{::title}}\"></div>");
}]);
angular.module("uib/template/progressbar/progressbar.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/progressbar/progressbar.html",
"<div class=\"progress\">\n" +
"  <div class=\"progress-bar\" ng-class=\"type && 'progress-bar-' + type\" role=\"progressbar\" aria-valuenow=\"{{value}}\" aria-valuemin=\"0\" aria-valuemax=\"{{max}}\" ng-style=\"{width: (percent < 100 ? percent : 100) + '%'}\" aria-valuetext=\"{{percent | number:0}}%\" aria-labelledby=\"{{::title}}\" ng-transclude></div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/rating/rating.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/rating/rating.html",
"<span ng-mouseleave=\"reset()\" ng-keydown=\"onKeydown($event)\" tabindex=\"0\" role=\"slider\" aria-valuemin=\"0\" aria-valuemax=\"{{range.length}}\" aria-valuenow=\"{{value || 0}}\">\n" +
"    <span ng-repeat-start=\"r in range track by $index\" class=\"sr-only\">({{ $index < value ? '*' : ' ' }})</span>\n" +
"    <i ng-repeat-end role=\"checkbox\" ng-mouseenter=\"enter($index + 1)\" ng-click=\"rate($index + 1)\" class=\"glyphicon\" ng-class=\"$index < value && (r.stateOn || 'glyphicon-star') || (r.stateOff || 'glyphicon-star-empty')\" ng-attr-title=\"{{r.title}}\" aria-checked='{{$index < value}}' value=\"{{$index + 1}}\"></i>\n" +
"</span>\n" +
"");
}]);
angular.module("uib/template/tabs/tab.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tabs/tab.html",
"<li ng-class=\"{active: active, disabled: disabled}\" class=\"uib-tab\">\n" +
"  <a href ng-click=\"select()\" uib-tab-heading-transclude>{{heading}}</a>\n" +
"</li>\n" +
"");
}]);
angular.module("uib/template/tabs/tabset.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/tabs/tabset.html",
"<div>\n" +
"  <ul class=\"nav nav-{{type || 'tabs'}}\" ng-class=\"{'nav-stacked': vertical, 'nav-justified': justified}\" ng-transclude></ul>\n" +
"  <div class=\"tab-content\">\n" +
"    <div class=\"tab-pane\" \n" +
"         ng-repeat=\"tab in tabs\" \n" +
"         ng-class=\"{active: tab.active}\"\n" +
"         uib-tab-content-transclude=\"tab\">\n" +
"    </div>\n" +
"  </div>\n" +
"</div>\n" +
"");
}]);
angular.module("uib/template/timepicker/timepicker.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/timepicker/timepicker.html",
"<table class=\"uib-timepicker\">\n" +
"  <tbody>\n" +
"    <tr class=\"text-center\" ng-show=\"::showSpinners\">\n" +
"      <td class=\"uib-increment hours\"><a ng-click=\"incrementHours()\" ng-class=\"{disabled: noIncrementHours()}\" class=\"btn btn-link\" ng-disabled=\"noIncrementHours()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-up\"></span></a></td>\n" +
"      <td>&nbsp;</td>\n" +
"      <td class=\"uib-increment minutes\"><a ng-click=\"incrementMinutes()\" ng-class=\"{disabled: noIncrementMinutes()}\" class=\"btn btn-link\" ng-disabled=\"noIncrementMinutes()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-up\"></span></a></td>\n" +
"      <td ng-show=\"showSeconds\">&nbsp;</td>\n" +
"      <td ng-show=\"showSeconds\" class=\"uib-increment seconds\"><a ng-click=\"incrementSeconds()\" ng-class=\"{disabled: noIncrementSeconds()}\" class=\"btn btn-link\" ng-disabled=\"noIncrementSeconds()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-up\"></span></a></td>\n" +
"      <td ng-show=\"showMeridian\"></td>\n" +
"    </tr>\n" +
"    <tr>\n" +
"      <td class=\"form-group uib-time hours\" ng-class=\"{'has-error': invalidHours}\">\n" +
"        <input style=\"width:50px;\" type=\"text\" placeholder=\"HH\" ng-model=\"hours\" ng-change=\"updateHours()\" class=\"form-control text-center\" ng-readonly=\"::readonlyInput\" maxlength=\"2\" tabindex=\"{{::tabindex}}\" ng-disabled=\"noIncrementHours()\" ng-blur=\"blur()\">\n" +
"      </td>\n" +
"      <td class=\"uib-separator\">:</td>\n" +
"      <td class=\"form-group uib-time minutes\" ng-class=\"{'has-error': invalidMinutes}\">\n" +
"        <input style=\"width:50px;\" type=\"text\" placeholder=\"MM\" ng-model=\"minutes\" ng-change=\"updateMinutes()\" class=\"form-control text-center\" ng-readonly=\"::readonlyInput\" maxlength=\"2\" tabindex=\"{{::tabindex}}\" ng-disabled=\"noIncrementMinutes()\" ng-blur=\"blur()\">\n" +
"      </td>\n" +
"      <td ng-show=\"showSeconds\" class=\"uib-separator\">:</td>\n" +
"      <td class=\"form-group uib-time seconds\" ng-class=\"{'has-error': invalidSeconds}\" ng-show=\"showSeconds\">\n" +
"        <input style=\"width:50px;\" type=\"text\" placeholder=\"SS\" ng-model=\"seconds\" ng-change=\"updateSeconds()\" class=\"form-control text-center\" ng-readonly=\"readonlyInput\" maxlength=\"2\" tabindex=\"{{::tabindex}}\" ng-disabled=\"noIncrementSeconds()\" ng-blur=\"blur()\">\n" +
"      </td>\n" +
"      <td ng-show=\"showMeridian\" class=\"uib-time am-pm\"><button type=\"button\" ng-class=\"{disabled: noToggleMeridian()}\" class=\"btn btn-default text-center\" ng-click=\"toggleMeridian()\" ng-disabled=\"noToggleMeridian()\" tabindex=\"{{::tabindex}}\">{{meridian}}</button></td>\n" +
"    </tr>\n" +
"    <tr class=\"text-center\" ng-show=\"::showSpinners\">\n" +
"      <td class=\"uib-decrement hours\"><a ng-click=\"decrementHours()\" ng-class=\"{disabled: noDecrementHours()}\" class=\"btn btn-link\" ng-disabled=\"noDecrementHours()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-down\"></span></a></td>\n" +
"      <td>&nbsp;</td>\n" +
"      <td class=\"uib-decrement minutes\"><a ng-click=\"decrementMinutes()\" ng-class=\"{disabled: noDecrementMinutes()}\" class=\"btn btn-link\" ng-disabled=\"noDecrementMinutes()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-down\"></span></a></td>\n" +
"      <td ng-show=\"showSeconds\">&nbsp;</td>\n" +
"      <td ng-show=\"showSeconds\" class=\"uib-decrement seconds\"><a ng-click=\"decrementSeconds()\" ng-class=\"{disabled: noDecrementSeconds()}\" class=\"btn btn-link\" ng-disabled=\"noDecrementSeconds()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-down\"></span></a></td>\n" +
"      <td ng-show=\"showMeridian\"></td>\n" +
"    </tr>\n" +
"  </tbody>\n" +
"</table>\n" +
"");
}]);
angular.module("uib/template/typeahead/typeahead-match.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/typeahead/typeahead-match.html",
"<a href\n" +
"   tabindex=\"-1\"\n" +
"   ng-bind-html=\"match.label | uibTypeaheadHighlight:query\"\n" +
"   ng-attr-title=\"{{match.label}}\"></a>\n" +
"");
}]);
angular.module("uib/template/typeahead/typeahead-popup.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/typeahead/typeahead-popup.html",
"<ul class=\"dropdown-menu\" ng-show=\"isOpen() && !moveInProgress\" ng-style=\"{top: position().top+'px', left: position().left+'px'}\" role=\"listbox\" aria-hidden=\"{{!isOpen()}}\">\n" +
"    <li ng-repeat=\"match in matches track by $index\" ng-class=\"{active: isActive($index) }\" ng-mouseenter=\"selectActive($index)\" ng-click=\"selectMatch($index, $event)\" role=\"option\" id=\"{{::match.id}}\">\n" +
"        <div uib-typeahead-match index=\"$index\" match=\"match\" query=\"query\" template-url=\"templateUrl\"></div>\n" +
"    </li>\n" +
"</ul>\n" +
"");
}]);
angular.module('ui.bootstrap.carousel').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend('<style type="text/css">.ng-animate.item:not(.left):not(.right){-webkit-transition:0s ease-in-out left;transition:0s ease-in-out left}</style>'); });
angular.module('ui.bootstrap.datepicker').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend('<style type="text/css">.uib-datepicker .uib-title{width:100%;}.uib-day button,.uib-month button,.uib-year button{min-width:100%;}.uib-datepicker-popup.dropdown-menu{display:block;}.uib-button-bar{padding:10px 9px 2px;}</style>'); });
angular.module('ui.bootstrap.timepicker').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend('<style type="text/css">.uib-time input{width:50px;}</style>'); });
angular.module('ui.bootstrap.typeahead').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend('<style type="text/css">[uib-typeahead-popup].dropdown-menu{display:block;}</style>'); });
;
/*! RESOURCE: /scripts/libs/moment/moment.min.js */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c});
/*! RESOURCE: /scripts/libs/moment/moment-timezone-with-data.min.js */
!function(c,M){"use strict";"object"==typeof module&&module.exports?module.exports=M(require("moment")):"function"==typeof define&&define.amd?define(["moment"],M):M(c.moment)}(this,function(b){"use strict";void 0===b.version&&b.default&&(b=b.default);var M,a={},p={},n={},i={},e={};b&&"string"==typeof b.version||S("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var c=b.version.split("."),A=+c[0],o=+c[1];function L(c){return 96<c?c-87:64<c?c-29:c-48}function z(c){var M=0,A=c.split("."),o=A[0],z=A[1]||"",b=1,a=0,p=1;for(45===c.charCodeAt(0)&&(p=-(M=1));M<o.length;M++)a=60*a+L(o.charCodeAt(M));for(M=0;M<z.length;M++)b/=60,a+=L(z.charCodeAt(M))*b;return a*p}function O(c){for(var M=0;M<c.length;M++)c[M]=z(c[M])}function q(c,M){var A,o=[];for(A=0;A<M.length;A++)o[A]=c[M[A]];return o}function r(c){var M=c.split("|"),A=M[2].split(" "),o=M[3].split(""),z=M[4].split(" ");return O(A),O(o),O(z),function(c,M){for(var A=0;A<M;A++)c[A]=Math.round((c[A-1]||0)+6e4*c[A]);c[M-1]=1/0}(z,o.length),{name:M[0],abbrs:q(M[1].split(" "),o),offsets:q(A,o),untils:z,population:0|M[5]}}function N(c){c&&this._set(r(c))}function d(c,M){this.name=c,this.zones=M}function W(c){var M=c.toTimeString(),A=M.match(/\([a-z ]+\)/i);"GMT"===(A=A&&A[0]?(A=A[0].match(/[A-Z]/g))?A.join(""):void 0:(A=M.match(/[A-Z]{3,5}/g))?A[0]:void 0)&&(A=void 0),this.at=+c,this.abbr=A,this.offset=c.getTimezoneOffset()}function f(c){this.zone=c,this.offsetScore=0,this.abbrScore=0}function X(c,M){for(var A,o;o=6e4*((M.at-c.at)/12e4|0);)(A=new W(new Date(c.at+o))).offset===c.offset?c=A:M=A;return c}function B(c,M){return c.offsetScore!==M.offsetScore?c.offsetScore-M.offsetScore:c.abbrScore!==M.abbrScore?c.abbrScore-M.abbrScore:c.zone.population!==M.zone.population?M.zone.population-c.zone.population:M.zone.name.localeCompare(c.zone.name)}function u(c,M){var A,o;for(O(M),A=0;A<M.length;A++)o=M[A],e[o]=e[o]||{},e[o][c]=!0}function l(){try{var c=Intl.DateTimeFormat().resolvedOptions().timeZone;if(c&&3<c.length){var M=i[T(c)];if(M)return M;S("Moment Timezone found "+c+" from the Intl api, but did not have that data loaded.")}}catch(c){}var A,o,z,b=function(){var c,M,A,o=(new Date).getFullYear()-2,z=new W(new Date(o,0,1)),b=[z];for(A=1;A<48;A++)(M=new W(new Date(o,A,1))).offset!==z.offset&&(c=X(z,M),b.push(c),b.push(new W(new Date(c.at+6e4)))),z=M;for(A=0;A<4;A++)b.push(new W(new Date(o+A,0,1))),b.push(new W(new Date(o+A,6,1)));return b}(),a=b.length,p=function(c){var M,A,o,z=c.length,b={},a=[];for(M=0;M<z;M++)for(A in o=e[c[M].offset]||{})o.hasOwnProperty(A)&&(b[A]=!0);for(M in b)b.hasOwnProperty(M)&&a.push(i[M]);return a}(b),n=[];for(o=0;o<p.length;o++){for(A=new f(s(p[o]),a),z=0;z<a;z++)A.scoreOffsetAt(b[z]);n.push(A)}return n.sort(B),0<n.length?n[0].zone.name:void 0}function T(c){return(c||"").toLowerCase().replace(/\//g,"_")}function t(c){var M,A,o,z;for("string"==typeof c&&(c=[c]),M=0;M<c.length;M++)z=T(A=(o=c[M].split("|"))[0]),a[z]=c[M],i[z]=A,u(z,o[2].split(" "))}function s(c,M){c=T(c);var A,o=a[c];return o instanceof N?o:"string"==typeof o?(o=new N(o),a[c]=o):p[c]&&M!==s&&(A=s(p[c],s))?((o=a[c]=new N)._set(A),o.name=i[c],o):null}function E(c){var M,A,o,z;for("string"==typeof c&&(c=[c]),M=0;M<c.length;M++)o=T((A=c[M].split("|"))[0]),z=T(A[1]),p[o]=z,i[o]=A[0],p[z]=o,i[z]=A[1]}function m(c){t(c.zones),E(c.links),function(c){var M,A,o,z;if(c&&c.length)for(M=0;M<c.length;M++)A=(z=c[M].split("|"))[0].toUpperCase(),o=z[1].split(" "),n[A]=new d(A,o)}(c.countries),R.dataVersion=c.version}function C(c){var M="X"===c._f||"x"===c._f;return!(!c._a||void 0!==c._tzm||M)}function S(c){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(c)}function R(c){var M=Array.prototype.slice.call(arguments,0,-1),A=arguments[arguments.length-1],o=s(A),z=b.utc.apply(null,M);return o&&!b.isMoment(c)&&C(z)&&z.add(o.parse(z),"minutes"),z.tz(A),z}(A<2||2==A&&o<6)&&S("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js "+b.version+". See momentjs.com"),N.prototype={_set:function(c){this.name=c.name,this.abbrs=c.abbrs,this.untils=c.untils,this.offsets=c.offsets,this.population=c.population},_index:function(c){var M,A=+c,o=this.untils;for(M=0;M<o.length;M++)if(A<o[M])return M},countries:function(){var M=this.name;return Object.keys(n).filter(function(c){return-1!==n[c].zones.indexOf(M)})},parse:function(c){var M,A,o,z,b=+c,a=this.offsets,p=this.untils,n=p.length-1;for(z=0;z<n;z++)if(M=a[z],A=a[z+1],o=a[z?z-1:z],M<A&&R.moveAmbiguousForward?M=A:o<M&&R.moveInvalidForward&&(M=o),b<p[z]-6e4*M)return a[z];return a[n]},abbr:function(c){return this.abbrs[this._index(c)]},offset:function(c){return S("zone.offset has been deprecated in favor of zone.utcOffset"),this.offsets[this._index(c)]},utcOffset:function(c){return this.offsets[this._index(c)]}},f.prototype.scoreOffsetAt=function(c){this.offsetScore+=Math.abs(this.zone.utcOffset(c.at)-c.offset),this.zone.abbr(c.at).replace(/[^A-Z]/g,"")!==c.abbr&&this.abbrScore++},R.version="0.5.31",R.dataVersion="",R._zones=a,R._links=p,R._names=i,R._countries=n,R.add=t,R.link=E,R.load=m,R.zone=s,R.zoneExists=function c(M){return c.didShowError||(c.didShowError=!0,S("moment.tz.zoneExists('"+M+"') has been deprecated in favor of !moment.tz.zone('"+M+"')")),!!s(M)},R.guess=function(c){return M&&!c||(M=l()),M},R.names=function(){var c,M=[];for(c in i)i.hasOwnProperty(c)&&(a[c]||a[p[c]])&&i[c]&&M.push(i[c]);return M.sort()},R.Zone=N,R.unpack=r,R.unpackBase60=z,R.needsOffset=C,R.moveInvalidForward=!0,R.moveAmbiguousForward=!1,R.countries=function(){return Object.keys(n)},R.zonesForCountry=function(c,M){if(!(c=function(c){return c=c.toUpperCase(),n[c]||null}(c)))return null;var A=c.zones.sort();return M?A.map(function(c){return{name:c,offset:s(c).utcOffset(new Date)}}):A};var g,P=b.fn;function D(c){return function(){return this._z?this._z.abbr(this):c.call(this)}}function h(c){return function(){return this._z=null,c.apply(this,arguments)}}b.tz=R,b.defaultZone=null,b.updateOffset=function(c,M){var A,o=b.defaultZone;if(void 0===c._z&&(o&&C(c)&&!c._isUTC&&(c._d=b.utc(c._a)._d,c.utc().add(o.parse(c),"minutes")),c._z=o),c._z)if(A=c._z.utcOffset(c),Math.abs(A)<16&&(A/=60),void 0!==c.utcOffset){var z=c._z;c.utcOffset(-A,M),c._z=z}else c.zone(A,M)},P.tz=function(c,M){if(c){if("string"!=typeof c)throw new Error("Time zone name must be a string, got "+c+" ["+typeof c+"]");return this._z=s(c),this._z?b.updateOffset(this,M):S("Moment Timezone has no data for "+c+". See http://momentjs.com/timezone/docs/#/data-loading/."),this}if(this._z)return this._z.name},P.zoneName=D(P.zoneName),P.zoneAbbr=D(P.zoneAbbr),P.utc=h(P.utc),P.local=h(P.local),P.utcOffset=(g=P.utcOffset,function(){return 0<arguments.length&&(this._z=null),g.apply(this,arguments)}),b.tz.setDefault=function(c){return(A<2||2==A&&o<9)&&S("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js "+b.version+"."),b.defaultZone=c?s(c):null,b};var k=b.momentProperties;return"[object Array]"===Object.prototype.toString.call(k)?(k.push("_z"),k.push("_a")):k&&(k._z=null),m({version:"2020a",zones:["Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q|48e5","Africa/Accra|LMT GMT +0020|.Q 0 -k|012121212121212121212121212121212121212121212121|-26BbX.8 6tzX.8 MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE 1BAk MnE 1C0k MnE 1BAk MnE 1BAk MnE|41e5","Africa/Nairobi|LMT EAT +0230 +0245|-2r.g -30 -2u -2J|01231|-1F3Cr.g 3Dzr.g okMu MFXJ|47e5","Africa/Algiers|PMT WET WEST CET CEST|-9.l 0 -10 -10 -20|0121212121212121343431312123431213|-2nco9.l cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 DA0 Imo0 rd0 De0 9Xz0 1fb0 1ap0 16K0 2yo0 mEp0 hwL0 jxA0 11A0 dDd0 17b0 11B0 1cN0 2Dy0 1cN0 1fB0 1cL0|26e5","Africa/Lagos|LMT WAT|-d.A -10|01|-22y0d.A|17e6","Africa/Bissau|LMT -01 GMT|12.k 10 0|012|-2ldX0 2xoo0|39e4","Africa/Maputo|LMT CAT|-2a.k -20|01|-2GJea.k|26e5","Africa/Cairo|EET EEST|-20 -30|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-1bIO0 vb0 1ip0 11z0 1iN0 1nz0 12p0 1pz0 10N0 1pz0 16p0 1jz0 s3d0 Vz0 1oN0 11b0 1oO0 10N0 1pz0 10N0 1pb0 10N0 1pb0 10N0 1pb0 10N0 1pz0 10N0 1pb0 10N0 1pb0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1WL0 rd0 1Rz0 wp0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1qL0 Xd0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1ny0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 WL0 1qN0 Rb0 1wp0 On0 1zd0 Lz0 1EN0 Fb0 c10 8n0 8Nd0 gL0 e10 mn0|15e6","Africa/Casablanca|LMT +00 +01|u.k 0 -10|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212|-2gMnt.E 130Lt.E rb0 Dd0 dVb0 b6p0 TX0 EoB0 LL0 gnd0 rz0 43d0 AL0 1Nd0 XX0 1Cp0 pz0 dEp0 4mn0 SyN0 AL0 1Nd0 wn0 1FB0 Db0 1zd0 Lz0 1Nf0 wM0 co0 go0 1o00 s00 dA0 vc0 11A0 A00 e00 y00 11A0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0|32e5","Africa/Ceuta|WET WEST CET CEST|0 -10 -10 -20|010101010101010101010232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-25KN0 11z0 drd0 18p0 3HX0 17d0 1fz0 1a10 1io0 1a00 1y7o0 LL0 gnd0 rz0 43d0 AL0 1Nd0 XX0 1Cp0 pz0 dEp0 4VB0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|85e3","Africa/El_Aaiun|LMT -01 +00 +01|Q.M 10 0 -10|012323232323232323232323232323232323232323232323232323232323232323232323232323232323|-1rDz7.c 1GVA7.c 6L0 AL0 1Nd0 XX0 1Cp0 pz0 1cBB0 AL0 1Nd0 wn0 1FB0 Db0 1zd0 Lz0 1Nf0 wM0 co0 go0 1o00 s00 dA0 vc0 11A0 A00 e00 y00 11A0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0|20e4","Africa/Johannesburg|SAST SAST SAST|-1u -20 -30|012121|-2GJdu 1Ajdu 1cL0 1cN0 1cL0|84e5","Africa/Juba|LMT CAT CAST EAT|-26.s -20 -30 -30|01212121212121212121212121212121213|-1yW26.s 1zK06.s 16L0 1iN0 17b0 1jd0 17b0 1ip0 17z0 1i10 17X0 1hB0 18n0 1hd0 19b0 1gp0 19z0 1iN0 17b0 1ip0 17z0 1i10 18n0 1hd0 18L0 1gN0 19b0 1gp0 19z0 1iN0 17z0 1i10 17X0 yGd0|","Africa/Khartoum|LMT CAT CAST EAT|-2a.8 -20 -30 -30|012121212121212121212121212121212131|-1yW2a.8 1zK0a.8 16L0 1iN0 17b0 1jd0 17b0 1ip0 17z0 1i10 17X0 1hB0 18n0 1hd0 19b0 1gp0 19z0 1iN0 17b0 1ip0 17z0 1i10 18n0 1hd0 18L0 1gN0 19b0 1gp0 19z0 1iN0 17z0 1i10 17X0 yGd0 HjL0|51e5","Africa/Monrovia|MMT MMT GMT|H.8 I.u 0|012|-23Lzg.Q 28G01.m|11e5","Africa/Ndjamena|LMT WAT WAST|-10.c -10 -20|0121|-2le10.c 2J3c0.c Wn0|13e5","Africa/Sao_Tome|LMT GMT WAT|A.J 0 -10|0121|-2le00 4i6N0 2q00|","Africa/Tripoli|LMT CET CEST EET|-Q.I -10 -20 -20|012121213121212121212121213123123|-21JcQ.I 1hnBQ.I vx0 4iP0 xx0 4eN0 Bb0 7ip0 U0n0 A10 1db0 1cN0 1db0 1dd0 1db0 1eN0 1bb0 1e10 1cL0 1c10 1db0 1dd0 1db0 1cN0 1db0 1q10 fAn0 1ep0 1db0 AKq0 TA0 1o00|11e5","Africa/Tunis|PMT CET CEST|-9.l -10 -20|0121212121212121212121212121212121|-2nco9.l 18pa9.l 1qM0 DA0 3Tc0 11B0 1ze0 WM0 7z0 3d0 14L0 1cN0 1f90 1ar0 16J0 1gXB0 WM0 1rA0 11c0 nwo0 Ko0 1cM0 1cM0 1rA0 10M0 zuM0 10N0 1aN0 1qM0 WM0 1qM0 11A0 1o00|20e5","Africa/Windhoek|+0130 SAST SAST CAT WAT|-1u -20 -30 -20 -10|01213434343434343434343434343434343434343434343434343|-2GJdu 1Ajdu 1cL0 1SqL0 9Io0 16P0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0|32e4","America/Adak|NST NWT NPT BST BDT AHST HST HDT|b0 a0 a0 b0 a0 a0 a0 90|012034343434343434343434343434343456767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17SX0 8wW0 iB0 Qlb0 52O0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cm0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|326","America/Anchorage|AST AWT APT AHST AHDT YST AKST AKDT|a0 90 90 a0 90 90 90 80|012034343434343434343434343434343456767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17T00 8wX0 iA0 Qlb0 52O0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cm0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|30e4","America/Port_of_Spain|LMT AST|46.4 40|01|-2kNvR.U|43e3","America/Araguaina|LMT -03 -02|3c.M 30 20|0121212121212121212121212121212121212121212121212121|-2glwL.c HdKL.c 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 dMN0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 ny10 Lz0|14e4","America/Argentina/Buenos_Aires|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323232323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wp0 Rb0 1wp0 TX0 A4p0 uL0 1qN0 WL0|","America/Argentina/Catamarca|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323132321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 rlB0 7B0 8zb0 uL0|","America/Argentina/Cordoba|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323132323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 A4p0 uL0 1qN0 WL0|","America/Argentina/Jujuy|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323121323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1ze0 TX0 1ld0 WK0 1wp0 TX0 A4p0 uL0|","America/Argentina/La_Rioja|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323231232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Qn0 qO0 16n0 Rb0 1wp0 TX0 rlB0 7B0 8zb0 uL0|","America/Argentina/Mendoza|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232312121321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1u20 SL0 1vd0 Tb0 1wp0 TW0 ri10 Op0 7TX0 uL0|","America/Argentina/Rio_Gallegos|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wp0 Rb0 1wp0 TX0 rlB0 7B0 8zb0 uL0|","America/Argentina/Salta|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323231323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 A4p0 uL0|","America/Argentina/San_Juan|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323231232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Qn0 qO0 16n0 Rb0 1wp0 TX0 rld0 m10 8lb0 uL0|","America/Argentina/San_Luis|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323121212321212|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 XX0 1q20 SL0 AN0 vDb0 m10 8lb0 8L0 jd0 1qN0 WL0 1qN0|","America/Argentina/Tucuman|CMT -04 -03 -02|4g.M 40 30 20|0121212121212121212121212121212121212121212323232313232123232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 rlB0 4N0 8BX0 uL0 1qN0 WL0|","America/Argentina/Ushuaia|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wp0 Rb0 1wp0 TX0 rkN0 8p0 8zb0 uL0|","America/Curacao|LMT -0430 AST|4z.L 4u 40|012|-2kV7o.d 28KLS.d|15e4","America/Asuncion|AMT -04 -03|3O.E 40 30|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212|-1x589.k 1DKM9.k 3CL0 3Dd0 10L0 1pB0 10n0 1pB0 10n0 1pB0 1cL0 1dd0 1db0 1dd0 1cL0 1dd0 1cL0 1dd0 1cL0 1dd0 1db0 1dd0 1cL0 1dd0 1cL0 1dd0 1cL0 1dd0 1db0 1dd0 1cL0 1lB0 14n0 1dd0 1cL0 1fd0 WL0 1rd0 1aL0 1dB0 Xz0 1qp0 Xb0 1qN0 10L0 1rB0 TX0 1tB0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 WN0 1qL0 11B0 1nX0 1ip0 WL0 1qN0 WL0 1qN0 WL0 1tB0 TX0 1tB0 TX0 1tB0 19X0 1a10 1fz0 1a10 1fz0 1cN0 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0|28e5","America/Atikokan|CST CDT CWT CPT EST|60 50 50 50 50|0101234|-25TQ0 1in0 Rnb0 3je0 8x30 iw0|28e2","America/Bahia_Banderas|LMT MST CST PST MDT CDT|71 70 60 80 60 50|0121212131414141414141414141414141414152525252525252525252525252525252525252525252525252525252|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 otX0 gmN0 P2N0 13Vd0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nW0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|84e3","America/Bahia|LMT -03 -02|2y.4 30 20|01212121212121212121212121212121212121212121212121212121212121|-2glxp.U HdLp.U 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 l5B0 Rb0|27e5","America/Barbados|LMT BMT AST ADT|3W.t 3W.t 40 30|01232323232|-1Q0I1.v jsM0 1ODC1.v IL0 1ip0 17b0 1ip0 17b0 1ld0 13b0|28e4","America/Belem|LMT -03 -02|3d.U 30 20|012121212121212121212121212121|-2glwK.4 HdKK.4 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0|20e5","America/Belize|LMT CST -0530 CDT|5Q.M 60 5u 50|01212121212121212121212121212121212121212121212121213131|-2kBu7.c fPA7.c Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1f0Mu qn0 lxB0 mn0|57e3","America/Blanc-Sablon|AST ADT AWT APT|40 30 30 30|010230|-25TS0 1in0 UGp0 8x50 iu0|11e2","America/Boa_Vista|LMT -04 -03|42.E 40 30|0121212121212121212121212121212121|-2glvV.k HdKV.k 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 smp0 WL0 1tB0 2L0|62e2","America/Bogota|BMT -05 -04|4U.g 50 40|0121|-2eb73.I 38yo3.I 2en0|90e5","America/Boise|PST PDT MST MWT MPT MDT|80 70 70 60 60 60|0101023425252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252|-261q0 1nX0 11B0 1nX0 8C10 JCL0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 Dd0 1Kn0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|21e4","America/Cambridge_Bay|-00 MST MWT MPT MDDT MDT CST CDT EST|0 70 60 60 50 60 60 50 50|0123141515151515151515151515151515151515151515678651515151515151515151515151515151515151515151515151515151515151515151515151|-21Jc0 RO90 8x20 ix0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11A0 1nX0 2K0 WQ0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e2","America/Campo_Grande|LMT -04 -03|3C.s 40 30|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwl.w HdLl.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 1C10 Lz0 1Ip0 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|77e4","America/Cancun|LMT CST EST EDT CDT|5L.4 60 50 40 50|0123232341414141414141414141414141414141412|-1UQG0 2q2o0 yLB0 1lb0 14p0 1lb0 14p0 Lz0 xB0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 Dd0|63e4","America/Caracas|CMT -0430 -04|4r.E 4u 40|01212|-2kV7w.k 28KM2.k 1IwOu kqo0|29e5","America/Cayenne|LMT -04 -03|3t.k 40 30|012|-2mrwu.E 2gWou.E|58e3","America/Panama|CMT EST|5j.A 50|01|-2uduE.o|15e5","America/Chicago|CST CDT EST CWT CPT|60 50 50 50 50|01010101010101010101010101010101010102010101010103401010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 1wp0 TX0 WN0 1qL0 1cN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 11B0 1Hz0 14p0 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 RB0 8x30 iw0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|92e5","America/Chihuahua|LMT MST CST CDT MDT|74.k 70 60 50 60|0121212323241414141414141414141414141414141414141414141414141414141414141414141414141414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 2zQN0 1lb0 14p0 1lb0 14q0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|81e4","America/Costa_Rica|SJMT CST CDT|5A.d 60 50|0121212121|-1Xd6n.L 2lu0n.L Db0 1Kp0 Db0 pRB0 15b0 1kp0 mL0|12e5","America/Creston|MST PST|70 80|010|-29DR0 43B0|53e2","America/Cuiaba|LMT -04 -03|3I.k 40 30|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwf.E HdLf.E 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 4a10 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|54e4","America/Danmarkshavn|LMT -03 -02 GMT|1e.E 30 20 0|01212121212121212121212121212121213|-2a5WJ.k 2z5fJ.k 19U0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 DC0|8","America/Dawson_Creek|PST PDT PWT PPT MST|80 70 70 70 70|0102301010101010101010101010101010101010101010101010101014|-25TO0 1in0 UGp0 8x10 iy0 3NB0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 ML0|12e3","America/Dawson|YST YDT YWT YPT YDDT PST PDT MST|90 80 80 80 70 80 70 70|01010230405656565656565656565656565656565656565656565656565656565656565656565656565656565657|-25TN0 1in0 1o10 13V0 Ser0 8x00 iz0 LCL0 1fA0 jrA0 fNd0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0|13e2","America/Denver|MST MDT MWT MPT|70 60 60 60|01010101023010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261r0 1nX0 11B0 1nX0 11B0 1qL0 WN0 mn0 Ord0 8x20 ix0 LCN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|26e5","America/Detroit|LMT CST EST EWT EPT EDT|5w.b 60 50 40 40 40|0123425252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252|-2Cgir.N peqr.N 156L0 8x40 iv0 6fd0 11z0 JxX1 SMX 1cN0 1cL0 aW10 1cL0 s10 1Vz0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e5","America/Edmonton|LMT MST MDT MWT MPT|7x.Q 70 60 60 60|0121212121212134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2yd4q.8 shdq.8 1in0 17d0 hz0 2dB0 1fz0 1a10 11z0 1qN0 WL0 1qN0 11z0 IGN0 8x20 ix0 3NB0 11z0 XQp0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|10e5","America/Eirunepe|LMT -05 -04|4D.s 50 40|0121212121212121212121212121212121|-2glvk.w HdLk.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 dPB0 On0 yTd0 d5X0|31e3","America/El_Salvador|LMT CST CDT|5U.M 60 50|012121|-1XiG3.c 2Fvc3.c WL0 1qN0 WL0|11e5","America/Tijuana|LMT MST PST PDT PWT PPT|7M.4 70 80 70 70 70|012123245232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-1UQE0 4PX0 8mM0 8lc0 SN0 1cL0 pHB0 83r0 zI0 5O10 1Rz0 cOO0 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 BUp0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 U10 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|20e5","America/Fort_Nelson|PST PDT PWT PPT MST|80 70 70 70 70|01023010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010104|-25TO0 1in0 UGp0 8x10 iy0 3NB0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0|39e2","America/Fort_Wayne|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|010101023010101010101010101040454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 QI10 Db0 RB0 8x30 iw0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 5Tz0 1o10 qLb0 1cL0 1cN0 1cL0 1qhd0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Fortaleza|LMT -03 -02|2y 30 20|0121212121212121212121212121212121212121|-2glxq HdLq 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 nsp0 WL0 1tB0 5z0 2mN0 On0|34e5","America/Glace_Bay|LMT AST ADT AWT APT|3X.M 40 30 30 30|012134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2IsI0.c CwO0.c 1in0 UGp0 8x50 iu0 iq10 11z0 Jg10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|19e3","America/Godthab|LMT -03 -02|3q.U 30 20|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2a5Ux.4 2z5dx.4 19U0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e3","America/Goose_Bay|NST NDT NST NDT NWT NPT AST ADT ADDT|3u.Q 2u.Q 3u 2u 2u 2u 40 30 20|010232323232323245232323232323232323232323232323232323232326767676767676767676767676767676767676767676768676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-25TSt.8 1in0 DXb0 2HbX.8 WL0 1qN0 WL0 1qN0 WL0 1tB0 TX0 1tB0 WL0 1qN0 WL0 1qN0 7UHu itu 1tB0 WL0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1tB0 WL0 1ld0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 S10 g0u 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14n1 1lb0 14p0 1nW0 11C0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zcX Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|76e2","America/Grand_Turk|KMT EST EDT AST|57.a 50 40 40|01212121212121212121212121212121212121212121212121212121212121212121212121232121212121212121212121212121212121212121|-2l1uQ.O 2HHBQ.O 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 5Ip0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e2","America/Guatemala|LMT CST CDT|62.4 60 50|0121212121|-24KhV.U 2efXV.U An0 mtd0 Nz0 ifB0 17b0 zDB0 11z0|13e5","America/Guayaquil|QMT -05 -04|5e 50 40|0121|-1yVSK 2uILK rz0|27e5","America/Guyana|LMT -0345 -03 -04|3Q.E 3J 30 40|0123|-2dvU7.k 2r6LQ.k Bxbf|80e4","America/Halifax|LMT AST ADT AWT APT|4e.o 40 30 30 30|0121212121212121212121212121212121212121212121212134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2IsHJ.A xzzJ.A 1db0 3I30 1in0 3HX0 IL0 1E10 ML0 1yN0 Pb0 1Bd0 Mn0 1Bd0 Rz0 1w10 Xb0 1w10 LX0 1w10 Xb0 1w10 Lz0 1C10 Jz0 1E10 OL0 1yN0 Un0 1qp0 Xb0 1qp0 11X0 1w10 Lz0 1HB0 LX0 1C10 FX0 1w10 Xb0 1qp0 Xb0 1BB0 LX0 1td0 Xb0 1qp0 Xb0 Rf0 8x50 iu0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 3Qp0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 3Qp0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 6i10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|39e4","America/Havana|HMT CST CDT|5t.A 50 40|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1Meuu.o 72zu.o ML0 sld0 An0 1Nd0 Db0 1Nd0 An0 6Ep0 An0 1Nd0 An0 JDd0 Mn0 1Ap0 On0 1fd0 11X0 1qN0 WL0 1wp0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 14n0 1ld0 14L0 1kN0 15b0 1kp0 1cL0 1cN0 1fz0 1a10 1fz0 1fB0 11z0 14p0 1nX0 11B0 1nX0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 14n0 1ld0 14n0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 1a10 1in0 1a10 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 17c0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 11A0 6i00 Rc0 1wo0 U00 1tA0 Rc0 1wo0 U00 1wo0 U00 1zc0 U00 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0|21e5","America/Hermosillo|LMT MST CST PST MDT|7n.Q 70 60 80 60|0121212131414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 otX0 gmN0 P2N0 13Vd0 1lb0 14p0 1lb0 14p0 1lb0|64e4","America/Indiana/Knox|CST CDT CWT CPT EST|60 50 50 50 50|0101023010101010101010101010101010101040101010101010101010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 3NB0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 11z0 1o10 11z0 1o10 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 3Cn0 8wp0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 z8o0 1o00 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Indiana/Marengo|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|0101023010101010101010104545454545414545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 dyN0 11z0 6fd0 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 jrz0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1VA0 LA0 1BX0 1e6p0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Indiana/Petersburg|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010104010101010101010101010141014545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 njX0 WN0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 3Fb0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 19co0 1o00 Rd0 1zb0 Oo0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Indiana/Tell_City|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010401054541010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 njX0 WN0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 8wn0 1cN0 1cL0 1cN0 1cK0 1cN0 1cL0 1qhd0 1o00 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Indiana/Vevay|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|010102304545454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 kPB0 Awn0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1lnd0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Indiana/Vincennes|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010101010454541014545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 1o10 11z0 g0p0 11z0 1o10 11z0 1qL0 WN0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 caL0 1cL0 1cN0 1cL0 1qhd0 1o00 Rd0 1zb0 Oo0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Indiana/Winamac|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010101010101010454541054545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 jrz0 1cL0 1cN0 1cL0 1qhd0 1o00 Rd0 1za0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Inuvik|-00 PST PDDT MST MDT|0 80 60 70 60|0121343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343|-FnA0 tWU0 1fA0 wPe0 2pz0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|35e2","America/Iqaluit|-00 EWT EPT EST EDDT EDT CST CDT|0 40 40 50 30 40 60 50|01234353535353535353535353535353535353535353567353535353535353535353535353535353535353535353535353535353535353535353535353|-16K00 7nX0 iv0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11C0 1nX0 11A0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|67e2","America/Jamaica|KMT EST EDT|57.a 50 40|0121212121212121212121|-2l1uQ.O 2uM1Q.O 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0|94e4","America/Juneau|PST PWT PPT PDT YDT YST AKST AKDT|80 70 70 70 80 90 90 80|01203030303030303030303030403030356767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17T20 8x10 iy0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cM0 1cM0 1cL0 1cN0 1fz0 1a10 1fz0 co0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|33e3","America/Kentucky/Louisville|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|0101010102301010101010101010101010101454545454545414545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 3Fd0 Nb0 LPd0 11z0 RB0 8x30 iw0 1nX1 e0X 9vd0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 xz0 gso0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1VA0 LA0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Kentucky/Monticello|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|0101023010101010101010101010101010101010101010101010101010101010101010101454545454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 SWp0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11A0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/La_Paz|CMT BST -04|4w.A 3w.A 40|012|-1x37r.o 13b0|19e5","America/Lima|LMT -05 -04|58.A 50 40|0121212121212121|-2tyGP.o 1bDzP.o zX0 1aN0 1cL0 1cN0 1cL0 1PrB0 zX0 1O10 zX0 6Gp0 zX0 98p0 zX0|11e6","America/Los_Angeles|PST PDT PWT PPT|80 70 70 70|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261q0 1nX0 11B0 1nX0 SgN0 8x10 iy0 5Wp1 1VaX 3dA0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e6","America/Maceio|LMT -03 -02|2m.Q 30 20|012121212121212121212121212121212121212121|-2glxB.8 HdLB.8 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 dMN0 Lz0 8Q10 WL0 1tB0 5z0 2mN0 On0|93e4","America/Managua|MMT CST EST CDT|5J.c 60 50 50|0121313121213131|-1quie.M 1yAMe.M 4mn0 9Up0 Dz0 1K10 Dz0 s3F0 1KH0 DB0 9In0 k8p0 19X0 1o30 11y0|22e5","America/Manaus|LMT -04 -03|40.4 40 30|01212121212121212121212121212121|-2glvX.U HdKX.U 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 dPB0 On0|19e5","America/Martinique|FFMT AST ADT|44.k 40 30|0121|-2mPTT.E 2LPbT.E 19X0|39e4","America/Matamoros|LMT CST CDT|6E 60 50|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1UQG0 2FjC0 1nX0 i6p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 U10 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|45e4","America/Mazatlan|LMT MST CST PST MDT|75.E 70 60 80 60|0121212131414141414141414141414141414141414141414141414141414141414141414141414141414141414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 otX0 gmN0 P2N0 13Vd0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|44e4","America/Menominee|CST CDT CWT CPT EST|60 50 50 50 50|01010230101041010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 1o10 11z0 LCN0 1fz0 6410 9Jb0 1cM0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|85e2","America/Merida|LMT CST EST CDT|5W.s 60 50 50|0121313131313131313131313131313131313131313131313131313131313131313131313131313131313131|-1UQG0 2q2o0 2hz0 wu30 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|11e5","America/Metlakatla|PST PWT PPT PDT AKST AKDT|80 70 70 70 90 80|01203030303030303030303030303030304545450454545454545454545454545454545454545454|-17T20 8x10 iy0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1hU10 Rd0 1zb0 Op0 1zb0 Op0 1zb0 uM0 jB0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|14e2","America/Mexico_City|LMT MST CST CDT CWT|6A.A 70 60 50 50|012121232324232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 gEn0 TX0 3xd0 Jb0 6zB0 SL0 e5d0 17b0 1Pff0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|20e6","America/Miquelon|LMT AST -03 -02|3I.E 40 30 20|012323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-2mKkf.k 2LTAf.k gQ10 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|61e2","America/Moncton|EST AST ADT AWT APT|50 40 30 30 30|012121212121212121212134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2IsH0 CwN0 1in0 zAo0 An0 1Nd0 An0 1Nd0 An0 1Nd0 An0 1Nd0 An0 1Nd0 An0 1K10 Lz0 1zB0 NX0 1u10 Wn0 S20 8x50 iu0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 3Cp0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14n1 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 ReX 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|64e3","America/Monterrey|LMT CST CDT|6F.g 60 50|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1UQG0 2FjC0 1nX0 i6p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|41e5","America/Montevideo|LMT MMT -04 -03 -0330 -0230 -02 -0130|3I.P 3I.P 40 30 3u 2u 20 1u|012343434343434343434343435353636353636375363636363636363636363636363636363636363636363|-2tRUf.9 sVc0 8jcf.9 1db0 1dcu 1cLu 1dcu 1cLu ircu 11zu 1o0u 11zu 1o0u 11zu 1o0u 11zu 1qMu WLu 1qMu WLu 1fAu 1cLu 1o0u 11zu NAu 3jXu zXu Dq0u 19Xu pcu jz0 cm10 19X0 6tB0 1fbu 3o0u jX0 4vB0 xz0 3Cp0 mmu 1a10 IMu Db0 4c10 uL0 1Nd0 An0 1SN0 uL0 mp0 28L0 iPB0 un0 1SN0 xz0 1zd0 Lz0 1zd0 Rb0 1zd0 On0 1wp0 Rb0 s8p0 1fB0 1ip0 11z0 1ld0 14n0 1o10 11z0 1o10 11z0 1o10 14n0 1ld0 14n0 1ld0 14n0 1o10 11z0 1o10 11z0 1o10 11z0|17e5","America/Toronto|EST EDT EWT EPT|50 40 40 40|01010101010101010101010101010101010101010101012301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TR0 1in0 11Wu 1nzu 1fD0 WJ0 1wr0 Nb0 1Ap0 On0 1zd0 On0 1wp0 TX0 1tB0 TX0 1tB0 TX0 1tB0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 4kM0 8x40 iv0 1o10 11z0 1nX0 11z0 1o10 11z0 1o10 1qL0 11D0 1nX0 11B0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|65e5","America/Nassau|LMT EST EDT|59.u 50 40|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2kNuO.u 26XdO.u 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|24e4","America/New_York|EST EDT EWT EPT|50 40 40 40|01010101010101010101010101010101010101010101010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261t0 1nX0 11B0 1nX0 11B0 1qL0 1a10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 RB0 8x40 iv0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|21e6","America/Nipigon|EST EDT EWT EPT|50 40 40 40|010123010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TR0 1in0 Rnb0 3je0 8x40 iv0 19yN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|16e2","America/Nome|NST NWT NPT BST BDT YST AKST AKDT|b0 a0 a0 b0 a0 90 90 80|012034343434343434343434343434343456767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17SX0 8wW0 iB0 Qlb0 52O0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cl0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|38e2","America/Noronha|LMT -02 -01|29.E 20 10|0121212121212121212121212121212121212121|-2glxO.k HdKO.k 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 nsp0 WL0 1tB0 2L0 2pB0 On0|30e2","America/North_Dakota/Beulah|MST MDT MWT MPT CST CDT|70 60 60 60 60 50|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101014545454545454545454545454545454545454545454545454545454|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Oo0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/North_Dakota/Center|MST MDT MWT MPT CST CDT|70 60 60 60 60 50|010102301010101010101010101010101010101010101010101010101014545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14o0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/North_Dakota/New_Salem|MST MDT MWT MPT CST CDT|70 60 60 60 60 50|010102301010101010101010101010101010101010101010101010101010101010101010101010101454545454545454545454545454545454545454545454545454545454545454545454|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14o0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","America/Ojinaga|LMT MST CST CDT MDT|6V.E 70 60 50 60|0121212323241414141414141414141414141414141414141414141414141414141414141414141414141414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 2zQN0 1lb0 14p0 1lb0 14q0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 U10 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e3","America/Pangnirtung|-00 AST AWT APT ADDT ADT EDT EST CST CDT|0 40 30 30 20 30 40 50 60 50|012314151515151515151515151515151515167676767689767676767676767676767676767676767676767676767676767676767676767676767676767|-1XiM0 PnG0 8x50 iu0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1o00 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11C0 1nX0 11A0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|14e2","America/Paramaribo|LMT PMT PMT -0330 -03|3E.E 3E.Q 3E.A 3u 30|01234|-2nDUj.k Wqo0.c qanX.I 1yVXN.o|24e4","America/Phoenix|MST MDT MWT|70 60 60|01010202010|-261r0 1nX0 11B0 1nX0 SgN0 4Al1 Ap0 1db0 SWqX 1cL0|42e5","America/Port-au-Prince|PPMT EST EDT|4N 50 40|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-28RHb 2FnMb 19X0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14q0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 i6n0 1nX0 11B0 1nX0 d430 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 3iN0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e5","America/Rio_Branco|LMT -05 -04|4v.c 50 40|01212121212121212121212121212121|-2glvs.M HdLs.M 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 NBd0 d5X0|31e4","America/Porto_Velho|LMT -04 -03|4f.A 40 30|012121212121212121212121212121|-2glvI.o HdKI.o 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0|37e4","America/Puerto_Rico|AST AWT APT|40 30 30|0120|-17lU0 7XT0 iu0|24e5","America/Punta_Arenas|SMT -05 -04 -03|4G.K 50 40 30|0102021212121212121232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-2q2jh.e fJAh.e 5knG.K 1Vzh.e jRAG.K 1pbh.e 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 nHX0 op0 blz0 ko0 Qeo0 WL0 1zd0 On0 1ip0 11z0 1o10 11z0 1qN0 WL0 1ld0 14n0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0|","America/Rainy_River|CST CDT CWT CPT|60 50 50 50|010123010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TQ0 1in0 Rnb0 3je0 8x30 iw0 19yN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|842","America/Rankin_Inlet|-00 CST CDDT CDT EST|0 60 40 50 50|012131313131313131313131313131313131313131313431313131313131313131313131313131313131313131313131313131313131313131313131|-vDc0 keu0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|26e2","America/Recife|LMT -03 -02|2j.A 30 20|0121212121212121212121212121212121212121|-2glxE.o HdLE.o 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 nsp0 WL0 1tB0 2L0 2pB0 On0|33e5","America/Regina|LMT MST MDT MWT MPT CST|6W.A 70 60 60 60 60|012121212121212121212121341212121212121212121212121215|-2AD51.o uHe1.o 1in0 s2L0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 66N0 1cL0 1cN0 19X0 1fB0 1cL0 1fB0 1cL0 1cN0 1cL0 M30 8x20 ix0 1ip0 1cL0 1ip0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 3NB0 1cL0 1cN0|19e4","America/Resolute|-00 CST CDDT CDT EST|0 60 40 50 50|012131313131313131313131313131313131313131313431313131313431313131313131313131313131313131313131313131313131313131313131|-SnA0 GWS0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|229","America/Santarem|LMT -04 -03|3C.M 40 30|0121212121212121212121212121212|-2glwl.c HdLl.c 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 NBd0|21e4","America/Santiago|SMT -05 -04 -03|4G.K 50 40 30|010202121212121212321232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-2q2jh.e fJAh.e 5knG.K 1Vzh.e jRAG.K 1pbh.e 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 nHX0 op0 9Bz0 jb0 1oN0 ko0 Qeo0 WL0 1zd0 On0 1ip0 11z0 1o10 11z0 1qN0 WL0 1ld0 14n0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0|62e5","America/Santo_Domingo|SDMT EST EDT -0430 AST|4E 50 40 4u 40|01213131313131414|-1ttjk 1lJMk Mn0 6sp0 Lbu 1Cou yLu 1RAu wLu 1QMu xzu 1Q0u xXu 1PAu 13jB0 e00|29e5","America/Sao_Paulo|LMT -03 -02|36.s 30 20|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwR.w HdKR.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 pTd0 PX0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 1C10 Lz0 1Ip0 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|20e6","America/Scoresbysund|LMT -02 -01 +00|1r.Q 20 10 0|0121323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-2a5Ww.8 2z5ew.8 1a00 1cK0 1cL0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|452","America/Sitka|PST PWT PPT PDT YST AKST AKDT|80 70 70 70 90 90 80|01203030303030303030303030303030345656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565|-17T20 8x10 iy0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 co0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|90e2","America/St_Johns|NST NDT NST NDT NWT NPT NDDT|3u.Q 2u.Q 3u 2u 2u 2u 1u|01010101010101010101010101010101010102323232323232324523232323232323232323232323232323232323232323232323232323232323232323232323232323232326232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-28oit.8 14L0 1nB0 1in0 1gm0 Dz0 1JB0 1cL0 1cN0 1cL0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 1cL0 1cN0 1cL0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 1cL0 1fB0 19X0 1fB0 19X0 10O0 eKX.8 19X0 1iq0 WL0 1qN0 WL0 1qN0 WL0 1tB0 TX0 1tB0 WL0 1qN0 WL0 1qN0 7UHu itu 1tB0 WL0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1tB0 WL0 1ld0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14n1 1lb0 14p0 1nW0 11C0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zcX Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|11e4","America/Swift_Current|LMT MST MDT MWT MPT CST|7b.k 70 60 60 60 60|012134121212121212121215|-2AD4M.E uHdM.E 1in0 UGp0 8x20 ix0 1o10 17b0 1ip0 11z0 1o10 11z0 1o10 11z0 isN0 1cL0 3Cp0 1cL0 1cN0 11z0 1qN0 WL0 pMp0|16e3","America/Tegucigalpa|LMT CST CDT|5M.Q 60 50|01212121|-1WGGb.8 2ETcb.8 WL0 1qN0 WL0 GRd0 AL0|11e5","America/Thule|LMT AST ADT|4z.8 40 30|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2a5To.Q 31NBo.Q 1cL0 1cN0 1cL0 1fB0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|656","America/Thunder_Bay|CST EST EWT EPT EDT|60 50 40 40 40|0123141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141|-2q5S0 1iaN0 8x40 iv0 XNB0 1cL0 1cN0 1fz0 1cN0 1cL0 3Cp0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|11e4","America/Vancouver|PST PDT PWT PPT|80 70 70 70|0102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TO0 1in0 UGp0 8x10 iy0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e5","America/Whitehorse|YST YDT YWT YPT YDDT PST PDT MST|90 80 80 80 70 80 70 70|01010230405656565656565656565656565656565656565656565656565656565656565656565656565656565657|-25TN0 1in0 1o10 13V0 Ser0 8x00 iz0 LCL0 1fA0 3NA0 vrd0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0|23e3","America/Winnipeg|CST CDT CWT CPT|60 50 50 50|010101023010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aIi0 WL0 3ND0 1in0 Jap0 Rb0 aCN0 8x30 iw0 1tB0 11z0 1ip0 11z0 1o10 11z0 1o10 11z0 1rd0 10L0 1op0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 1cL0 1cN0 11z0 6i10 WL0 6i10 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|66e4","America/Yakutat|YST YWT YPT YDT AKST AKDT|90 80 80 80 90 80|01203030303030303030303030303030304545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-17T10 8x00 iz0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cn0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|642","America/Yellowknife|-00 MST MWT MPT MDDT MDT|0 70 60 60 50 60|012314151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151|-1pdA0 hix0 8x20 ix0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|19e3","Antarctica/Casey|-00 +08 +11|0 -80 -b0|01212121|-2q00 1DjS0 T90 40P0 KL0 blz0 3m10|10","Antarctica/Davis|-00 +07 +05|0 -70 -50|01012121|-vyo0 iXt0 alj0 1D7v0 VB0 3Wn0 KN0|70","Antarctica/DumontDUrville|-00 +10|0 -a0|0101|-U0o0 cfq0 bFm0|80","Antarctica/Macquarie|AEST AEDT -00 +11|-a0 -b0 0 -b0|0102010101010101010101010101010101010101010101010101010101010101010101010101010101010101013|-29E80 19X0 4SL0 1ayy0 Lvs0 1cM0 1o00 Rc0 1wo0 Rc0 1wo0 U00 1wo0 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1qM0 WM0 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1wo0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 11A0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 11A0 1o00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1cM0 1cM0 1cM0|1","Antarctica/Mawson|-00 +06 +05|0 -60 -50|012|-CEo0 2fyk0|60","Pacific/Auckland|NZMT NZST NZST NZDT|-bu -cu -c0 -d0|01020202020202020202020202023232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-1GCVu Lz0 1tB0 11zu 1o0u 11zu 1o0u 11zu 1o0u 14nu 1lcu 14nu 1lcu 1lbu 11Au 1nXu 11Au 1nXu 11Au 1nXu 11Au 1nXu 11Au 1qLu WMu 1qLu 11Au 1n1bu IM0 1C00 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1qM0 14o0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1io0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00|14e5","Antarctica/Palmer|-00 -03 -04 -02|0 30 40 20|0121212121213121212121212121212121212121212121212121212121212121212121212121212121|-cao0 nD0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 jsN0 14N0 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0|40","Antarctica/Rothera|-00 -03|0 30|01|gOo0|130","Antarctica/Syowa|-00 +03|0 -30|01|-vs00|20","Antarctica/Troll|-00 +00 +02|0 0 -20|01212121212121212121212121212121212121212121212121212121212121212121|1puo0 hd0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|40","Antarctica/Vostok|-00 +06|0 -60|01|-tjA0|25","Europe/Oslo|CET CEST|-10 -20|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2awM0 Qm0 W6o0 5pf0 WM0 1fA0 1cM0 1cM0 1cM0 1cM0 wJc0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1qM0 WM0 zpc0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|62e4","Asia/Riyadh|LMT +03|-36.Q -30|01|-TvD6.Q|57e5","Asia/Almaty|LMT +05 +06 +07|-57.M -50 -60 -70|012323232323232323232321232323232323232323232323232|-1Pc57.M eUo7.M 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0|15e5","Asia/Amman|LMT EET EEST|-2n.I -20 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1yW2n.I 1HiMn.I KL0 1oN0 11b0 1oN0 11b0 1pd0 1dz0 1cp0 11b0 1op0 11b0 fO10 1db0 1e10 1cL0 1cN0 1cL0 1cN0 1fz0 1pd0 10n0 1ld0 14n0 1hB0 15b0 1ip0 19X0 1cN0 1cL0 1cN0 17b0 1ld0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1So0 y00 1fc0 1dc0 1co0 1dc0 1cM0 1cM0 1cM0 1o00 11A0 1lc0 17c0 1cM0 1cM0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 4bX0 Dd0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|25e5","Asia/Anadyr|LMT +12 +13 +14 +11|-bN.U -c0 -d0 -e0 -b0|01232121212121212121214121212121212121212121212121212121212141|-1PcbN.U eUnN.U 23CL0 1db0 2q10 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|13e3","Asia/Aqtau|LMT +04 +05 +06|-3l.4 -40 -50 -60|012323232323232323232123232312121212121212121212|-1Pc3l.4 eUnl.4 24PX0 2pX0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|15e4","Asia/Aqtobe|LMT +04 +05 +06|-3M.E -40 -50 -60|0123232323232323232321232323232323232323232323232|-1Pc3M.E eUnM.E 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0|27e4","Asia/Ashgabat|LMT +04 +05 +06|-3R.w -40 -50 -60|0123232323232323232323212|-1Pc3R.w eUnR.w 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0|41e4","Asia/Atyrau|LMT +03 +05 +06 +04|-3r.I -30 -50 -60 -40|01232323232323232323242323232323232324242424242|-1Pc3r.I eUor.I 24PW0 2pX0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 2sp0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|","Asia/Baghdad|BMT +03 +04|-2V.A -30 -40|012121212121212121212121212121212121212121212121212121|-26BeV.A 2ACnV.A 11b0 1cp0 1dz0 1dd0 1db0 1cN0 1cp0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1de0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0|66e5","Asia/Qatar|LMT +04 +03|-3q.8 -40 -30|012|-21Jfq.8 27BXq.8|96e4","Asia/Baku|LMT +03 +04 +05|-3j.o -30 -40 -50|01232323232323232323232123232323232323232323232323232323232323232|-1Pc3j.o 1jUoj.o WCL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 1cM0 9Je0 1o00 11z0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00|27e5","Asia/Bangkok|BMT +07|-6G.4 -70|01|-218SG.4|15e6","Asia/Barnaul|LMT +06 +07 +08|-5z -60 -70 -80|0123232323232323232323212323232321212121212121212121212121212121212|-21S5z pCnz 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 p90 LE0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|","Asia/Beirut|EET EEST|-20 -30|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-21aq0 1on0 1410 1db0 19B0 1in0 1ip0 WL0 1lQp0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 11b0 q6N0 En0 1oN0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 11b0 1op0 11b0 dA10 17b0 1iN0 17b0 1iN0 17b0 1iN0 17b0 1vB0 SL0 1mp0 13z0 1iN0 17b0 1iN0 17b0 1jd0 12n0 1a10 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0|22e5","Asia/Bishkek|LMT +05 +06 +07|-4W.o -50 -60 -70|012323232323232323232321212121212121212121212121212|-1Pc4W.o eUnW.o 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2e00 1tX0 17b0 1ip0 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1cPu 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0|87e4","Asia/Brunei|LMT +0730 +08|-7D.E -7u -80|012|-1KITD.E gDc9.E|42e4","Asia/Kolkata|MMT IST +0630|-5l.a -5u -6u|012121|-2zOtl.a 1r2LP.a 1un0 HB0 7zX0|15e6","Asia/Chita|LMT +08 +09 +10|-7x.Q -80 -90 -a0|012323232323232323232321232323232323232323232323232323232323232312|-21Q7x.Q pAnx.Q 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3re0|33e4","Asia/Choibalsan|LMT +07 +08 +10 +09|-7C -70 -80 -a0 -90|0123434343434343434343434343434343434343434343424242|-2APHC 2UkoC cKn0 1da0 1dd0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 6hD0 11z0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 3Db0 h1f0 1cJ0 1cP0 1cJ0|38e3","Asia/Shanghai|CST CDT|-80 -90|01010101010101010101010101010|-23uw0 18n0 OjB0 Rz0 11d0 1wL0 A10 8HX0 1G10 Tz0 1ip0 1jX0 1cN0 11b0 1oN0 aL0 1tU30 Rb0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0|23e6","Asia/Colombo|MMT +0530 +06 +0630|-5j.w -5u -60 -6u|01231321|-2zOtj.w 1rFbN.w 1zzu 7Apu 23dz0 11zu n3cu|22e5","Asia/Dhaka|HMT +0630 +0530 +06 +07|-5R.k -6u -5u -60 -70|0121343|-18LFR.k 1unn.k HB0 m6n0 2kxbu 1i00|16e6","Asia/Damascus|LMT EET EEST|-2p.c -20 -30|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-21Jep.c Hep.c 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1xRB0 11X0 1oN0 10L0 1pB0 11b0 1oN0 10L0 1mp0 13X0 1oN0 11b0 1pd0 11b0 1oN0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 Nb0 1AN0 Nb0 bcp0 19X0 1gp0 19X0 3ld0 1xX0 Vd0 1Bz0 Sp0 1vX0 10p0 1dz0 1cN0 1cL0 1db0 1db0 1g10 1an0 1ap0 1db0 1fd0 1db0 1cN0 1db0 1dd0 1db0 1cp0 1dz0 1c10 1dX0 1cN0 1db0 1dd0 1db0 1cN0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1db0 1cN0 1db0 1cN0 19z0 1fB0 1qL0 11B0 1on0 Wp0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0|26e5","Asia/Dili|LMT +08 +09|-8m.k -80 -90|01212|-2le8m.k 1dnXm.k 1nfA0 Xld0|19e4","Asia/Dubai|LMT +04|-3F.c -40|01|-21JfF.c|39e5","Asia/Dushanbe|LMT +05 +06 +07|-4z.c -50 -60 -70|012323232323232323232321|-1Pc4z.c eUnz.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2hB0|76e4","Asia/Famagusta|LMT EET EEST +03|-2f.M -20 -30 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212312121212121212121212121212121212121212121|-1Vc2f.M 2a3cf.M 1cL0 1qp0 Xz0 19B0 19X0 1fB0 1db0 1cp0 1cL0 1fB0 19X0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1o30 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 15U0 2Ks0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Asia/Gaza|EET EEST IST IDT|-20 -30 -20 -30|0101010101010101010101010101010123232323232323232323232323232320101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-1c2q0 5Rb0 10r0 1px0 10N0 1pz0 16p0 1jB0 16p0 1jx0 pBd0 Vz0 1oN0 11b0 1oO0 10N0 1pz0 10N0 1pb0 10N0 1pb0 10N0 1pb0 10N0 1pz0 10N0 1pb0 10N0 1pb0 11d0 1oL0 dW0 hfB0 Db0 1fB0 Rb0 bXd0 gM0 8Q00 IM0 1wM0 11z0 1C10 IL0 1s10 10n0 1o10 WL0 1zd0 On0 1ld0 11z0 1o10 14n0 1o10 14n0 1nd0 12n0 1nd0 Xz0 1q10 12n0 M10 C00 17c0 1io0 17c0 1io0 17c0 1o00 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 17c0 1io0 18N0 1bz0 19z0 1gp0 1610 1iL0 11z0 1o10 14o0 1lA1 SKX 1xd1 MKX 1AN0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nz0 1220 1qL0 WN0 1qL0 WN0 1qL0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1rc0|18e5","Asia/Hebron|EET EEST IST IDT|-20 -30 -20 -30|010101010101010101010101010101012323232323232323232323232323232010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-1c2q0 5Rb0 10r0 1px0 10N0 1pz0 16p0 1jB0 16p0 1jx0 pBd0 Vz0 1oN0 11b0 1oO0 10N0 1pz0 10N0 1pb0 10N0 1pb0 10N0 1pb0 10N0 1pz0 10N0 1pb0 10N0 1pb0 11d0 1oL0 dW0 hfB0 Db0 1fB0 Rb0 bXd0 gM0 8Q00 IM0 1wM0 11z0 1C10 IL0 1s10 10n0 1o10 WL0 1zd0 On0 1ld0 11z0 1o10 14n0 1o10 14n0 1nd0 12n0 1nd0 Xz0 1q10 12n0 M10 C00 17c0 1io0 17c0 1io0 17c0 1o00 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 17c0 1io0 18N0 1bz0 19z0 1gp0 1610 1iL0 12L0 1mN0 14o0 1lc0 Tb0 1xd1 MKX bB0 cn0 1cN0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nz0 1220 1qL0 WN0 1qL0 WN0 1qL0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0 11c0 1rc0|25e4","Asia/Ho_Chi_Minh|LMT PLMT +07 +08 +09|-76.E -76.u -70 -80 -90|0123423232|-2yC76.E bK00.a 1h7b6.u 5lz0 18o0 3Oq0 k5b0 aW00 BAM0|90e5","Asia/Hong_Kong|LMT HKT HKST HKWT JST|-7A.G -80 -90 -8u -90|0123412121212121212121212121212121212121212121212121212121212121212121|-2CFH0 1taO0 Hc0 xUu 9tBu 11z0 1tDu Rc0 1wo0 11A0 1cM0 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1nX0 U10 1tz0 U10 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 U10 1tz0 U10 1wn0 Rd0 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 17d0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 s10 1Vz0 1cN0 1cL0 1cN0 1cL0 6fd0 14n0|73e5","Asia/Hovd|LMT +06 +07 +08|-66.A -60 -70 -80|012323232323232323232323232323232323232323232323232|-2APG6.A 2Uko6.A cKn0 1db0 1dd0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 6hD0 11z0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 kEp0 1cJ0 1cP0 1cJ0|81e3","Asia/Irkutsk|IMT +07 +08 +09|-6V.5 -70 -80 -90|01232323232323232323232123232323232323232323232323232323232323232|-21zGV.5 pjXV.5 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|60e4","Europe/Istanbul|IMT EET EEST +03 +04|-1U.U -20 -30 -30 -40|0121212121212121212121212121212121212121212121234312121212121212121212121212121212121212121212121212121212121212123|-2ogNU.U dzzU.U 11b0 8tB0 1on0 1410 1db0 19B0 1in0 3Rd0 Un0 1oN0 11b0 zSN0 CL0 mp0 1Vz0 1gN0 8yn0 1yp0 ML0 1kp0 17b0 1ip0 17b0 1fB0 19X0 1ip0 19X0 1ip0 17b0 qdB0 38L0 1jd0 Tz0 l6O0 11A0 WN0 1qL0 TB0 1tX0 U10 1tz0 11B0 1in0 17d0 z90 cne0 pb0 2Cp0 1800 14o0 1dc0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1a00 1fA0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WO0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 Xc0 1qo0 WM0 1qM0 11A0 1o00 1200 1nA0 11A0 1tA0 U00 15w0|13e6","Asia/Jakarta|BMT +0720 +0730 +09 +08 WIB|-77.c -7k -7u -90 -80 -70|01232425|-1Q0Tk luM0 mPzO 8vWu 6kpu 4PXu xhcu|31e6","Asia/Jayapura|LMT +09 +0930 WIT|-9m.M -90 -9u -90|0123|-1uu9m.M sMMm.M L4nu|26e4","Asia/Jerusalem|JMT IST IDT IDDT|-2k.E -20 -30 -40|012121212121321212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-26Bek.E SyMk.E 5Rb0 10r0 1px0 10N0 1pz0 16p0 1jB0 16p0 1jx0 3LB0 Em0 or0 1cn0 1dB0 16n0 10O0 1ja0 1tC0 14o0 1cM0 1a00 11A0 1Na0 An0 1MP0 AJ0 1Kp0 LC0 1oo0 Wl0 EQN0 Db0 1fB0 Rb0 bXd0 gM0 8Q00 IM0 1wM0 11z0 1C10 IL0 1s10 10n0 1o10 WL0 1zd0 On0 1ld0 11z0 1o10 14n0 1o10 14n0 1nd0 12n0 1nd0 Xz0 1q10 12n0 1hB0 1dX0 1ep0 1aL0 1eN0 17X0 1nf0 11z0 1tB0 19W0 1e10 17b0 1ep0 1gL0 18N0 1fz0 1eN0 17b0 1gq0 1gn0 19d0 1dz0 1c10 17X0 1hB0 1gn0 19d0 1dz0 1c10 17X0 1kp0 1dz0 1c10 1aL0 1eN0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0|81e4","Asia/Kabul|+04 +0430|-40 -4u|01|-10Qs0|46e5","Asia/Kamchatka|LMT +11 +12 +13|-ay.A -b0 -c0 -d0|012323232323232323232321232323232323232323232323232323232323212|-1SLKy.A ivXy.A 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|18e4","Asia/Karachi|LMT +0530 +0630 +05 PKT PKST|-4s.c -5u -6u -50 -50 -60|012134545454|-2xoss.c 1qOKW.c 7zX0 eup0 LqMu 1fy00 1cL0 dK10 11b0 1610 1jX0|24e6","Asia/Urumqi|LMT +06|-5O.k -60|01|-1GgtO.k|32e5","Asia/Kathmandu|LMT +0530 +0545|-5F.g -5u -5J|012|-21JhF.g 2EGMb.g|12e5","Asia/Khandyga|LMT +08 +09 +10 +11|-92.d -80 -90 -a0 -b0|0123232323232323232323212323232323232323232323232343434343434343432|-21Q92.d pAp2.d 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 qK0 yN0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 17V0 7zD0|66e2","Asia/Krasnoyarsk|LMT +06 +07 +08|-6b.q -60 -70 -80|01232323232323232323232123232323232323232323232323232323232323232|-21Hib.q prAb.q 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|10e5","Asia/Kuala_Lumpur|SMT +07 +0720 +0730 +09 +08|-6T.p -70 -7k -7u -90 -80|0123435|-2Bg6T.p 17anT.p l5XE 17bO 8Fyu 1so1u|71e5","Asia/Kuching|LMT +0730 +08 +0820 +09|-7l.k -7u -80 -8k -90|0123232323232323242|-1KITl.k gDbP.k 6ynu AnE 1O0k AnE 1NAk AnE 1NAk AnE 1NAk AnE 1O0k AnE 1NAk AnE pAk 8Fz0|13e4","Asia/Macau|LMT CST +09 +10 CDT|-7y.a -80 -90 -a0 -90|012323214141414141414141414141414141414141414141414141414141414141414141|-2CFHy.a 1uqKy.a PX0 1kn0 15B0 11b0 4Qq0 1oM0 11c0 1ko0 1u00 11A0 1cM0 11c0 1o00 11A0 1o00 11A0 1oo0 1400 1o00 11A0 1o00 U00 1tA0 U00 1wo0 Rc0 1wru U10 1tz0 U10 1tz0 U10 1tz0 U10 1wn0 Rd0 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 17d0 1cK0 1cO0 1cK0 1cO0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 s10 1Vz0 1cN0 1cL0 1cN0 1cL0 6fd0 14n0|57e4","Asia/Magadan|LMT +10 +11 +12|-a3.c -a0 -b0 -c0|012323232323232323232321232323232323232323232323232323232323232312|-1Pca3.c eUo3.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3Cq0|95e3","Asia/Makassar|LMT MMT +08 +09 WITA|-7V.A -7V.A -80 -90 -80|01234|-21JjV.A vfc0 myLV.A 8ML0|15e5","Asia/Manila|PST PDT JST|-80 -90 -90|010201010|-1kJI0 AL0 cK10 65X0 mXB0 vX0 VK10 1db0|24e6","Asia/Nicosia|LMT EET EEST|-2d.s -20 -30|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1Vc2d.s 2a3cd.s 1cL0 1qp0 Xz0 19B0 19X0 1fB0 1db0 1cp0 1cL0 1fB0 19X0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1o30 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|32e4","Asia/Novokuznetsk|LMT +06 +07 +08|-5M.M -60 -70 -80|012323232323232323232321232323232323232323232323232323232323212|-1PctM.M eULM.M 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|55e4","Asia/Novosibirsk|LMT +06 +07 +08|-5v.E -60 -70 -80|0123232323232323232323212323212121212121212121212121212121212121212|-21Qnv.E pAFv.E 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 ml0 Os0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 4eN0|15e5","Asia/Omsk|LMT +05 +06 +07|-4R.u -50 -60 -70|01232323232323232323232123232323232323232323232323232323232323232|-224sR.u pMLR.u 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|12e5","Asia/Oral|LMT +03 +05 +06 +04|-3p.o -30 -50 -60 -40|01232323232323232424242424242424242424242424242|-1Pc3p.o eUop.o 23CK0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 1cM0 IM0 1EM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|27e4","Asia/Pontianak|LMT PMT +0730 +09 +08 WITA WIB|-7h.k -7h.k -7u -90 -80 -80 -70|012324256|-2ua7h.k XE00 munL.k 8Rau 6kpu 4PXu xhcu Wqnu|23e4","Asia/Pyongyang|LMT KST JST KST|-8n -8u -90 -90|012313|-2um8n 97XR 1lTzu 2Onc0 6BA0|29e5","Asia/Qostanay|LMT +04 +05 +06|-4e.s -40 -50 -60|012323232323232323232123232323232323232323232323|-1Pc4e.s eUoe.s 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|","Asia/Qyzylorda|LMT +04 +05 +06|-4l.Q -40 -50 -60|01232323232323232323232323232323232323232323232|-1Pc4l.Q eUol.Q 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 3ao0 1EM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 zQl0|73e4","Asia/Rangoon|RMT +0630 +09|-6o.L -6u -90|0121|-21Jio.L SmnS.L 7j9u|48e5","Asia/Sakhalin|LMT +09 +11 +12 +10|-9u.M -90 -b0 -c0 -a0|01232323232323232323232423232323232424242424242424242424242424242|-2AGVu.M 1BoMu.M 1qFa0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 2pB0 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|58e4","Asia/Samarkand|LMT +04 +05 +06|-4r.R -40 -50 -60|01232323232323232323232|-1Pc4r.R eUor.R 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0|36e4","Asia/Seoul|LMT KST JST KST KDT KDT|-8r.Q -8u -90 -90 -a0 -9u|012343434343151515151515134343|-2um8r.Q 97XV.Q 1m1zu 6CM0 Fz0 1kN0 14n0 1kN0 14L0 1zd0 On0 69B0 2I0u OL0 1FB0 Rb0 1qN0 TX0 1tB0 TX0 1tB0 TX0 1tB0 TX0 2ap0 12FBu 11A0 1o00 11A0|23e6","Asia/Srednekolymsk|LMT +10 +11 +12|-ae.Q -a0 -b0 -c0|01232323232323232323232123232323232323232323232323232323232323232|-1Pcae.Q eUoe.Q 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|35e2","Asia/Taipei|CST JST CDT|-80 -90 -90|01020202020202020202020202020202020202020|-1iw80 joM0 1yo0 Tz0 1ip0 1jX0 1cN0 11b0 1oN0 11b0 1oN0 11b0 1oN0 11b0 10N0 1BX0 10p0 1pz0 10p0 1pz0 10p0 1db0 1dd0 1db0 1cN0 1db0 1cN0 1db0 1cN0 1db0 1BB0 ML0 1Bd0 ML0 uq10 1db0 1cN0 1db0 97B0 AL0|74e5","Asia/Tashkent|LMT +05 +06 +07|-4B.b -50 -60 -70|012323232323232323232321|-1Pc4B.b eUnB.b 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0|23e5","Asia/Tbilisi|TBMT +03 +04 +05|-2X.b -30 -40 -50|0123232323232323232323212121232323232323232323212|-1Pc2X.b 1jUnX.b WCL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 1cK0 1cL0 1cN0 1cL0 1cN0 2pz0 1cL0 1fB0 3Nz0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 An0 Os0 WM0|11e5","Asia/Tehran|LMT TMT +0330 +04 +05 +0430|-3p.I -3p.I -3u -40 -50 -4u|01234325252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252|-2btDp.I 1d3c0 1huLT.I TXu 1pz0 sN0 vAu 1cL0 1dB0 1en0 pNB0 UL0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 64p0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0|14e6","Asia/Thimphu|LMT +0530 +06|-5W.A -5u -60|012|-Su5W.A 1BGMs.A|79e3","Asia/Tokyo|JST JDT|-90 -a0|010101010|-QJJ0 Rc0 1lc0 14o0 1zc0 Oo0 1zc0 Oo0|38e6","Asia/Tomsk|LMT +06 +07 +08|-5D.P -60 -70 -80|0123232323232323232323212323232323232323232323212121212121212121212|-21NhD.P pxzD.P 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 co0 1bB0 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3Qp0|10e5","Asia/Ulaanbaatar|LMT +07 +08 +09|-77.w -70 -80 -90|012323232323232323232323232323232323232323232323232|-2APH7.w 2Uko7.w cKn0 1db0 1dd0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 6hD0 11z0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 kEp0 1cJ0 1cP0 1cJ0|12e5","Asia/Ust-Nera|LMT +08 +09 +12 +11 +10|-9w.S -80 -90 -c0 -b0 -a0|012343434343434343434345434343434343434343434343434343434343434345|-21Q9w.S pApw.S 23CL0 1d90 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 17V0 7zD0|65e2","Asia/Vladivostok|LMT +09 +10 +11|-8L.v -90 -a0 -b0|01232323232323232323232123232323232323232323232323232323232323232|-1SJIL.v itXL.v 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|60e4","Asia/Yakutsk|LMT +08 +09 +10|-8C.W -80 -90 -a0|01232323232323232323232123232323232323232323232323232323232323232|-21Q8C.W pAoC.W 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|28e4","Asia/Yekaterinburg|LMT PMT +04 +05 +06|-42.x -3J.5 -40 -50 -60|012343434343434343434343234343434343434343434343434343434343434343|-2ag42.x 7mQh.s qBvJ.5 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|14e5","Asia/Yerevan|LMT +03 +04 +05|-2W -30 -40 -50|0123232323232323232323212121212323232323232323232323232323232|-1Pc2W 1jUnW WCL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 4RX0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|13e5","Atlantic/Azores|HMT -02 -01 +00 WET|1S.w 20 10 0 0|01212121212121212121212121212121212121212121232123212321232121212121212121212121212121212121212121232323232323232323232323232323234323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-2ldW0 aPX0 Sp0 LX0 1vc0 Tc0 1uM0 SM0 1vc0 Tc0 1vc0 SM0 1vc0 6600 1co0 3E00 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 3I00 17c0 1cM0 1cM0 3Fc0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 1tA0 1cM0 1dc0 1400 gL0 IM0 s10 U00 dX0 Rc0 pd0 Rc0 gL0 Oo0 pd0 Rc0 gL0 Oo0 pd0 14o0 1cM0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 3Co0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 qIl0 1cM0 1fA0 1cM0 1cM0 1cN0 1cL0 1cN0 1cM0 1cM0 1cM0 1cM0 1cN0 1cL0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cL0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|25e4","Atlantic/Bermuda|LMT AST ADT|4j.i 40 30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1BnRE.G 1LTbE.G 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|65e3","Atlantic/Canary|LMT -01 WET WEST|11.A 10 0 -10|01232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-1UtaW.o XPAW.o 1lAK0 1a10 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|54e4","Atlantic/Cape_Verde|LMT -02 -01|1y.4 20 10|01212|-2ldW0 1eEo0 7zX0 1djf0|50e4","Atlantic/Faroe|LMT WET WEST|r.4 0 -10|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2uSnw.U 2Wgow.U 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|49e3","Atlantic/Madeira|FMT -01 +00 +01 WET WEST|17.A 10 0 -10 0 -10|01212121212121212121212121212121212121212121232123212321232121212121212121212121212121212121212121454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-2ldX0 aPX0 Sp0 LX0 1vc0 Tc0 1uM0 SM0 1vc0 Tc0 1vc0 SM0 1vc0 6600 1co0 3E00 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 3I00 17c0 1cM0 1cM0 3Fc0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 1tA0 1cM0 1dc0 1400 gL0 IM0 s10 U00 dX0 Rc0 pd0 Rc0 gL0 Oo0 pd0 Rc0 gL0 Oo0 pd0 14o0 1cM0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 3Co0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 qIl0 1cM0 1fA0 1cM0 1cM0 1cN0 1cL0 1cN0 1cM0 1cM0 1cM0 1cM0 1cN0 1cL0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|27e4","Atlantic/Reykjavik|LMT -01 +00 GMT|1s 10 0 0|012121212121212121212121212121212121212121212121212121212121212121213|-2uWmw mfaw 1Bd0 ML0 1LB0 Cn0 1LB0 3fX0 C10 HrX0 1cO0 LB0 1EL0 LA0 1C00 Oo0 1wo0 Rc0 1wo0 Rc0 1wo0 Rc0 1zc0 Oo0 1zc0 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1lc0 14o0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 14o0|12e4","Atlantic/South_Georgia|-02|20|0||30","Atlantic/Stanley|SMT -04 -03 -02|3P.o 40 30 20|012121212121212323212121212121212121212121212121212121212121212121212|-2kJw8.A 12bA8.A 19X0 1fB0 19X0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 Cn0 1Cc10 WL0 1qL0 U10 1tz0 2mN0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1tz0 U10 1tz0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1tz0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qN0 U10 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 U10 1tz0 U10 1tz0 U10 1wn0 U10 1tz0 U10 1tz0 U10|21e2","Australia/Sydney|AEST AEDT|-a0 -b0|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293lX xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 14o0 1o00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1tA0 WM0 1tA0 U00 1tA0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 11A0 1o00 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|40e5","Australia/Adelaide|ACST ACDT|-9u -au|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293lt xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 Oo0 1zc0 WM0 1qM0 Rc0 1zc0 U00 1tA0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|11e5","Australia/Brisbane|AEST AEDT|-a0 -b0|01010101010101010|-293lX xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 H1A0 Oo0 1zc0 Oo0 1zc0 Oo0|20e5","Australia/Broken_Hill|ACST ACDT|-9u -au|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293lt xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 14o0 1o00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1tA0 WM0 1tA0 U00 1tA0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|18e3","Australia/Currie|AEST AEDT|-a0 -b0|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-29E80 19X0 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1qM0 WM0 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1wo0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 11A0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 11A0 1o00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|746","Australia/Darwin|ACST ACDT|-9u -au|010101010|-293lt xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0|12e4","Australia/Eucla|+0845 +0945|-8J -9J|0101010101010101010|-293kI xcX 10jd0 yL0 1cN0 1cL0 1gSp0 Oo0 l5A0 Oo0 iJA0 G00 zU00 IM0 1qM0 11A0 1o00 11A0|368","Australia/Hobart|AEST AEDT|-a0 -b0|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-29E80 19X0 10jd0 yL0 1cN0 1cL0 1fB0 19X0 VfB0 1cM0 1o00 Rc0 1wo0 Rc0 1wo0 U00 1wo0 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1qM0 WM0 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1wo0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 11A0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 11A0 1o00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|21e4","Australia/Lord_Howe|AEST +1030 +1130 +11|-a0 -au -bu -b0|0121212121313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313|raC0 1zdu Rb0 1zd0 On0 1zd0 On0 1zd0 On0 1zd0 TXu 1qMu WLu 1tAu WLu 1tAu TXu 1tAu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1zcu Onu 1zcu Onu 1zcu 11zu 1o0u 11zu 1o0u 11zu 1o0u 11zu 1qMu WLu 11Au 1nXu 1qMu 11zu 1o0u 11zu 1o0u 11zu 1qMu WLu 1qMu 11zu 1o0u WLu 1qMu 14nu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1fzu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu|347","Australia/Lindeman|AEST AEDT|-a0 -b0|010101010101010101010|-293lX xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 H1A0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0|10","Australia/Melbourne|AEST AEDT|-a0 -b0|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293lX xcX 10jd0 yL0 1cN0 1cL0 1fB0 19X0 17c10 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1qM0 11A0 1tA0 U00 1tA0 U00 1tA0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 11A0 1o00 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|39e5","Australia/Perth|AWST AWDT|-80 -90|0101010101010101010|-293jX xcX 10jd0 yL0 1cN0 1cL0 1gSp0 Oo0 l5A0 Oo0 iJA0 G00 zU00 IM0 1qM0 11A0 1o00 11A0|18e5","CET|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Pacific/Easter|EMT -07 -06 -05|7h.s 70 60 50|012121212121212121212121212123232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-1uSgG.w 1s4IG.w WL0 1zd0 On0 1ip0 11z0 1o10 11z0 1qN0 WL0 1ld0 14n0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 2pA0 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0|30e2","CST6CDT|CST CDT CWT CPT|60 50 50 50|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","EET|EET EEST|-20 -30|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|hDB0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Europe/Dublin|DMT IST GMT BST IST|p.l -y.D 0 -10 -10|01232323232324242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242|-2ax9y.D Rc0 1fzy.D 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 g600 14o0 1wo0 17c0 1io0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1a00 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1tA0 IM0 90o0 U00 1tA0 U00 1tA0 U00 1tA0 U00 1tA0 WM0 1qM0 WM0 1qM0 WM0 1tA0 U00 1tA0 U00 1tA0 11z0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","EST|EST|50|0||","EST5EDT|EST EDT EWT EPT|50 40 40 40|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261t0 1nX0 11B0 1nX0 SgN0 8x40 iv0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","Etc/GMT-0|GMT|0|0||","Etc/GMT-1|+01|-10|0||","Pacific/Port_Moresby|+10|-a0|0||25e4","Etc/GMT-11|+11|-b0|0||","Pacific/Tarawa|+12|-c0|0||29e3","Etc/GMT-13|+13|-d0|0||","Etc/GMT-14|+14|-e0|0||","Etc/GMT-2|+02|-20|0||","Etc/GMT-3|+03|-30|0||","Etc/GMT-4|+04|-40|0||","Etc/GMT-5|+05|-50|0||","Etc/GMT-6|+06|-60|0||","Indian/Christmas|+07|-70|0||21e2","Etc/GMT-8|+08|-80|0||","Pacific/Palau|+09|-90|0||21e3","Etc/GMT+1|-01|10|0||","Etc/GMT+10|-10|a0|0||","Etc/GMT+11|-11|b0|0||","Etc/GMT+12|-12|c0|0||","Etc/GMT+3|-03|30|0||","Etc/GMT+4|-04|40|0||","Etc/GMT+5|-05|50|0||","Etc/GMT+6|-06|60|0||","Etc/GMT+7|-07|70|0||","Etc/GMT+8|-08|80|0||","Etc/GMT+9|-09|90|0||","Etc/UTC|UTC|0|0||","Europe/Amsterdam|AMT NST +0120 +0020 CEST CET|-j.w -1j.w -1k -k -20 -10|010101010101010101010101010101010101010101012323234545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545|-2aFcj.w 11b0 1iP0 11A0 1io0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1co0 1io0 1yo0 Pc0 1a00 1fA0 1Bc0 Mo0 1tc0 Uo0 1tA0 U00 1uo0 W00 1s00 VA0 1so0 Vc0 1sM0 UM0 1wo0 Rc0 1u00 Wo0 1rA0 W00 1s00 VA0 1sM0 UM0 1w00 fV0 BCX.w 1tA0 U00 1u00 Wo0 1sm0 601k WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|16e5","Europe/Andorra|WET CET CEST|0 -10 -20|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-UBA0 1xIN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|79e3","Europe/Astrakhan|LMT +03 +04 +05|-3c.c -30 -40 -50|012323232323232323212121212121212121212121212121212121212121212|-1Pcrc.c eUMc.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|10e5","Europe/Athens|AMT EET EEST CEST CET|-1y.Q -20 -30 -20 -10|012123434121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2a61x.Q CNbx.Q mn0 kU10 9b0 3Es0 Xa0 1fb0 1dd0 k3X0 Nz0 SCp0 1vc0 SO0 1cM0 1a00 1ao0 1fc0 1a10 1fG0 1cg0 1dX0 1bX0 1cQ0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|35e5","Europe/London|GMT BST BDST|0 -10 -20|0101010101010101010101010101010101010101010101010121212121210101210101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2axa0 Rc0 1fA0 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 2Rz0 Dc0 1zc0 Oo0 1zc0 Rc0 1wo0 17c0 1iM0 FA0 xB0 1fA0 1a00 14o0 bb0 LA0 xB0 Rc0 1wo0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1a00 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1tA0 IM0 90o0 U00 1tA0 U00 1tA0 U00 1tA0 U00 1tA0 WM0 1qM0 WM0 1qM0 WM0 1tA0 U00 1tA0 U00 1tA0 11z0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|10e6","Europe/Belgrade|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-19RC0 3IP0 WM0 1fA0 1cM0 1cM0 1rc0 Qo0 1vmo0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","Europe/Berlin|CET CEST CEMT|-10 -20 -30|01010101010101210101210101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 kL0 Nc0 m10 WM0 1ao0 1cp0 dX0 jz0 Dd0 1io0 17c0 1fA0 1a00 1ehA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|41e5","Europe/Prague|CET CEST GMT|-10 -20 0|01010101010101010201010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 1cM0 1qM0 11c0 mp0 xA0 mn0 17c0 1io0 17c0 1fc0 1ao0 1bNc0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|13e5","Europe/Brussels|WET CET CEST WEST|0 -10 -20 -10|0121212103030303030303030303030303030303030303030303212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2ehc0 3zX0 11c0 1iO0 11A0 1o00 11A0 my0 Ic0 1qM0 Rc0 1EM0 UM0 1u00 10o0 1io0 1io0 17c0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a30 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 y00 5Wn0 WM0 1fA0 1cM0 16M0 1iM0 16M0 1C00 Uo0 1eeo0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|21e5","Europe/Bucharest|BMT EET EEST|-1I.o -20 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1xApI.o 20LI.o RA0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1Axc0 On0 1fA0 1a10 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cK0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cL0 1cN0 1cL0 1fB0 1nX0 11E0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|19e5","Europe/Budapest|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1ip0 17b0 1op0 1tb0 Q2m0 3Ne0 WM0 1fA0 1cM0 1cM0 1oJ0 1dc0 1030 1fA0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1iM0 1fA0 8Ha0 Rb0 1wN0 Rb0 1BB0 Lz0 1C20 LB0 SNX0 1a10 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e5","Europe/Zurich|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-19Lc0 11A0 1o00 11A0 1xG10 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|38e4","Europe/Chisinau|CMT BMT EET EEST CEST CET MSK MSD|-1T -1I.o -20 -30 -20 -10 -30 -40|012323232323232323234545467676767676767676767323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-26jdT wGMa.A 20LI.o RA0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 27A0 2en0 39g0 WM0 1fA0 1cM0 V90 1t7z0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 gL0 WO0 1cM0 1cM0 1cK0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1nX0 11D0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|67e4","Europe/Copenhagen|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2azC0 Tz0 VuO0 60q0 WM0 1fA0 1cM0 1cM0 1cM0 S00 1HA0 Nc0 1C00 Dc0 1Nc0 Ao0 1h5A0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","Europe/Gibraltar|GMT BST BDST CET CEST|0 -10 -20 -10 -20|010101010101010101010101010101010101010101010101012121212121010121010101010101010101034343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343|-2axa0 Rc0 1fA0 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 2Rz0 Dc0 1zc0 Oo0 1zc0 Rc0 1wo0 17c0 1iM0 FA0 xB0 1fA0 1a00 14o0 bb0 LA0 xB0 Rc0 1wo0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 10Jz0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|30e3","Europe/Helsinki|HMT EET EEST|-1D.N -20 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1WuND.N OULD.N 1dA0 1xGq0 1cM0 1cM0 1cM0 1cN0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","Europe/Kaliningrad|CET CEST EET EEST MSK MSD +03|-10 -20 -20 -30 -30 -40 -30|01010101010101232454545454545454543232323232323232323232323232323232323232323262|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 390 7A0 1en0 12N0 1pbb0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|44e4","Europe/Kiev|KMT EET MSK CEST CET MSD EEST|-22.4 -20 -30 -20 -10 -40 -30|0123434252525252525252525256161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161|-1Pc22.4 eUo2.4 rnz0 2Hg0 WM0 1fA0 da0 1v4m0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 Db0 3220 1cK0 1cL0 1cN0 1cL0 1cN0 1cL0 1cQ0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|34e5","Europe/Kirov|LMT +03 +04 +05|-3i.M -30 -40 -50|01232323232323232321212121212121212121212121212121212121212121|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|48e4","Europe/Lisbon|LMT WET WEST WEMT CET CEST|A.J 0 -10 -20 -10 -20|012121212121212121212121212121212121212121212321232123212321212121212121212121212121212121212121214121212121212121212121212121212124545454212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2le00 aPX0 Sp0 LX0 1vc0 Tc0 1uM0 SM0 1vc0 Tc0 1vc0 SM0 1vc0 6600 1co0 3E00 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 3I00 17c0 1cM0 1cM0 3Fc0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 1tA0 1cM0 1dc0 1400 gL0 IM0 s10 U00 dX0 Rc0 pd0 Rc0 gL0 Oo0 pd0 Rc0 gL0 Oo0 pd0 14o0 1cM0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 3Co0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 pvy0 1cM0 1cM0 1fA0 1cM0 1cM0 1cN0 1cL0 1cN0 1cM0 1cM0 1cM0 1cM0 1cN0 1cL0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|27e5","Europe/Luxembourg|LMT CET CEST WET WEST WEST WET|-o.A -10 -20 0 -10 -20 -10|0121212134343434343434343434343434343434343434343434565651212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2DG0o.A t6mo.A TB0 1nX0 Up0 1o20 11A0 rW0 CM0 1qP0 R90 1EO0 UK0 1u20 10m0 1ip0 1in0 17e0 19W0 1fB0 1db0 1cp0 1in0 17d0 1fz0 1a10 1in0 1a10 1in0 17f0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 vA0 60L0 WM0 1fA0 1cM0 17c0 1io0 16M0 1C00 Uo0 1eeo0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|54e4","Europe/Madrid|WET WEST WEMT CET CEST|0 -10 -20 -10 -20|010101010101010101210343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343|-25Td0 19B0 1cL0 1dd0 b1z0 18p0 3HX0 17d0 1fz0 1a10 1io0 1a00 1in0 17d0 iIn0 Hd0 1cL0 bb0 1200 2s20 14n0 5aL0 Mp0 1vz0 17d0 1in0 17d0 1in0 17d0 1in0 17d0 6hX0 11B0 XHX0 1a10 1fz0 1a10 19X0 1cN0 1fz0 1a10 1fC0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|62e5","Europe/Malta|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2arB0 Lz0 1cN0 1db0 1410 1on0 Wp0 1qL0 17d0 1cL0 M3B0 5M20 WM0 1fA0 1co0 17c0 1iM0 16m0 1de0 1lc0 14m0 1lc0 WO0 1qM0 GTW0 On0 1C10 LA0 1C00 LA0 1EM0 LA0 1C00 LA0 1zc0 Oo0 1C00 Oo0 1co0 1cM0 1lA0 Xc0 1qq0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1iN0 19z0 1fB0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|42e4","Europe/Minsk|MMT EET MSK CEST CET MSD EEST +03|-1O -20 -30 -20 -10 -40 -30 -30|01234343252525252525252525261616161616161616161616161616161616161617|-1Pc1O eUnO qNX0 3gQ0 WM0 1fA0 1cM0 Al0 1tsn0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 3Fc0 1cN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0|19e5","Europe/Monaco|PMT WET WEST WEMT CET CEST|-9.l 0 -10 -20 -10 -20|01212121212121212121212121212121212121212121212121232323232345454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-2nco9.l cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 1u00 10o0 1io0 1wo0 Rc0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Df0 2RV0 11z0 11B0 1ze0 WM0 1fA0 1cM0 1fa0 1aq0 16M0 1ekn0 1cL0 1fC0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|38e3","Europe/Moscow|MMT MMT MST MDST MSD MSK +05 EET EEST MSK|-2u.h -2v.j -3v.j -4v.j -40 -30 -50 -20 -30 -40|012132345464575454545454545454545458754545454545454545454545454545454545454595|-2ag2u.h 2pyW.W 1bA0 11X0 GN0 1Hb0 c4v.j ik0 3DA0 dz0 15A0 c10 2q10 iM10 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cN0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|16e6","Europe/Paris|PMT WET WEST CEST CET WEMT|-9.l 0 -10 -20 -10 -20|0121212121212121212121212121212121212121212121212123434352543434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434|-2nco8.l cNb8.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 1u00 10o0 1io0 1wo0 Rc0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Df0 Ik0 5M30 WM0 1fA0 1cM0 Vx0 hB0 1aq0 16M0 1ekn0 1cL0 1fC0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|11e6","Europe/Riga|RMT LST EET MSK CEST CET MSD EEST|-1A.y -2A.y -20 -30 -20 -10 -40 -30|010102345454536363636363636363727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272|-25TzA.y 11A0 1iM0 ko0 gWm0 yDXA.y 2bX0 3fE0 WM0 1fA0 1cM0 1cM0 4m0 1sLy0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cN0 1o00 11A0 1o00 11A0 1qM0 3oo0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|64e4","Europe/Rome|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2arB0 Lz0 1cN0 1db0 1410 1on0 Wp0 1qL0 17d0 1cL0 M3B0 5M20 WM0 1fA0 1cM0 16M0 1iM0 16m0 1de0 1lc0 14m0 1lc0 WO0 1qM0 GTW0 On0 1C10 LA0 1C00 LA0 1EM0 LA0 1C00 LA0 1zc0 Oo0 1C00 Oo0 1C00 LA0 1zc0 Oo0 1C00 LA0 1C00 LA0 1zc0 Oo0 1C00 Oo0 1zc0 Oo0 1fC0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|39e5","Europe/Samara|LMT +03 +04 +05|-3k.k -30 -40 -50|0123232323232323232121232323232323232323232323232323232323212|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 2y10 14m0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|12e5","Europe/Saratov|LMT +03 +04 +05|-34.i -30 -40 -50|012323232323232321212121212121212121212121212121212121212121212|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1cM0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 5810|","Europe/Simferopol|SMT EET MSK CEST CET MSD EEST MSK|-2g -20 -30 -20 -10 -40 -30 -40|012343432525252525252525252161616525252616161616161616161616161616161616172|-1Pc2g eUog rEn0 2qs0 WM0 1fA0 1cM0 3V0 1u0L0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1Q00 4eL0 1cL0 1cN0 1cL0 1cN0 dX0 WL0 1cN0 1cL0 1fB0 1o30 11B0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11z0 1nW0|33e4","Europe/Sofia|EET CET CEST EEST|-20 -10 -20 -30|01212103030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030|-168L0 WM0 1fA0 1cM0 1cM0 1cN0 1mKH0 1dd0 1fb0 1ap0 1fb0 1a20 1fy0 1a30 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cK0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1nX0 11E0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","Europe/Stockholm|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2azC0 TB0 2yDe0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|15e5","Europe/Tallinn|TMT CET CEST EET MSK MSD EEST|-1D -10 -20 -20 -30 -40 -30|012103421212454545454545454546363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363|-26oND teD 11A0 1Ta0 4rXl KSLD 2FX0 2Jg0 WM0 1fA0 1cM0 18J0 1sTX0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o10 11A0 1qM0 5QM0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|41e4","Europe/Tirane|LMT CET CEST|-1j.k -10 -20|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glBj.k 14pcj.k 5LC0 WM0 4M0 1fCK0 10n0 1op0 11z0 1pd0 11z0 1qN0 WL0 1qp0 Xb0 1qp0 Xb0 1qp0 11z0 1lB0 11z0 1qN0 11z0 1iN0 16n0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|42e4","Europe/Ulyanovsk|LMT +03 +04 +05 +02|-3d.A -30 -40 -50 -20|01232323232323232321214121212121212121212121212121212121212121212|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|13e5","Europe/Uzhgorod|CET CEST MSK MSD EET EEST|-10 -20 -30 -40 -20 -30|010101023232323232323232320454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-1cqL0 6i00 WM0 1fA0 1cM0 1ml0 1Cp0 1r3W0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1Q00 1Nf0 2pw0 1cL0 1cN0 1cL0 1cN0 1cL0 1cQ0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|11e4","Europe/Vienna|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 3KM0 14o0 LA00 6i00 WM0 1fA0 1cM0 1cM0 1cM0 400 2qM0 1ao0 1co0 1cM0 1io0 17c0 1gHa0 19X0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|18e5","Europe/Vilnius|WMT KMT CET EET MSK CEST MSD EEST|-1o -1z.A -10 -20 -30 -20 -40 -30|012324525254646464646464646473737373737373737352537373737373737373737373737373737373737373737373737373737373737373737373|-293do 6ILM.o 1Ooz.A zz0 Mfd0 29W0 3is0 WM0 1fA0 1cM0 LV0 1tgL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11B0 1o00 11A0 1qM0 8io0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|54e4","Europe/Volgograd|LMT +03 +04 +05|-2V.E -30 -40 -50|012323232323232321212121212121212121212121212121212121212121212|-21IqV.E psLV.E 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1cM0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 9Jd0|10e5","Europe/Warsaw|WMT CET CEST EET EEST|-1o -10 -20 -20 -30|012121234312121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2ctdo 1LXo 11d0 1iO0 11A0 1o00 11A0 1on0 11A0 6zy0 HWP0 5IM0 WM0 1fA0 1cM0 1dz0 1mL0 1en0 15B0 1aq0 1nA0 11A0 1io0 17c0 1fA0 1a00 iDX0 LA0 1cM0 1cM0 1C00 Oo0 1cM0 1cM0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1C00 LA0 uso0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e5","Europe/Zaporozhye|+0220 EET MSK CEST CET MSD EEST|-2k -20 -30 -20 -10 -40 -30|01234342525252525252525252526161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161|-1Pc2k eUok rdb0 2RE0 WM0 1fA0 8m0 1v9a0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cK0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cQ0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|77e4","HST|HST|a0|0||","Indian/Chagos|LMT +05 +06|-4N.E -50 -60|012|-2xosN.E 3AGLN.E|30e2","Indian/Cocos|+0630|-6u|0||596","Indian/Kerguelen|-00 +05|0 -50|01|-MG00|130","Indian/Mahe|LMT +04|-3F.M -40|01|-2yO3F.M|79e3","Indian/Maldives|MMT +05|-4S -50|01|-olgS|35e4","Indian/Mauritius|LMT +04 +05|-3O -40 -50|012121|-2xorO 34unO 14L0 12kr0 11z0|15e4","Indian/Reunion|LMT +04|-3F.Q -40|01|-2mDDF.Q|84e4","Pacific/Kwajalein|+11 +10 +09 -12 +12|-b0 -a0 -90 c0 -c0|012034|-1kln0 akp0 6Up0 12ry0 Wan0|14e3","MET|MET MEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","MST|MST|70|0||","MST7MDT|MST MDT MWT MPT|70 60 60 60|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","Pacific/Chatham|+1215 +1245 +1345|-cf -cJ -dJ|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212|-WqAf 1adef IM0 1C00 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1qM0 14o0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1io0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00|600","Pacific/Apia|LMT -1130 -11 -10 +14 +13|bq.U bu b0 a0 -e0 -d0|01232345454545454545454545454545454545454545454545454545454|-2nDMx.4 1yW03.4 2rRbu 1ff0 1a00 CI0 AQ0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00|37e3","Pacific/Bougainville|+10 +09 +11|-a0 -90 -b0|0102|-16Wy0 7CN0 2MQp0|18e4","Pacific/Chuuk|+10 +09|-a0 -90|01010|-2ewy0 axB0 RVX0 axd0|49e3","Pacific/Efate|LMT +11 +12|-bd.g -b0 -c0|0121212121212121212121|-2l9nd.g 2Szcd.g 1cL0 1oN0 10L0 1fB0 19X0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 Lz0 1Nd0 An0|66e3","Pacific/Enderbury|-12 -11 +13|c0 b0 -d0|012|nIc0 B7X0|1","Pacific/Fakaofo|-11 +13|b0 -d0|01|1Gfn0|483","Pacific/Fiji|LMT +12 +13|-bT.I -c0 -d0|0121212121212121212121212121212121212121212121212121212121212121|-2bUzT.I 3m8NT.I LA0 1EM0 IM0 nJc0 LA0 1o00 Rc0 1wo0 Ao0 1Nc0 Ao0 1Q00 xz0 1SN0 uM0 1SM0 uM0 1VA0 s00 1VA0 s00 1VA0 s00 20o0 pc0 20o0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 s00 1VA0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 s00 1VA0 s00|88e4","Pacific/Galapagos|LMT -05 -06|5W.o 50 60|01212|-1yVS1.A 2dTz1.A gNd0 rz0|25e3","Pacific/Gambier|LMT -09|8X.M 90|01|-2jof0.c|125","Pacific/Guadalcanal|LMT +11|-aD.M -b0|01|-2joyD.M|11e4","Pacific/Guam|GST +09 GDT ChST|-a0 -90 -b0 -a0|01020202020202020203|-18jK0 6pB0 AhB0 3QL0 g2p0 3p91 WOX rX0 1zd0 Rb0 1wp0 Rb0 5xd0 rX0 5sN0 zb1 1C0X On0 ULb0|17e4","Pacific/Honolulu|HST HDT HWT HPT HST|au 9u 9u 9u a0|0102304|-1thLu 8x0 lef0 8wWu iAu 46p0|37e4","Pacific/Kiritimati|-1040 -10 +14|aE a0 -e0|012|nIaE B7Xk|51e2","Pacific/Kosrae|+11 +09 +10 +12|-b0 -90 -a0 -c0|01021030|-2ewz0 axC0 HBy0 akp0 axd0 WOK0 1bdz0|66e2","Pacific/Majuro|+11 +09 +10 +12|-b0 -90 -a0 -c0|0102103|-2ewz0 axC0 HBy0 akp0 6RB0 12um0|28e3","Pacific/Marquesas|LMT -0930|9i 9u|01|-2joeG|86e2","Pacific/Pago_Pago|LMT SST|bm.M b0|01|-2nDMB.c|37e2","Pacific/Nauru|LMT +1130 +09 +12|-b7.E -bu -90 -c0|01213|-1Xdn7.E QCnB.E 7mqu 1lnbu|10e3","Pacific/Niue|-1120 -1130 -11|bk bu b0|012|-KfME 17y0a|12e2","Pacific/Norfolk|+1112 +1130 +1230 +11 +12|-bc -bu -cu -b0 -c0|012134343434343434343434343434343434343434|-Kgbc W01G Oo0 1COo0 9Jcu 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|25e4","Pacific/Noumea|LMT +11 +12|-b5.M -b0 -c0|01212121|-2l9n5.M 2EqM5.M xX0 1PB0 yn0 HeP0 Ao0|98e3","Pacific/Pitcairn|-0830 -08|8u 80|01|18Vku|56","Pacific/Pohnpei|+11 +09 +10|-b0 -90 -a0|010210|-2ewz0 axC0 HBy0 akp0 axd0|34e3","Pacific/Rarotonga|-1030 -0930 -10|au 9u a0|012121212121212121212121212|lyWu IL0 1zcu Onu 1zcu Onu 1zcu Rbu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1zcu Onu 1zcu Onu 1zcu Onu|13e3","Pacific/Tahiti|LMT -10|9W.g a0|01|-2joe1.I|18e4","Pacific/Tongatapu|+1220 +13 +14|-ck -d0 -e0|0121212121|-1aB0k 2n5dk 15A0 1wo0 xz0 1Q10 xz0 zWN0 s00|75e3","PST8PDT|PST PDT PWT PPT|80 70 70 70|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261q0 1nX0 11B0 1nX0 SgN0 8x10 iy0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|","WET|WET WEST|0 -10|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|hDB0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|"],links:["Africa/Abidjan|Africa/Bamako","Africa/Abidjan|Africa/Banjul","Africa/Abidjan|Africa/Conakry","Africa/Abidjan|Africa/Dakar","Africa/Abidjan|Africa/Freetown","Africa/Abidjan|Africa/Lome","Africa/Abidjan|Africa/Nouakchott","Africa/Abidjan|Africa/Ouagadougou","Africa/Abidjan|Africa/Timbuktu","Africa/Abidjan|Atlantic/St_Helena","Africa/Cairo|Egypt","Africa/Johannesburg|Africa/Maseru","Africa/Johannesburg|Africa/Mbabane","Africa/Lagos|Africa/Bangui","Africa/Lagos|Africa/Brazzaville","Africa/Lagos|Africa/Douala","Africa/Lagos|Africa/Kinshasa","Africa/Lagos|Africa/Libreville","Africa/Lagos|Africa/Luanda","Africa/Lagos|Africa/Malabo","Africa/Lagos|Africa/Niamey","Africa/Lagos|Africa/Porto-Novo","Africa/Maputo|Africa/Blantyre","Africa/Maputo|Africa/Bujumbura","Africa/Maputo|Africa/Gaborone","Africa/Maputo|Africa/Harare","Africa/Maputo|Africa/Kigali","Africa/Maputo|Africa/Lubumbashi","Africa/Maputo|Africa/Lusaka","Africa/Nairobi|Africa/Addis_Ababa","Africa/Nairobi|Africa/Asmara","Africa/Nairobi|Africa/Asmera","Africa/Nairobi|Africa/Dar_es_Salaam","Africa/Nairobi|Africa/Djibouti","Africa/Nairobi|Africa/Kampala","Africa/Nairobi|Africa/Mogadishu","Africa/Nairobi|Indian/Antananarivo","Africa/Nairobi|Indian/Comoro","Africa/Nairobi|Indian/Mayotte","Africa/Tripoli|Libya","America/Adak|America/Atka","America/Adak|US/Aleutian","America/Anchorage|US/Alaska","America/Argentina/Buenos_Aires|America/Buenos_Aires","America/Argentina/Catamarca|America/Argentina/ComodRivadavia","America/Argentina/Catamarca|America/Catamarca","America/Argentina/Cordoba|America/Cordoba","America/Argentina/Cordoba|America/Rosario","America/Argentina/Jujuy|America/Jujuy","America/Argentina/Mendoza|America/Mendoza","America/Atikokan|America/Coral_Harbour","America/Chicago|US/Central","America/Curacao|America/Aruba","America/Curacao|America/Kralendijk","America/Curacao|America/Lower_Princes","America/Denver|America/Shiprock","America/Denver|Navajo","America/Denver|US/Mountain","America/Detroit|US/Michigan","America/Edmonton|Canada/Mountain","America/Fort_Wayne|America/Indiana/Indianapolis","America/Fort_Wayne|America/Indianapolis","America/Fort_Wayne|US/East-Indiana","America/Godthab|America/Nuuk","America/Halifax|Canada/Atlantic","America/Havana|Cuba","America/Indiana/Knox|America/Knox_IN","America/Indiana/Knox|US/Indiana-Starke","America/Jamaica|Jamaica","America/Kentucky/Louisville|America/Louisville","America/Los_Angeles|US/Pacific","America/Los_Angeles|US/Pacific-New","America/Manaus|Brazil/West","America/Mazatlan|Mexico/BajaSur","America/Mexico_City|Mexico/General","America/New_York|US/Eastern","America/Noronha|Brazil/DeNoronha","America/Panama|America/Cayman","America/Phoenix|US/Arizona","America/Port_of_Spain|America/Anguilla","America/Port_of_Spain|America/Antigua","America/Port_of_Spain|America/Dominica","America/Port_of_Spain|America/Grenada","America/Port_of_Spain|America/Guadeloupe","America/Port_of_Spain|America/Marigot","America/Port_of_Spain|America/Montserrat","America/Port_of_Spain|America/St_Barthelemy","America/Port_of_Spain|America/St_Kitts","America/Port_of_Spain|America/St_Lucia","America/Port_of_Spain|America/St_Thomas","America/Port_of_Spain|America/St_Vincent","America/Port_of_Spain|America/Tortola","America/Port_of_Spain|America/Virgin","America/Regina|Canada/Saskatchewan","America/Rio_Branco|America/Porto_Acre","America/Rio_Branco|Brazil/Acre","America/Santiago|Chile/Continental","America/Sao_Paulo|Brazil/East","America/St_Johns|Canada/Newfoundland","America/Tijuana|America/Ensenada","America/Tijuana|America/Santa_Isabel","America/Tijuana|Mexico/BajaNorte","America/Toronto|America/Montreal","America/Toronto|Canada/Eastern","America/Vancouver|Canada/Pacific","America/Whitehorse|Canada/Yukon","America/Winnipeg|Canada/Central","Asia/Ashgabat|Asia/Ashkhabad","Asia/Bangkok|Asia/Phnom_Penh","Asia/Bangkok|Asia/Vientiane","Asia/Dhaka|Asia/Dacca","Asia/Dubai|Asia/Muscat","Asia/Ho_Chi_Minh|Asia/Saigon","Asia/Hong_Kong|Hongkong","Asia/Jerusalem|Asia/Tel_Aviv","Asia/Jerusalem|Israel","Asia/Kathmandu|Asia/Katmandu","Asia/Kolkata|Asia/Calcutta","Asia/Kuala_Lumpur|Asia/Singapore","Asia/Kuala_Lumpur|Singapore","Asia/Macau|Asia/Macao","Asia/Makassar|Asia/Ujung_Pandang","Asia/Nicosia|Europe/Nicosia","Asia/Qatar|Asia/Bahrain","Asia/Rangoon|Asia/Yangon","Asia/Riyadh|Asia/Aden","Asia/Riyadh|Asia/Kuwait","Asia/Seoul|ROK","Asia/Shanghai|Asia/Chongqing","Asia/Shanghai|Asia/Chungking","Asia/Shanghai|Asia/Harbin","Asia/Shanghai|PRC","Asia/Taipei|ROC","Asia/Tehran|Iran","Asia/Thimphu|Asia/Thimbu","Asia/Tokyo|Japan","Asia/Ulaanbaatar|Asia/Ulan_Bator","Asia/Urumqi|Asia/Kashgar","Atlantic/Faroe|Atlantic/Faeroe","Atlantic/Reykjavik|Iceland","Atlantic/South_Georgia|Etc/GMT+2","Australia/Adelaide|Australia/South","Australia/Brisbane|Australia/Queensland","Australia/Broken_Hill|Australia/Yancowinna","Australia/Darwin|Australia/North","Australia/Hobart|Australia/Tasmania","Australia/Lord_Howe|Australia/LHI","Australia/Melbourne|Australia/Victoria","Australia/Perth|Australia/West","Australia/Sydney|Australia/ACT","Australia/Sydney|Australia/Canberra","Australia/Sydney|Australia/NSW","Etc/GMT-0|Etc/GMT","Etc/GMT-0|Etc/GMT+0","Etc/GMT-0|Etc/GMT0","Etc/GMT-0|Etc/Greenwich","Etc/GMT-0|GMT","Etc/GMT-0|GMT+0","Etc/GMT-0|GMT-0","Etc/GMT-0|GMT0","Etc/GMT-0|Greenwich","Etc/UTC|Etc/UCT","Etc/UTC|Etc/Universal","Etc/UTC|Etc/Zulu","Etc/UTC|UCT","Etc/UTC|UTC","Etc/UTC|Universal","Etc/UTC|Zulu","Europe/Belgrade|Europe/Ljubljana","Europe/Belgrade|Europe/Podgorica","Europe/Belgrade|Europe/Sarajevo","Europe/Belgrade|Europe/Skopje","Europe/Belgrade|Europe/Zagreb","Europe/Chisinau|Europe/Tiraspol","Europe/Dublin|Eire","Europe/Helsinki|Europe/Mariehamn","Europe/Istanbul|Asia/Istanbul","Europe/Istanbul|Turkey","Europe/Lisbon|Portugal","Europe/London|Europe/Belfast","Europe/London|Europe/Guernsey","Europe/London|Europe/Isle_of_Man","Europe/London|Europe/Jersey","Europe/London|GB","Europe/London|GB-Eire","Europe/Moscow|W-SU","Europe/Oslo|Arctic/Longyearbyen","Europe/Oslo|Atlantic/Jan_Mayen","Europe/Prague|Europe/Bratislava","Europe/Rome|Europe/San_Marino","Europe/Rome|Europe/Vatican","Europe/Warsaw|Poland","Europe/Zurich|Europe/Busingen","Europe/Zurich|Europe/Vaduz","Indian/Christmas|Etc/GMT-7","Pacific/Auckland|Antarctica/McMurdo","Pacific/Auckland|Antarctica/South_Pole","Pacific/Auckland|NZ","Pacific/Chatham|NZ-CHAT","Pacific/Chuuk|Pacific/Truk","Pacific/Chuuk|Pacific/Yap","Pacific/Easter|Chile/EasterIsland","Pacific/Guam|Pacific/Saipan","Pacific/Honolulu|Pacific/Johnston","Pacific/Honolulu|US/Hawaii","Pacific/Kwajalein|Kwajalein","Pacific/Pago_Pago|Pacific/Midway","Pacific/Pago_Pago|Pacific/Samoa","Pacific/Pago_Pago|US/Samoa","Pacific/Palau|Etc/GMT-9","Pacific/Pohnpei|Pacific/Ponape","Pacific/Port_Moresby|Etc/GMT-10","Pacific/Tarawa|Etc/GMT-12","Pacific/Tarawa|Pacific/Funafuti","Pacific/Tarawa|Pacific/Wake","Pacific/Tarawa|Pacific/Wallis"],countries:["AD|Europe/Andorra","AE|Asia/Dubai","AF|Asia/Kabul","AG|America/Port_of_Spain America/Antigua","AI|America/Port_of_Spain America/Anguilla","AL|Europe/Tirane","AM|Asia/Yerevan","AO|Africa/Lagos Africa/Luanda","AQ|Antarctica/Casey Antarctica/Davis Antarctica/DumontDUrville Antarctica/Mawson Antarctica/Palmer Antarctica/Rothera Antarctica/Syowa Antarctica/Troll Antarctica/Vostok Pacific/Auckland Antarctica/McMurdo","AR|America/Argentina/Buenos_Aires America/Argentina/Cordoba America/Argentina/Salta America/Argentina/Jujuy America/Argentina/Tucuman America/Argentina/Catamarca America/Argentina/La_Rioja America/Argentina/San_Juan America/Argentina/Mendoza America/Argentina/San_Luis America/Argentina/Rio_Gallegos America/Argentina/Ushuaia","AS|Pacific/Pago_Pago","AT|Europe/Vienna","AU|Australia/Lord_Howe Antarctica/Macquarie Australia/Hobart Australia/Currie Australia/Melbourne Australia/Sydney Australia/Broken_Hill Australia/Brisbane Australia/Lindeman Australia/Adelaide Australia/Darwin Australia/Perth Australia/Eucla","AW|America/Curacao America/Aruba","AX|Europe/Helsinki Europe/Mariehamn","AZ|Asia/Baku","BA|Europe/Belgrade Europe/Sarajevo","BB|America/Barbados","BD|Asia/Dhaka","BE|Europe/Brussels","BF|Africa/Abidjan Africa/Ouagadougou","BG|Europe/Sofia","BH|Asia/Qatar Asia/Bahrain","BI|Africa/Maputo Africa/Bujumbura","BJ|Africa/Lagos Africa/Porto-Novo","BL|America/Port_of_Spain America/St_Barthelemy","BM|Atlantic/Bermuda","BN|Asia/Brunei","BO|America/La_Paz","BQ|America/Curacao America/Kralendijk","BR|America/Noronha America/Belem America/Fortaleza America/Recife America/Araguaina America/Maceio America/Bahia America/Sao_Paulo America/Campo_Grande America/Cuiaba America/Santarem America/Porto_Velho America/Boa_Vista America/Manaus America/Eirunepe America/Rio_Branco","BS|America/Nassau","BT|Asia/Thimphu","BW|Africa/Maputo Africa/Gaborone","BY|Europe/Minsk","BZ|America/Belize","CA|America/St_Johns America/Halifax America/Glace_Bay America/Moncton America/Goose_Bay America/Blanc-Sablon America/Toronto America/Nipigon America/Thunder_Bay America/Iqaluit America/Pangnirtung America/Atikokan America/Winnipeg America/Rainy_River America/Resolute America/Rankin_Inlet America/Regina America/Swift_Current America/Edmonton America/Cambridge_Bay America/Yellowknife America/Inuvik America/Creston America/Dawson_Creek America/Fort_Nelson America/Vancouver America/Whitehorse America/Dawson","CC|Indian/Cocos","CD|Africa/Maputo Africa/Lagos Africa/Kinshasa Africa/Lubumbashi","CF|Africa/Lagos Africa/Bangui","CG|Africa/Lagos Africa/Brazzaville","CH|Europe/Zurich","CI|Africa/Abidjan","CK|Pacific/Rarotonga","CL|America/Santiago America/Punta_Arenas Pacific/Easter","CM|Africa/Lagos Africa/Douala","CN|Asia/Shanghai Asia/Urumqi","CO|America/Bogota","CR|America/Costa_Rica","CU|America/Havana","CV|Atlantic/Cape_Verde","CW|America/Curacao","CX|Indian/Christmas","CY|Asia/Nicosia Asia/Famagusta","CZ|Europe/Prague","DE|Europe/Zurich Europe/Berlin Europe/Busingen","DJ|Africa/Nairobi Africa/Djibouti","DK|Europe/Copenhagen","DM|America/Port_of_Spain America/Dominica","DO|America/Santo_Domingo","DZ|Africa/Algiers","EC|America/Guayaquil Pacific/Galapagos","EE|Europe/Tallinn","EG|Africa/Cairo","EH|Africa/El_Aaiun","ER|Africa/Nairobi Africa/Asmara","ES|Europe/Madrid Africa/Ceuta Atlantic/Canary","ET|Africa/Nairobi Africa/Addis_Ababa","FI|Europe/Helsinki","FJ|Pacific/Fiji","FK|Atlantic/Stanley","FM|Pacific/Chuuk Pacific/Pohnpei Pacific/Kosrae","FO|Atlantic/Faroe","FR|Europe/Paris","GA|Africa/Lagos Africa/Libreville","GB|Europe/London","GD|America/Port_of_Spain America/Grenada","GE|Asia/Tbilisi","GF|America/Cayenne","GG|Europe/London Europe/Guernsey","GH|Africa/Accra","GI|Europe/Gibraltar","GL|America/Godthab America/Danmarkshavn America/Scoresbysund America/Thule","GM|Africa/Abidjan Africa/Banjul","GN|Africa/Abidjan Africa/Conakry","GP|America/Port_of_Spain America/Guadeloupe","GQ|Africa/Lagos Africa/Malabo","GR|Europe/Athens","GS|Atlantic/South_Georgia","GT|America/Guatemala","GU|Pacific/Guam","GW|Africa/Bissau","GY|America/Guyana","HK|Asia/Hong_Kong","HN|America/Tegucigalpa","HR|Europe/Belgrade Europe/Zagreb","HT|America/Port-au-Prince","HU|Europe/Budapest","ID|Asia/Jakarta Asia/Pontianak Asia/Makassar Asia/Jayapura","IE|Europe/Dublin","IL|Asia/Jerusalem","IM|Europe/London Europe/Isle_of_Man","IN|Asia/Kolkata","IO|Indian/Chagos","IQ|Asia/Baghdad","IR|Asia/Tehran","IS|Atlantic/Reykjavik","IT|Europe/Rome","JE|Europe/London Europe/Jersey","JM|America/Jamaica","JO|Asia/Amman","JP|Asia/Tokyo","KE|Africa/Nairobi","KG|Asia/Bishkek","KH|Asia/Bangkok Asia/Phnom_Penh","KI|Pacific/Tarawa Pacific/Enderbury Pacific/Kiritimati","KM|Africa/Nairobi Indian/Comoro","KN|America/Port_of_Spain America/St_Kitts","KP|Asia/Pyongyang","KR|Asia/Seoul","KW|Asia/Riyadh Asia/Kuwait","KY|America/Panama America/Cayman","KZ|Asia/Almaty Asia/Qyzylorda Asia/Qostanay Asia/Aqtobe Asia/Aqtau Asia/Atyrau Asia/Oral","LA|Asia/Bangkok Asia/Vientiane","LB|Asia/Beirut","LC|America/Port_of_Spain America/St_Lucia","LI|Europe/Zurich Europe/Vaduz","LK|Asia/Colombo","LR|Africa/Monrovia","LS|Africa/Johannesburg Africa/Maseru","LT|Europe/Vilnius","LU|Europe/Luxembourg","LV|Europe/Riga","LY|Africa/Tripoli","MA|Africa/Casablanca","MC|Europe/Monaco","MD|Europe/Chisinau","ME|Europe/Belgrade Europe/Podgorica","MF|America/Port_of_Spain America/Marigot","MG|Africa/Nairobi Indian/Antananarivo","MH|Pacific/Majuro Pacific/Kwajalein","MK|Europe/Belgrade Europe/Skopje","ML|Africa/Abidjan Africa/Bamako","MM|Asia/Yangon","MN|Asia/Ulaanbaatar Asia/Hovd Asia/Choibalsan","MO|Asia/Macau","MP|Pacific/Guam Pacific/Saipan","MQ|America/Martinique","MR|Africa/Abidjan Africa/Nouakchott","MS|America/Port_of_Spain America/Montserrat","MT|Europe/Malta","MU|Indian/Mauritius","MV|Indian/Maldives","MW|Africa/Maputo Africa/Blantyre","MX|America/Mexico_City America/Cancun America/Merida America/Monterrey America/Matamoros America/Mazatlan America/Chihuahua America/Ojinaga America/Hermosillo America/Tijuana America/Bahia_Banderas","MY|Asia/Kuala_Lumpur Asia/Kuching","MZ|Africa/Maputo","NA|Africa/Windhoek","NC|Pacific/Noumea","NE|Africa/Lagos Africa/Niamey","NF|Pacific/Norfolk","NG|Africa/Lagos","NI|America/Managua","NL|Europe/Amsterdam","NO|Europe/Oslo","NP|Asia/Kathmandu","NR|Pacific/Nauru","NU|Pacific/Niue","NZ|Pacific/Auckland Pacific/Chatham","OM|Asia/Dubai Asia/Muscat","PA|America/Panama","PE|America/Lima","PF|Pacific/Tahiti Pacific/Marquesas Pacific/Gambier","PG|Pacific/Port_Moresby Pacific/Bougainville","PH|Asia/Manila","PK|Asia/Karachi","PL|Europe/Warsaw","PM|America/Miquelon","PN|Pacific/Pitcairn","PR|America/Puerto_Rico","PS|Asia/Gaza Asia/Hebron","PT|Europe/Lisbon Atlantic/Madeira Atlantic/Azores","PW|Pacific/Palau","PY|America/Asuncion","QA|Asia/Qatar","RE|Indian/Reunion","RO|Europe/Bucharest","RS|Europe/Belgrade","RU|Europe/Kaliningrad Europe/Moscow Europe/Simferopol Europe/Kirov Europe/Astrakhan Europe/Volgograd Europe/Saratov Europe/Ulyanovsk Europe/Samara Asia/Yekaterinburg Asia/Omsk Asia/Novosibirsk Asia/Barnaul Asia/Tomsk Asia/Novokuznetsk Asia/Krasnoyarsk Asia/Irkutsk Asia/Chita Asia/Yakutsk Asia/Khandyga Asia/Vladivostok Asia/Ust-Nera Asia/Magadan Asia/Sakhalin Asia/Srednekolymsk Asia/Kamchatka Asia/Anadyr","RW|Africa/Maputo Africa/Kigali","SA|Asia/Riyadh","SB|Pacific/Guadalcanal","SC|Indian/Mahe","SD|Africa/Khartoum","SE|Europe/Stockholm","SG|Asia/Singapore","SH|Africa/Abidjan Atlantic/St_Helena","SI|Europe/Belgrade Europe/Ljubljana","SJ|Europe/Oslo Arctic/Longyearbyen","SK|Europe/Prague Europe/Bratislava","SL|Africa/Abidjan Africa/Freetown","SM|Europe/Rome Europe/San_Marino","SN|Africa/Abidjan Africa/Dakar","SO|Africa/Nairobi Africa/Mogadishu","SR|America/Paramaribo","SS|Africa/Juba","ST|Africa/Sao_Tome","SV|America/El_Salvador","SX|America/Curacao America/Lower_Princes","SY|Asia/Damascus","SZ|Africa/Johannesburg Africa/Mbabane","TC|America/Grand_Turk","TD|Africa/Ndjamena","TF|Indian/Reunion Indian/Kerguelen","TG|Africa/Abidjan Africa/Lome","TH|Asia/Bangkok","TJ|Asia/Dushanbe","TK|Pacific/Fakaofo","TL|Asia/Dili","TM|Asia/Ashgabat","TN|Africa/Tunis","TO|Pacific/Tongatapu","TR|Europe/Istanbul","TT|America/Port_of_Spain","TV|Pacific/Funafuti","TW|Asia/Taipei","TZ|Africa/Nairobi Africa/Dar_es_Salaam","UA|Europe/Simferopol Europe/Kiev Europe/Uzhgorod Europe/Zaporozhye","UG|Africa/Nairobi Africa/Kampala","UM|Pacific/Pago_Pago Pacific/Wake Pacific/Honolulu Pacific/Midway","US|America/New_York America/Detroit America/Kentucky/Louisville America/Kentucky/Monticello America/Indiana/Indianapolis America/Indiana/Vincennes America/Indiana/Winamac America/Indiana/Marengo America/Indiana/Petersburg America/Indiana/Vevay America/Chicago America/Indiana/Tell_City America/Indiana/Knox America/Menominee America/North_Dakota/Center America/North_Dakota/New_Salem America/North_Dakota/Beulah America/Denver America/Boise America/Phoenix America/Los_Angeles America/Anchorage America/Juneau America/Sitka America/Metlakatla America/Yakutat America/Nome America/Adak Pacific/Honolulu","UY|America/Montevideo","UZ|Asia/Samarkand Asia/Tashkent","VA|Europe/Rome Europe/Vatican","VC|America/Port_of_Spain America/St_Vincent","VE|America/Caracas","VG|America/Port_of_Spain America/Tortola","VI|America/Port_of_Spain America/St_Thomas","VN|Asia/Bangkok Asia/Ho_Chi_Minh","VU|Pacific/Efate","WF|Pacific/Wallis","WS|Pacific/Apia","YE|Asia/Riyadh Asia/Aden","YT|Africa/Nairobi Indian/Mayotte","ZA|Africa/Johannesburg","ZM|Africa/Maputo Africa/Lusaka","ZW|Africa/Maputo Africa/Harare"]}),b});
/*! RESOURCE: /scripts/thirdparty/select2/select2.js */
(function ($) {
if(typeof $.fn.each2 == "undefined") {
$.extend($.fn, {
each2 : function (c) {
var j = $([0]), i = -1, l = this.length;
while (
++i < l
&& (j.context = j[0] = this[i])
&& c.call(j[0], i, j) !== false
);
return this;
}
});
}
})(jQuery);
(function ($, undefined) {
"use strict";
if (window.Select2 !== undefined) {
return;
}
var KEY, AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
KEY = {
TAB: 9,
ENTER: 13,
ESC: 27,
SPACE: 32,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAGE_UP: 33,
PAGE_DOWN: 34,
HOME: 36,
END: 35,
BACKSPACE: 8,
DELETE: 46,
isArrow: function (k) {
k = k.which ? k.which : k;
switch (k) {
case KEY.LEFT:
case KEY.RIGHT:
case KEY.UP:
case KEY.DOWN:
return true;
}
return false;
},
isControl: function (e) {
var k = e.which;
switch (k) {
case KEY.SHIFT:
case KEY.CTRL:
case KEY.ALT:
return true;
}
if (e.metaKey) return true;
return false;
},
isFunctionKey: function (k) {
k = k.which ? k.which : k;
return k >= 112 && k <= 123;
}
},
MEASURE_SCROLLBAR_TEMPLATE = "<div class='select2-measure-scrollbar'></div>",
DIACRITICS = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24B8":"C","\uFF23":"C","\u0106":"C","\u0108":"C","\u010A":"C","\u010C":"C","\u00C7":"C","\u1E08":"C","\u0187":"C","\u023B":"C","\uA73E":"C","\u24B9":"D","\uFF24":"D","\u1E0A":"D","\u010E":"D","\u1E0C":"D","\u1E10":"D","\u1E12":"D","\u1E0E":"D","\u0110":"D","\u018B":"D","\u018A":"D","\u0189":"D","\uA779":"D","\u01F1":"DZ","\u01C4":"DZ","\u01F2":"Dz","\u01C5":"Dz","\u24BA":"E","\uFF25":"E","\u00C8":"E","\u00C9":"E","\u00CA":"E","\u1EC0":"E","\u1EBE":"E","\u1EC4":"E","\u1EC2":"E","\u1EBC":"E","\u0112":"E","\u1E14":"E","\u1E16":"E","\u0114":"E","\u0116":"E","\u00CB":"E","\u1EBA":"E","\u011A":"E","\u0204":"E","\u0206":"E","\u1EB8":"E","\u1EC6":"E","\u0228":"E","\u1E1C":"E","\u0118":"E","\u1E18":"E","\u1E1A":"E","\u0190":"E","\u018E":"E","\u24BB":"F","\uFF26":"F","\u1E1E":"F","\u0191":"F","\uA77B":"F","\u24BC":"G","\uFF27":"G","\u01F4":"G","\u011C":"G","\u1E20":"G","\u011E":"G","\u0120":"G","\u01E6":"G","\u0122":"G","\u01E4":"G","\u0193":"G","\uA7A0":"G","\uA77D":"G","\uA77E":"G","\u24BD":"H","\uFF28":"H","\u0124":"H","\u1E22":"H","\u1E26":"H","\u021E":"H","\u1E24":"H","\u1E28":"H","\u1E2A":"H","\u0126":"H","\u2C67":"H","\u2C75":"H","\uA78D":"H","\u24BE":"I","\uFF29":"I","\u00CC":"I","\u00CD":"I","\u00CE":"I","\u0128":"I","\u012A":"I","\u012C":"I","\u0130":"I","\u00CF":"I","\u1E2E":"I","\u1EC8":"I","\u01CF":"I","\u0208":"I","\u020A":"I","\u1ECA":"I","\u012E":"I","\u1E2C":"I","\u0197":"I","\u24BF":"J","\uFF2A":"J","\u0134":"J","\u0248":"J","\u24C0":"K","\uFF2B":"K","\u1E30":"K","\u01E8":"K","\u1E32":"K","\u0136":"K","\u1E34":"K","\u0198":"K","\u2C69":"K","\uA740":"K","\uA742":"K","\uA744":"K","\uA7A2":"K","\u24C1":"L","\uFF2C":"L","\u013F":"L","\u0139":"L","\u013D":"L","\u1E36":"L","\u1E38":"L","\u013B":"L","\u1E3C":"L","\u1E3A":"L","\u0141":"L","\u023D":"L","\u2C62":"L","\u2C60":"L","\uA748":"L","\uA746":"L","\uA780":"L","\u01C7":"LJ","\u01C8":"Lj","\u24C2":"M","\uFF2D":"M","\u1E3E":"M","\u1E40":"M","\u1E42":"M","\u2C6E":"M","\u019C":"M","\u24C3":"N","\uFF2E":"N","\u01F8":"N","\u0143":"N","\u00D1":"N","\u1E44":"N","\u0147":"N","\u1E46":"N","\u0145":"N","\u1E4A":"N","\u1E48":"N","\u0220":"N","\u019D":"N","\uA790":"N","\uA7A4":"N","\u01CA":"NJ","\u01CB":"Nj","\u24C4":"O","\uFF2F":"O","\u00D2":"O","\u00D3":"O","\u00D4":"O","\u1ED2":"O","\u1ED0":"O","\u1ED6":"O","\u1ED4":"O","\u00D5":"O","\u1E4C":"O","\u022C":"O","\u1E4E":"O","\u014C":"O","\u1E50":"O","\u1E52":"O","\u014E":"O","\u022E":"O","\u0230":"O","\u00D6":"O","\u022A":"O","\u1ECE":"O","\u0150":"O","\u01D1":"O","\u020C":"O","\u020E":"O","\u01A0":"O","\u1EDC":"O","\u1EDA":"O","\u1EE0":"O","\u1EDE":"O","\u1EE2":"O","\u1ECC":"O","\u1ED8":"O","\u01EA":"O","\u01EC":"O","\u00D8":"O","\u01FE":"O","\u0186":"O","\u019F":"O","\uA74A":"O","\uA74C":"O","\u01A2":"OI","\uA74E":"OO","\u0222":"OU","\u24C5":"P","\uFF30":"P","\u1E54":"P","\u1E56":"P","\u01A4":"P","\u2C63":"P","\uA750":"P","\uA752":"P","\uA754":"P","\u24C6":"Q","\uFF31":"Q","\uA756":"Q","\uA758":"Q","\u024A":"Q","\u24C7":"R","\uFF32":"R","\u0154":"R","\u1E58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1E5A":"R","\u1E5C":"R","\u0156":"R","\u1E5E":"R","\u024C":"R","\u2C64":"R","\uA75A":"R","\uA7A6":"R","\uA782":"R","\u24C8":"S","\uFF33":"S","\u1E9E":"S","\u015A":"S","\u1E64":"S","\u015C":"S","\u1E60":"S","\u0160":"S","\u1E66":"S","\u1E62":"S","\u1E68":"S","\u0218":"S","\u015E":"S","\u2C7E":"S","\uA7A8":"S","\uA784":"S","\u24C9":"T","\uFF34":"T","\u1E6A":"T","\u0164":"T","\u1E6C":"T","\u021A":"T","\u0162":"T","\u1E70":"T","\u1E6E":"T","\u0166":"T","\u01AC":"T","\u01AE":"T","\u023E":"T","\uA786":"T","\uA728":"TZ","\u24CA":"U","\uFF35":"U","\u00D9":"U","\u00DA":"U","\u00DB":"U","\u0168":"U","\u1E78":"U","\u016A":"U","\u1E7A":"U","\u016C":"U","\u00DC":"U","\u01DB":"U","\u01D7":"U","\u01D5":"U","\u01D9":"U","\u1EE6":"U","\u016E":"U","\u0170":"U","\u01D3":"U","\u0214":"U","\u0216":"U","\u01AF":"U","\u1EEA":"U","\u1EE8":"U","\u1EEE":"U","\u1EEC":"U","\u1EF0":"U","\u1EE4":"U","\u1E72":"U","\u0172":"U","\u1E76":"U","\u1E74":"U","\u0244":"U","\u24CB":"V","\uFF36":"V","\u1E7C":"V","\u1E7E":"V","\u01B2":"V","\uA75E":"V","\u0245":"V","\uA760":"VY","\u24CC":"W","\uFF37":"W","\u1E80":"W","\u1E82":"W","\u0174":"W","\u1E86":"W","\u1E84":"W","\u1E88":"W","\u2C72":"W","\u24CD":"X","\uFF38":"X","\u1E8A":"X","\u1E8C":"X","\u24CE":"Y","\uFF39":"Y","\u1EF2":"Y","\u00DD":"Y","\u0176":"Y","\u1EF8":"Y","\u0232":"Y","\u1E8E":"Y","\u0178":"Y","\u1EF6":"Y","\u1EF4":"Y","\u01B3":"Y","\u024E":"Y","\u1EFE":"Y","\u24CF":"Z","\uFF3A":"Z","\u0179":"Z","\u1E90":"Z","\u017B":"Z","\u017D":"Z","\u1E92":"Z","\u1E94":"Z","\u01B5":"Z","\u0224":"Z","\u2C7F":"Z","\u2C6B":"Z","\uA762":"Z","\u24D0":"a","\uFF41":"a","\u1E9A":"a","\u00E0":"a","\u00E1":"a","\u00E2":"a","\u1EA7":"a","\u1EA5":"a","\u1EAB":"a","\u1EA9":"a","\u00E3":"a","\u0101":"a","\u0103":"a","\u1EB1":"a","\u1EAF":"a","\u1EB5":"a","\u1EB3":"a","\u0227":"a","\u01E1":"a","\u00E4":"a","\u01DF":"a","\u1EA3":"a","\u00E5":"a","\u01FB":"a","\u01CE":"a","\u0201":"a","\u0203":"a","\u1EA1":"a","\u1EAD":"a","\u1EB7":"a","\u1E01":"a","\u0105":"a","\u2C65":"a","\u0250":"a","\uA733":"aa","\u00E6":"ae","\u01FD":"ae","\u01E3":"ae","\uA735":"ao","\uA737":"au","\uA739":"av","\uA73B":"av","\uA73D":"ay","\u24D1":"b","\uFF42":"b","\u1E03":"b","\u1E05":"b","\u1E07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24D2":"c","\uFF43":"c","\u0107":"c","\u0109":"c","\u010B":"c","\u010D":"c","\u00E7":"c","\u1E09":"c","\u0188":"c","\u023C":"c","\uA73F":"c","\u2184":"c","\u24D3":"d","\uFF44":"d","\u1E0B":"d","\u010F":"d","\u1E0D":"d","\u1E11":"d","\u1E13":"d","\u1E0F":"d","\u0111":"d","\u018C":"d","\u0256":"d","\u0257":"d","\uA77A":"d","\u01F3":"dz","\u01C6":"dz","\u24D4":"e","\uFF45":"e","\u00E8":"e","\u00E9":"e","\u00EA":"e","\u1EC1":"e","\u1EBF":"e","\u1EC5":"e","\u1EC3":"e","\u1EBD":"e","\u0113":"e","\u1E15":"e","\u1E17":"e","\u0115":"e","\u0117":"e","\u00EB":"e","\u1EBB":"e","\u011B":"e","\u0205":"e","\u0207":"e","\u1EB9":"e","\u1EC7":"e","\u0229":"e","\u1E1D":"e","\u0119":"e","\u1E19":"e","\u1E1B":"e","\u0247":"e","\u025B":"e","\u01DD":"e","\u24D5":"f","\uFF46":"f","\u1E1F":"f","\u0192":"f","\uA77C":"f","\u24D6":"g","\uFF47":"g","\u01F5":"g","\u011D":"g","\u1E21":"g","\u011F":"g","\u0121":"g","\u01E7":"g","\u0123":"g","\u01E5":"g","\u0260":"g","\uA7A1":"g","\u1D79":"g","\uA77F":"g","\u24D7":"h","\uFF48":"h","\u0125":"h","\u1E23":"h","\u1E27":"h","\u021F":"h","\u1E25":"h","\u1E29":"h","\u1E2B":"h","\u1E96":"h","\u0127":"h","\u2C68":"h","\u2C76":"h","\u0265":"h","\u0195":"hv","\u24D8":"i","\uFF49":"i","\u00EC":"i","\u00ED":"i","\u00EE":"i","\u0129":"i","\u012B":"i","\u012D":"i","\u00EF":"i","\u1E2F":"i","\u1EC9":"i","\u01D0":"i","\u0209":"i","\u020B":"i","\u1ECB":"i","\u012F":"i","\u1E2D":"i","\u0268":"i","\u0131":"i","\u24D9":"j","\uFF4A":"j","\u0135":"j","\u01F0":"j","\u0249":"j","\u24DA":"k","\uFF4B":"k","\u1E31":"k","\u01E9":"k","\u1E33":"k","\u0137":"k","\u1E35":"k","\u0199":"k","\u2C6A":"k","\uA741":"k","\uA743":"k","\uA745":"k","\uA7A3":"k","\u24DB":"l","\uFF4C":"l","\u0140":"l","\u013A":"l","\u013E":"l","\u1E37":"l","\u1E39":"l","\u013C":"l","\u1E3D":"l","\u1E3B":"l","\u017F":"l","\u0142":"l","\u019A":"l","\u026B":"l","\u2C61":"l","\uA749":"l","\uA781":"l","\uA747":"l","\u01C9":"lj","\u24DC":"m","\uFF4D":"m","\u1E3F":"m","\u1E41":"m","\u1E43":"m","\u0271":"m","\u026F":"m","\u24DD":"n","\uFF4E":"n","\u01F9":"n","\u0144":"n","\u00F1":"n","\u1E45":"n","\u0148":"n","\u1E47":"n","\u0146":"n","\u1E4B":"n","\u1E49":"n","\u019E":"n","\u0272":"n","\u0149":"n","\uA791":"n","\uA7A5":"n","\u01CC":"nj","\u24DE":"o","\uFF4F":"o","\u00F2":"o","\u00F3":"o","\u00F4":"o","\u1ED3":"o","\u1ED1":"o","\u1ED7":"o","\u1ED5":"o","\u00F5":"o","\u1E4D":"o","\u022D":"o","\u1E4F":"o","\u014D":"o","\u1E51":"o","\u1E53":"o","\u014F":"o","\u022F":"o","\u0231":"o","\u00F6":"o","\u022B":"o","\u1ECF":"o","\u0151":"o","\u01D2":"o","\u020D":"o","\u020F":"o","\u01A1":"o","\u1EDD":"o","\u1EDB":"o","\u1EE1":"o","\u1EDF":"o","\u1EE3":"o","\u1ECD":"o","\u1ED9":"o","\u01EB":"o","\u01ED":"o","\u00F8":"o","\u01FF":"o","\u0254":"o","\uA74B":"o","\uA74D":"o","\u0275":"o","\u01A3":"oi","\u0223":"ou","\uA74F":"oo","\u24DF":"p","\uFF50":"p","\u1E55":"p","\u1E57":"p","\u01A5":"p","\u1D7D":"p","\uA751":"p","\uA753":"p","\uA755":"p","\u24E0":"q","\uFF51":"q","\u024B":"q","\uA757":"q","\uA759":"q","\u24E1":"r","\uFF52":"r","\u0155":"r","\u1E59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1E5B":"r","\u1E5D":"r","\u0157":"r","\u1E5F":"r","\u024D":"r","\u027D":"r","\uA75B":"r","\uA7A7":"r","\uA783":"r","\u24E2":"s","\uFF53":"s","\u00DF":"s","\u015B":"s","\u1E65":"s","\u015D":"s","\u1E61":"s","\u0161":"s","\u1E67":"s","\u1E63":"s","\u1E69":"s","\u0219":"s","\u015F":"s","\u023F":"s","\uA7A9":"s","\uA785":"s","\u1E9B":"s","\u24E3":"t","\uFF54":"t","\u1E6B":"t","\u1E97":"t","\u0165":"t","\u1E6D":"t","\u021B":"t","\u0163":"t","\u1E71":"t","\u1E6F":"t","\u0167":"t","\u01AD":"t","\u0288":"t","\u2C66":"t","\uA787":"t","\uA729":"tz","\u24E4":"u","\uFF55":"u","\u00F9":"u","\u00FA":"u","\u00FB":"u","\u0169":"u","\u1E79":"u","\u016B":"u","\u1E7B":"u","\u016D":"u","\u00FC":"u","\u01DC":"u","\u01D8":"u","\u01D6":"u","\u01DA":"u","\u1EE7":"u","\u016F":"u","\u0171":"u","\u01D4":"u","\u0215":"u","\u0217":"u","\u01B0":"u","\u1EEB":"u","\u1EE9":"u","\u1EEF":"u","\u1EED":"u","\u1EF1":"u","\u1EE5":"u","\u1E73":"u","\u0173":"u","\u1E77":"u","\u1E75":"u","\u0289":"u","\u24E5":"v","\uFF56":"v","\u1E7D":"v","\u1E7F":"v","\u028B":"v","\uA75F":"v","\u028C":"v","\uA761":"vy","\u24E6":"w","\uFF57":"w","\u1E81":"w","\u1E83":"w","\u0175":"w","\u1E87":"w","\u1E85":"w","\u1E98":"w","\u1E89":"w","\u2C73":"w","\u24E7":"x","\uFF58":"x","\u1E8B":"x","\u1E8D":"x","\u24E8":"y","\uFF59":"y","\u1EF3":"y","\u00FD":"y","\u0177":"y","\u1EF9":"y","\u0233":"y","\u1E8F":"y","\u00FF":"y","\u1EF7":"y","\u1E99":"y","\u1EF5":"y","\u01B4":"y","\u024F":"y","\u1EFF":"y","\u24E9":"z","\uFF5A":"z","\u017A":"z","\u1E91":"z","\u017C":"z","\u017E":"z","\u1E93":"z","\u1E95":"z","\u01B6":"z","\u0225":"z","\u0240":"z","\u2C6C":"z","\uA763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038A":"\u0399","\u03AA":"\u0399","\u038C":"\u039F","\u038E":"\u03A5","\u03AB":"\u03A5","\u038F":"\u03A9","\u03AC":"\u03B1","\u03AD":"\u03B5","\u03AE":"\u03B7","\u03AF":"\u03B9","\u03CA":"\u03B9","\u0390":"\u03B9","\u03CC":"\u03BF","\u03CD":"\u03C5","\u03CB":"\u03C5","\u03B0":"\u03C5","\u03C9":"\u03C9","\u03C2":"\u03C3"};
$document = $(document);
nextUid=(function() { var counter=1; return function() { return counter++; }; }());
function reinsertElement(element) {
var placeholder = $(document.createTextNode(''));
element.before(placeholder);
placeholder.before(element);
placeholder.remove();
}
function stripDiacritics(str) {
function match(a) {
return DIACRITICS[a] || a;
}
return str.replace(/[^\u0000-\u007E]/g, match);
}
function indexOf(value, array) {
var i = 0, l = array.length;
for (; i < l; i = i + 1) {
if (equal(value, array[i])) return i;
}
return -1;
}
function measureScrollbar () {
var $template = $( MEASURE_SCROLLBAR_TEMPLATE );
$template.appendTo('body');
var dim = {
width: $template.width() - $template[0].clientWidth,
height: $template.height() - $template[0].clientHeight
};
$template.remove();
return dim;
}
function equal(a, b) {
if (a === b) return true;
if (a === undefined || b === undefined) return false;
if (a === null || b === null) return false;
if (a.constructor === String) return a+'' === b+'';
if (b.constructor === String) return b+'' === a+'';
return false;
}
function splitVal(string, separator) {
var val, i, l;
if (string === null || string.length < 1) return [];
val = string.split(separator);
for (i = 0, l = val.length; i < l; i = i + 1) val[i] = $.trim(val[i]);
return val;
}
function getSideBorderPadding(element) {
return element.outerWidth(false) - element.width();
}
function installKeyUpChangeEvent(element) {
var key="keyup-change-value";
element.on("keydown", function () {
if ($.data(element, key) === undefined) {
$.data(element, key, element.val());
}
});
element.on("keyup", function () {
var val= $.data(element, key);
if (val !== undefined && element.val() !== val) {
$.removeData(element, key);
element.trigger("keyup-change");
}
});
}
function installFilteredMouseMove(element) {
element.on("mousemove", function (e) {
var lastpos = lastMousePosition;
if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
$(e.target).trigger("mousemove-filtered", e);
}
});
}
function debounce(quietMillis, fn, ctx) {
ctx = ctx || undefined;
var timeout;
return function () {
var args = arguments;
window.clearTimeout(timeout);
timeout = window.setTimeout(function() {
fn.apply(ctx, args);
}, quietMillis);
};
}
function installDebouncedScroll(threshold, element) {
var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
element.on("scroll", function (e) {
if (indexOf(e.target, element.get()) >= 0) notify(e);
});
}
function focus($el) {
if ($el[0] === document.activeElement) return;
window.setTimeout(function() {
var el=$el[0], pos=$el.val().length, range;
$el.focus();
var isVisible = (el.offsetWidth > 0 || el.offsetHeight > 0);
if (isVisible && el === document.activeElement) {
if(el.setSelectionRange)
{
el.setSelectionRange(pos, pos);
}
else if (el.createTextRange) {
range = el.createTextRange();
range.collapse(false);
range.select();
}
}
}, 0);
}
function getCursorInfo(el) {
el = $(el)[0];
var offset = 0;
var length = 0;
if ('selectionStart' in el) {
offset = el.selectionStart;
length = el.selectionEnd - offset;
} else if ('selection' in document) {
el.focus();
var sel = document.selection.createRange();
length = document.selection.createRange().text.length;
sel.moveStart('character', -el.value.length);
offset = sel.text.length - length;
}
return { offset: offset, length: length };
}
function killEvent(event) {
event.preventDefault();
event.stopPropagation();
}
function killEventImmediately(event) {
event.preventDefault();
event.stopImmediatePropagation();
}
function measureTextWidth(e) {
if (!sizer){
var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
sizer = $(document.createElement("div")).css({
position: "absolute",
left: "-10000px",
top: "-10000px",
display: "none",
fontSize: style.fontSize,
fontFamily: style.fontFamily,
fontStyle: style.fontStyle,
fontWeight: style.fontWeight,
letterSpacing: style.letterSpacing,
textTransform: style.textTransform,
whiteSpace: "nowrap"
});
sizer.attr("class","select2-sizer");
$("body").append(sizer);
}
sizer.text(e.val());
return sizer.width();
}
function syncCssClasses(dest, src, adapter) {
var classes, replacements = [], adapted;
classes = $.trim(dest.attr("class"));
if (classes) {
classes = '' + classes;
$(classes.split(/\s+/)).each2(function() {
if (this.indexOf("select2-") === 0) {
replacements.push(this);
}
});
}
classes = $.trim(src.attr("class"));
if (classes) {
classes = '' + classes;
$(classes.split(/\s+/)).each2(function() {
if (this.indexOf("select2-") !== 0) {
adapted = adapter(this);
if (adapted) {
replacements.push(adapted);
}
}
});
}
dest.attr("class", replacements.join(" "));
}
function markMatch(text, term, markup, escapeMarkup) {
var match=stripDiacritics(text.toUpperCase()).indexOf(stripDiacritics(term.toUpperCase())),
tl=term.length;
if (match<0) {
markup.push(escapeMarkup(text));
return;
}
markup.push(escapeMarkup(text.substring(0, match)));
markup.push("<span class='select2-match'>");
markup.push(escapeMarkup(text.substring(match, match + tl)));
markup.push("</span>");
markup.push(escapeMarkup(text.substring(match + tl, text.length)));
}
function defaultEscapeMarkup(markup) {
var replace_map = {
'\\': '&#92;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
"/": '&#47;'
};
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
return replace_map[match];
});
}
function ajax(options) {
var timeout,
handler = null,
quietMillis = options.quietMillis || 100,
ajaxUrl = options.url,
self = this;
return function (query) {
window.clearTimeout(timeout);
timeout = window.setTimeout(function () {
var data = options.data,
url = ajaxUrl,
transport = options.transport || $.fn.select2.ajaxDefaults.transport,
deprecated = {
type: options.type || 'GET',
cache: options.cache || false,
jsonpCallback: options.jsonpCallback||undefined,
dataType: options.dataType||"json"
},
params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
data = data ? data.call(self, query.term, query.page, query.context) : null;
url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
if (handler && typeof handler.abort === "function") { handler.abort(); }
if (options.params) {
if ($.isFunction(options.params)) {
$.extend(params, options.params.call(self));
} else {
$.extend(params, options.params);
}
}
$.extend(params, {
url: url,
dataType: options.dataType,
data: data,
success: function (data) {
var results = options.results(data, query.page, query);
query.callback(results);
},
error: function(jqXHR, textStatus, errorThrown){
var results = {
hasError: true,
jqXHR: jqXHR,
textStatus: textStatus,
errorThrown: errorThrown,
};
query.callback(results);
}
});
handler = transport.call(self, params);
}, quietMillis);
};
}
function local(options) {
var data = options,
dataText,
tmp,
text = function (item) { return ""+item.text; };
if ($.isArray(data)) {
tmp = data;
data = { results: tmp };
}
if ($.isFunction(data) === false) {
tmp = data;
data = function() { return tmp; };
}
var dataItem = data();
if (dataItem.text) {
text = dataItem.text;
if (!$.isFunction(text)) {
dataText = dataItem.text;
text = function (item) { return item[dataText]; };
}
}
return function (query) {
var t = query.term, filtered = { results: [] }, process;
if (t === "") {
query.callback(data());
return;
}
process = function(datum, collection) {
var group, attr;
datum = datum[0];
if (datum.children) {
group = {};
for (attr in datum) {
if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
}
group.children=[];
$(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
if (group.children.length || query.matcher(t, text(group), datum)) {
collection.push(group);
}
} else {
if (query.matcher(t, text(datum), datum)) {
collection.push(datum);
}
}
};
$(data().results).each2(function(i, datum) { process(datum, filtered.results); });
query.callback(filtered);
};
}
function tags(data) {
var isFunc = $.isFunction(data);
return function (query) {
var t = query.term, filtered = {results: []};
var result = isFunc ? data(query) : data;
if ($.isArray(result)) {
$(result).each(function () {
var isObject = this.text !== undefined,
text = isObject ? this.text : this;
if (t === "" || query.matcher(t, text)) {
filtered.results.push(isObject ? this : {id: this, text: this});
}
});
query.callback(filtered);
}
};
}
function checkFormatter(formatter, formatterName) {
if ($.isFunction(formatter)) return true;
if (!formatter) return false;
if (typeof(formatter) === 'string') return true;
throw new Error(formatterName +" must be a string, function, or falsy value");
}
function evaluate(val, context) {
if ($.isFunction(val)) {
var args = Array.prototype.slice.call(arguments, 2);
return val.apply(context, args);
}
return val;
}
function countResults(results) {
var count = 0;
$.each(results, function(i, item) {
if (item.children) {
count += countResults(item.children);
} else {
count++;
}
});
return count;
}
function defaultTokenizer(input, selection, selectCallback, opts) {
var original = input,
dupe = false,
token,
index,
i, l,
separator;
if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
while (true) {
index = -1;
for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
separator = opts.tokenSeparators[i];
index = input.indexOf(separator);
if (index >= 0) break;
}
if (index < 0) break;
token = input.substring(0, index);
input = input.substring(index + separator.length);
if (token.length > 0) {
token = opts.createSearchChoice.call(this, token, selection);
if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
dupe = false;
for (i = 0, l = selection.length; i < l; i++) {
if (equal(opts.id(token), opts.id(selection[i]))) {
dupe = true; break;
}
}
if (!dupe) selectCallback(token);
}
}
}
if (original!==input) return input;
}
function cleanupJQueryElements() {
var self = this;
$.each(arguments, function (i, element) {
self[element].remove();
self[element] = null;
});
}
function clazz(SuperClass, methods) {
var constructor = function () {};
constructor.prototype = new SuperClass;
constructor.prototype.constructor = constructor;
constructor.prototype.parent = SuperClass.prototype;
constructor.prototype = $.extend(constructor.prototype, methods);
return constructor;
}
AbstractSelect2 = clazz(Object, {
bind: function (func) {
var self = this;
return function () {
func.apply(self, arguments);
};
},
init: function (opts) {
var results, search, resultsSelector = ".select2-results";
this.opts = opts = this.prepareOpts(opts);
this.id=opts.id;
if (opts.element.data("select2") !== undefined &&
opts.element.data("select2") !== null) {
opts.element.data("select2").destroy();
}
this.container = this.createContainer();
this.liveRegion = $("<span>", {
role: "status",
"aria-live": "polite"
})
.addClass("select2-hidden-accessible")
.appendTo(document.body);
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
this.containerEventName= this.containerId
.replace(/([.])/g, '_')
.replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
this.container.attr("id", this.containerId);
this.container.attr("title", opts.element.attr("title"));
this.body = $("body");
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
this.container.attr("style", opts.element.attr("style"));
this.container.css(evaluate(opts.containerCss, this.opts.element));
this.container.addClass(evaluate(opts.containerCssClass, this.opts.element));
this.elementTabIndex = this.opts.element.attr("tabindex");
this.opts.element
.data("select2", this)
.attr("tabindex", "-1")
.before(this.container)
.on("click.select2", killEvent);
this.container.data("select2", this);
this.dropdown = this.container.find(".select2-drop");
syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
this.dropdown.addClass(evaluate(opts.dropdownCssClass, this.opts.element));
this.dropdown.data("select2", this);
this.dropdown.on("click", killEvent);
this.results = results = this.container.find(resultsSelector);
this.search = search = this.container.find("input.select2-input");
this.queryCount = 0;
this.resultsPage = 0;
this.context = null;
this.initContainer();
this.container.on("click", killEvent);
installFilteredMouseMove(this.results);
this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
this._touchEvent = true;
this.highlightUnderEvent(event);
}));
this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
this.dropdown.on('click', this.bind(function (event) {
if (this._touchEvent) {
this._touchEvent = false;
this.selectHighlighted();
}
}));
installDebouncedScroll(80, this.results);
this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
$(this.container).on("change", ".select2-input", function(e) {e.stopPropagation();});
$(this.dropdown).on("change", ".select2-input", function(e) {e.stopPropagation();});
if ($.fn.mousewheel) {
results.mousewheel(function (e, delta, deltaX, deltaY) {
var top = results.scrollTop();
if (deltaY > 0 && top - deltaY <= 0) {
results.scrollTop(0);
killEvent(e);
} else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
results.scrollTop(results.get(0).scrollHeight - results.height());
killEvent(e);
}
});
}
installKeyUpChangeEvent(search);
search.on("keyup-change input paste", this.bind(this.updateResults));
search.on("focus", function () { search.addClass("select2-focused"); });
search.on("blur", function () { search.removeClass("select2-focused");});
this.dropdown.on("mouseup", resultsSelector, this.bind(function (e) {
if ($(e.target).closest(".select2-result-selectable").length > 0) {
this.highlightUnderEvent(e);
this.selectHighlighted(e);
}
}));
this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
this.nextSearchTerm = undefined;
if ($.isFunction(this.opts.initSelection)) {
this.initSelection();
this.monitorSource();
}
if (opts.maximumInputLength !== null) {
this.search.attr("maxlength", opts.maximumInputLength);
}
var disabled = opts.element.prop("disabled");
if (disabled === undefined) disabled = false;
this.enable(!disabled);
var readonly = opts.element.prop("readonly");
if (readonly === undefined) readonly = false;
this.readonly(readonly);
scrollBarDimensions = scrollBarDimensions || measureScrollbar();
this.autofocus = opts.element.prop("autofocus");
opts.element.prop("autofocus", false);
if (this.autofocus) this.focus();
this.search.attr("placeholder", opts.searchInputPlaceholder);
},
destroy: function () {
var element=this.opts.element, select2 = element.data("select2"), self = this;
this.close();
if (element.length && element[0].detachEvent) {
element.each(function () {
this.detachEvent("onpropertychange", self._sync);
});
}
if (this.propertyObserver) {
this.propertyObserver.disconnect();
this.propertyObserver = null;
}
this._sync = null;
if (select2 !== undefined) {
select2.container.remove();
select2.liveRegion.remove();
select2.dropdown.remove();
element
.removeClass("select2-offscreen")
.removeData("select2")
.off(".select2")
.prop("autofocus", this.autofocus || false);
if (this.elementTabIndex) {
element.attr({tabindex: this.elementTabIndex});
} else {
element.removeAttr("tabindex");
}
element.show();
}
cleanupJQueryElements.call(this,
"container",
"liveRegion",
"dropdown",
"results",
"search"
);
},
optionToData: function(element) {
if (element.is("option")) {
return {
id:element.prop("value"),
text:element.text(),
element: element.get(),
css: element.attr("class"),
disabled: element.prop("disabled"),
locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
};
} else if (element.is("optgroup")) {
return {
text:element.attr("label"),
children:[],
element: element.get(),
css: element.attr("class")
};
}
},
prepareOpts: function (opts) {
var element, select, idKey, ajaxUrl, self = this;
element = opts.element;
if (element.get(0).tagName.toLowerCase() === "select") {
this.select = select = opts.element;
}
if (select) {
$.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
if (this in opts) {
throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a <select> element.");
}
});
}
opts = $.extend({}, {
populateResults: function(container, results, query) {
var populate, id=this.opts.id, liveRegion=this.liveRegion;
populate=function(results, container, depth) {
var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted;
results = opts.sortResults(results, container, query);
var nodes = [];
for (i = 0, l = results.length; i < l; i = i + 1) {
result=results[i];
disabled = (result.disabled === true);
selectable = (!disabled) && (id(result) !== undefined);
compound=result.children && result.children.length > 0;
node=$("<li></li>");
node.addClass("select2-results-dept-"+depth);
node.addClass("select2-result");
node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
if (disabled) { node.addClass("select2-disabled"); }
if (compound) { node.addClass("select2-result-with-children"); }
node.addClass(self.opts.formatResultCssClass(result));
node.attr("role", "presentation");
label=$(document.createElement("div"));
label.addClass("select2-result-label");
label.attr("id", "select2-result-label-" + nextUid());
label.attr("role", "option");
formatted=opts.formatResult(result, label, query, self.opts.escapeMarkup);
if (formatted!==undefined) {
label.html(formatted);
node.append(label);
}
if (compound) {
innerContainer=$("<ul></ul>");
innerContainer.addClass("select2-result-sub");
populate(result.children, innerContainer, depth+1);
node.append(innerContainer);
}
node.data("select2-data", result);
nodes.push(node[0]);
}
container.append(nodes);
liveRegion.text(opts.formatMatches(results.length));
};
populate(results, container, 0);
}
}, $.fn.select2.defaults, opts);
if (typeof(opts.id) !== "function") {
idKey = opts.id;
opts.id = function (e) { return e[idKey]; };
}
if ($.isArray(opts.element.data("select2Tags"))) {
if ("tags" in opts) {
throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
}
opts.tags=opts.element.data("select2Tags");
}
if (select) {
opts.query = this.bind(function (query) {
var data = { results: [], more: false },
term = query.term,
children, placeholderOption, process;
process=function(element, collection) {
var group;
if (element.is("option")) {
if (query.matcher(term, element.text(), element)) {
collection.push(self.optionToData(element));
}
} else if (element.is("optgroup")) {
group=self.optionToData(element);
element.children().each2(function(i, elm) { process(elm, group.children); });
if (group.children.length>0) {
collection.push(group);
}
}
};
children=element.children();
if (this.getPlaceholder() !== undefined && children.length > 0) {
placeholderOption = this.getPlaceholderOption();
if (placeholderOption) {
children=children.not(placeholderOption);
}
}
children.each2(function(i, elm) { process(elm, data.results); });
query.callback(data);
});
opts.id=function(e) { return e.id; };
} else {
if (!("query" in opts)) {
if ("ajax" in opts) {
ajaxUrl = opts.element.data("ajax-url");
if (ajaxUrl && ajaxUrl.length > 0) {
opts.ajax.url = ajaxUrl;
}
opts.query = ajax.call(opts.element, opts.ajax);
} else if ("data" in opts) {
opts.query = local(opts.data);
} else if ("tags" in opts) {
opts.query = tags(opts.tags);
if (opts.createSearchChoice === undefined) {
opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
}
if (opts.initSelection === undefined) {
opts.initSelection = function (element, callback) {
var data = [];
$(splitVal(element.val(), opts.separator)).each(function () {
var obj = { id: this, text: this },
tags = opts.tags;
if ($.isFunction(tags)) tags=tags();
$(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
data.push(obj);
});
callback(data);
};
}
}
}
}
if (typeof(opts.query) !== "function") {
throw "query function not defined for Select2 " + opts.element.attr("id");
}
if (opts.createSearchChoicePosition === 'top') {
opts.createSearchChoicePosition = function(list, item) { list.unshift(item); };
}
else if (opts.createSearchChoicePosition === 'bottom') {
opts.createSearchChoicePosition = function(list, item) { list.push(item); };
}
else if (typeof(opts.createSearchChoicePosition) !== "function")  {
throw "invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";
}
return opts;
},
monitorSource: function () {
var el = this.opts.element, observer, self = this;
el.on("change.select2", this.bind(function (e) {
if (this.opts.element.data("select2-change-triggered") !== true) {
this.initSelection();
}
}));
this._sync = this.bind(function () {
var disabled = el.prop("disabled");
if (disabled === undefined) disabled = false;
this.enable(!disabled);
var readonly = el.prop("readonly");
if (readonly === undefined) readonly = false;
this.readonly(readonly);
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
});
if (el.length && el[0].attachEvent) {
el.each(function() {
this.attachEvent("onpropertychange", self._sync);
});
}
observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
if (observer !== undefined) {
if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
this.propertyObserver = new observer(function (mutations) {
$.each(mutations, self._sync);
var disabledMutation = mutations.filter(function (mutation) {
return mutation.attributeName === "disabled";
});
if(disabledMutation[0])
$(disabledMutation[0].target).trigger("select2.disabled.toggle",disabledMutation[0].target);
});
this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
}
},
triggerSelect: function(data) {
var evt = $.Event("select2-selecting", { val: this.id(data), object: data, choice: data });
this.opts.element.trigger(evt);
return !evt.isDefaultPrevented();
},
triggerChange: function (details) {
details = details || {};
details= $.extend({}, details, { type: "change", val: this.val() });
this.opts.element.data("select2-change-triggered", true);
this.opts.element.trigger(details);
this.opts.element.data("select2-change-triggered", false);
this.opts.element.click();
if (this.opts.blurOnChange)
this.opts.element.blur();
},
isInterfaceEnabled: function()
{
return this.enabledInterface === true;
},
enableInterface: function() {
var enabled = this._enabled && !this._readonly,
disabled = !enabled;
if (enabled === this.enabledInterface) return false;
this.container.toggleClass("select2-container-disabled", disabled);
this.close();
this.enabledInterface = enabled;
return true;
},
enable: function(enabled) {
if (enabled === undefined) enabled = true;
if (this._enabled === enabled) return;
this._enabled = enabled;
this.opts.element.prop("disabled", !enabled);
this.enableInterface();
},
disable: function() {
this.enable(false);
},
readonly: function(enabled) {
if (enabled === undefined) enabled = false;
if (this._readonly === enabled) return;
this._readonly = enabled;
this.opts.element.prop("readonly", enabled);
this.enableInterface();
},
opened: function () {
return (this.container) ? this.container.hasClass("select2-dropdown-open") : false;
},
positionDropdown: function() {
var $dropdown = this.dropdown,
offset = this.container.offset(),
height = this.container.outerHeight(false),
width = this.container.outerWidth(false),
dropHeight = $dropdown.outerHeight(false),
$window = $(window),
windowWidth = $window.width(),
windowHeight = $window.height(),
viewPortRight = $window.scrollLeft() + windowWidth,
viewportBottom = $window.scrollTop() + windowHeight,
dropTop = offset.top + height,
dropLeft = offset.left,
enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
dropWidth = $dropdown.outerWidth(false),
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
aboveNow = $dropdown.hasClass("select2-drop-above"),
bodyOffset,
above,
changeDirection,
css,
resultsListNode;
if (aboveNow) {
above = true;
if (!enoughRoomAbove && enoughRoomBelow) {
changeDirection = true;
above = false;
}
} else {
above = false;
if (!enoughRoomBelow && enoughRoomAbove) {
changeDirection = true;
above = true;
}
}
if (changeDirection) {
$dropdown.hide();
offset = this.container.offset();
height = this.container.outerHeight(false);
width = this.container.outerWidth(false);
dropHeight = $dropdown.outerHeight(false);
viewPortRight = $window.scrollLeft() + windowWidth;
viewportBottom = $window.scrollTop() + windowHeight;
dropTop = offset.top + height;
dropLeft = offset.left;
dropWidth = $dropdown.outerWidth(false);
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
$dropdown.show();
this.focusSearch();
}
if (this.opts.dropdownAutoWidth) {
resultsListNode = $('.select2-results', $dropdown)[0];
$dropdown.addClass('select2-drop-auto-width');
$dropdown.css('width', '');
dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
dropWidth > width ? width = dropWidth : dropWidth = width;
dropHeight = $dropdown.outerHeight(false);
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight;
}
else {
this.container.removeClass('select2-drop-auto-width');
}
if (this.body.css('position') !== 'static') {
bodyOffset = this.body.offset();
dropTop -= bodyOffset.top;
dropLeft -= bodyOffset.left;
}
if (!enoughRoomOnRight) {
dropLeft = offset.left + this.container.outerWidth(false) - dropWidth;
}
css =  {
left: dropLeft,
width: width
};
if (above) {
css.top = offset.top - dropHeight;
css.bottom = 'auto';
this.container.addClass("select2-drop-above");
$dropdown.addClass("select2-drop-above");
}
else {
css.top = dropTop;
css.bottom = 'auto';
this.container.removeClass("select2-drop-above");
$dropdown.removeClass("select2-drop-above");
}
css = $.extend(css, evaluate(this.opts.dropdownCss, this.opts.element));
$dropdown.css(css);
},
shouldOpen: function() {
var event;
if (this.opened()) return false;
if (this._enabled === false || this._readonly === true) return false;
event = $.Event("select2-opening");
this.opts.element.trigger(event);
return !event.isDefaultPrevented();
},
clearDropdownAlignmentPreference: function() {
this.container.removeClass("select2-drop-above");
this.dropdown.removeClass("select2-drop-above");
},
open: function () {
if (!this.shouldOpen()) return false;
this.opening();
$document.on("mousemove.select2Event", function (e) {
lastMousePosition.x = e.pageX;
lastMousePosition.y = e.pageY;
});
return true;
},
opening: function() {
var cid = this.containerEventName,
scroll = "scroll." + cid,
resize = "resize."+cid,
orient = "orientationchange."+cid,
mask;
this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
this.clearDropdownAlignmentPreference();
if(this.dropdown[0] !== this.body.children().last()[0]) {
this.dropdown.detach().appendTo(this.body);
}
mask = $("#select2-drop-mask");
if (mask.length == 0) {
mask = $(document.createElement("div"));
mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
mask.hide();
mask.appendTo(this.body);
mask.on("mousedown touchstart click", function (e) {
reinsertElement(mask);
var dropdown = $("#select2-drop"), self;
if (dropdown.length > 0) {
self=dropdown.data("select2");
if (self.opts.selectOnBlur) {
self.selectHighlighted({noFocus: true});
}
self.close();
e.preventDefault();
e.stopPropagation();
}
});
}
if (this.dropdown.prev()[0] !== mask[0]) {
this.dropdown.before(mask);
}
$("#select2-drop").removeAttr("id");
this.dropdown.attr("id", "select2-drop");
mask.show();
this.positionDropdown();
this.dropdown.show();
this.positionDropdown();
this.dropdown.addClass("select2-drop-active");
var that = this;
this.container.parents().add(window).each(function () {
$(this).on(resize+" "+scroll+" "+orient, function (e) {
if (that.opened()) that.positionDropdown();
});
});
},
close: function () {
if (!this.opened()) return;
var cid = this.containerEventName,
scroll = "scroll." + cid,
resize = "resize."+cid,
orient = "orientationchange."+cid;
this.container.parents().add(window).each(function () { $(this).off(scroll).off(resize).off(orient); });
this.clearDropdownAlignmentPreference();
$("#select2-drop-mask").hide();
this.dropdown.removeAttr("id");
this.dropdown.hide();
this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
this.results.empty();
$document.off("mousemove.select2Event");
this.clearSearch();
this.search.removeClass("select2-active");
this.opts.element.trigger($.Event("select2-close"));
},
externalSearch: function (term) {
this.open();
this.search.val(term);
this.updateResults(false);
},
clearSearch: function () {
},
getMaximumSelectionSize: function() {
return evaluate(this.opts.maximumSelectionSize, this.opts.element);
},
ensureHighlightVisible: function () {
var results = this.results, children, index, child, hb, rb, y, more, topOffset;
index = this.highlight();
if (index < 0) return;
if (index == 0) {
results.scrollTop(0);
return;
}
children = this.findHighlightableChoices().find('.select2-result-label');
child = $(children[index]);
topOffset = (child.offset() || {}).top || 0;
hb = topOffset + child.outerHeight(true);
if (index === children.length - 1) {
more = results.find("li.select2-more-results");
if (more.length > 0) {
hb = more.offset().top + more.outerHeight(true);
}
}
rb = results.offset().top + results.outerHeight(true);
if (hb > rb) {
results.scrollTop(results.scrollTop() + (hb - rb));
}
y = topOffset - results.offset().top;
if (y < 0 && child.css('display') != 'none' ) {
results.scrollTop(results.scrollTop() + y);
}
},
findHighlightableChoices: function() {
return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
},
moveHighlight: function (delta) {
var choices = this.findHighlightableChoices(),
index = this.highlight();
while (index > -1 && index < choices.length) {
index += delta;
var choice = $(choices[index]);
if (choice.hasClass("select2-result-selectable") && !choice.hasClass("select2-disabled") && !choice.hasClass("select2-selected")) {
this.highlight(index);
break;
}
}
},
highlight: function (index) {
var isIE11 = !!navigator.userAgent.match(/Trident.*rv\:11\./),
choices = this.findHighlightableChoices(),
choice,
data;
if (arguments.length === 0) {
return indexOf(choices.filter(".select2-highlighted")[0], choices.get());
}
if (index >= choices.length) index = choices.length - 1;
if (index < 0) index = 0;
this.removeHighlight();
choice = $(choices[index]);
choice.addClass("select2-highlighted");
this.search.attr("aria-activedescendant", choice.find(".select2-result-label").attr("id"));
this.ensureHighlightVisible();
if(!isIE11)
this.liveRegion.text(choice.text());
data = choice.data("select2-data");
if (data) {
this.opts.element.trigger({ type: "select2-highlight", val: this.id(data), choice: data });
}
},
removeHighlight: function() {
this.results.find(".select2-highlighted").removeClass("select2-highlighted");
},
touchMoved: function() {
this._touchMoved = true;
},
clearTouchMoved: function() {
this._touchMoved = false;
},
countSelectableResults: function() {
return this.findHighlightableChoices().length;
},
highlightUnderEvent: function (event) {
var el = $(event.target).closest(".select2-result-selectable");
if (el.length > 0 && !el.is(".select2-highlighted")) {
var choices = this.findHighlightableChoices();
this.highlight(choices.index(el));
} else if (el.length == 0) {
this.removeHighlight();
}
},
loadMoreIfNeeded: function () {
var results = this.results,
more = results.find("li.select2-more-results"),
below,
page = this.resultsPage + 1,
self=this,
term=this.search.val(),
context=this.context;
if (more.length === 0) return;
below = more.offset().top - results.offset().top - results.height();
if (below <= this.opts.loadMorePadding) {
more.addClass("select2-active");
this.opts.query({
element: this.opts.element,
term: term,
page: page,
context: context,
matcher: this.opts.matcher,
callback: this.bind(function (data) {
if (!self.opened()) return;
self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
self.postprocessResults(data, false, false);
if (data.more===true) {
more.detach().appendTo(results).text(evaluate(self.opts.formatLoadMore, self.opts.element, page+1));
window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
} else {
more.remove();
}
self.positionDropdown();
self.resultsPage = page;
self.context = data.context;
this.opts.element.trigger({ type: "select2-loaded", items: data });
})});
}
},
tokenize: function() {
},
updateResults: function (initial) {
var search = this.search,
results = this.results,
opts = this.opts,
data,
self = this,
input,
term = search.val(),
lastTerm = $.data(this.container, "select2-last-term"),
queryNumber;
if (initial !== true && lastTerm && equal(term, lastTerm)) return;
$.data(this.container, "select2-last-term", term);
if (initial !== true && (this.showSearchInput === false || !this.opened())) {
return;
}
function postRender() {
search.removeClass("select2-active");
self.positionDropdown();
if (results.find('.select2-no-results,.select2-selection-limit,.select2-searching').length) {
self.liveRegion.text(results.text());
}
else {
self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable').length));
}
}
function render(html) {
results.html(html);
postRender();
}
queryNumber = ++this.queryCount;
var maxSelSize = this.getMaximumSelectionSize();
if (maxSelSize >=1) {
data = this.data();
if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
return;
}
}
if (search.val().length < opts.minimumInputLength) {
if (checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooShort, opts.element, search.val(), opts.minimumInputLength) + "</li>");
} else {
render("");
}
if (initial && this.showSearch) this.showSearch(true);
return;
}
if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooLong, opts.element, search.val(), opts.maximumInputLength) + "</li>");
} else {
render("");
}
return;
}
if (opts.formatSearching && this.findHighlightableChoices().length === 0) {
render("<li class='select2-searching'>" + evaluate(opts.formatSearching, opts.element) + "</li>");
}
search.addClass("select2-active");
this.removeHighlight();
input = this.tokenize();
if (input != undefined && input != null) {
search.val(input);
}
this.resultsPage = 1;
opts.query({
element: opts.element,
term: search.val(),
page: this.resultsPage,
context: null,
matcher: opts.matcher,
callback: this.bind(function (data) {
var def;
if (queryNumber != this.queryCount) {
return;
}
if (!this.opened()) {
this.search.removeClass("select2-active");
return;
}
if(data.hasError !== undefined && checkFormatter(opts.formatAjaxError, "formatAjaxError")) {
render("<li class='select2-ajax-error'>" + evaluate(opts.formatAjaxError, opts.element, data.jqXHR, data.textStatus, data.errorThrown) + "</li>");
return;
}
this.context = (data.context===undefined) ? null : data.context;
if (this.opts.createSearchChoice && search.val() !== "") {
def = this.opts.createSearchChoice.call(self, search.val(), data.results);
if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
if ($(data.results).filter(
function () {
return equal(self.id(this), self.id(def));
}).length === 0) {
this.opts.createSearchChoicePosition(data.results, def);
}
}
}
if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
render("<li class='select2-no-results'>" + evaluate(opts.formatNoMatches, opts.element, search.val()) + "</li>");
return;
}
results.empty();
self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
if (data.more === true && checkFormatter(opts.formatLoadMore, "formatLoadMore")) {
results.append("<li class='select2-more-results'>" + opts.escapeMarkup(evaluate(opts.formatLoadMore, opts.element, this.resultsPage)) + "</li>");
window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
}
this.postprocessResults(data, initial);
postRender();
this.opts.element.trigger({ type: "select2-loaded", items: data });
})});
},
cancel: function () {
this.close();
},
blur: function () {
if (this.opts.selectOnBlur)
this.selectHighlighted({noFocus: true});
this.close();
this.container.removeClass("select2-container-active");
if (this.search[0] === document.activeElement) { this.search.blur(); }
this.clearSearch();
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
},
focusSearch: function () {
focus(this.search);
},
selectHighlighted: function (options) {
if (this._touchMoved) {
this.clearTouchMoved();
return;
}
var index=this.highlight(),
highlighted=this.results.find(".select2-highlighted"),
data = highlighted.closest('.select2-result').data("select2-data");
if (data) {
this.highlight(index);
this.onSelect(data, options);
} else if (options && options.noFocus) {
this.close();
}
},
getPlaceholder: function () {
var placeholderOption;
return this.opts.element.attr("placeholder") ||
this.opts.element.attr("data-placeholder") ||
this.opts.element.data("placeholder") ||
this.opts.placeholder ||
((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
},
getPlaceholderOption: function() {
if (this.select) {
var firstOption = this.select.children('option').first();
if (this.opts.placeholderOption !== undefined ) {
return (this.opts.placeholderOption === "first" && firstOption) ||
(typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
} else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
return firstOption;
}
}
},
initContainerWidth: function () {
function resolveContainerWidth() {
var style, attrs, matches, i, l, attr;
if (this.opts.width === "off") {
return null;
} else if (this.opts.width === "element"){
return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
} else if (this.opts.width === "copy" || this.opts.width === "resolve") {
style = this.opts.element.attr('style');
if (style !== undefined) {
attrs = style.split(';');
for (i = 0, l = attrs.length; i < l; i = i + 1) {
attr = attrs[i].replace(/\s/g, '');
matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);
if (matches !== null && matches.length >= 1)
return matches[1];
}
}
if (this.opts.width === "resolve") {
style = this.opts.element.css('width');
if (style.indexOf("%") > 0) return style;
return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
}
return null;
} else if ($.isFunction(this.opts.width)) {
return this.opts.width();
} else {
return this.opts.width;
}
};
var width = resolveContainerWidth.call(this);
if (width !== null) {
this.container.css("width", width);
}
}
});
SingleSelect2 = clazz(AbstractSelect2, {
createContainer: function () {
var container = $(document.createElement("div")).attr({
"class": "select2-container"
}).html([
"<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>",
"   <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>",
"   <span class='select2-arrow' aria-hidden='true'><b></b></span>",
"</a>",
"<input class='select2-focusser select2-offscreen' type='text' role='combobox' />",
"<div class='select2-drop select2-display-none'>",
"   <div class='select2-search'>",
"       <label for='' class='select2-offscreen'></label>",
"       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'",
"       aria-autocomplete='list' />",
"   </div>",
"   <ul class='select2-results' role='listbox'>",
"   </ul>",
"</div>"].join(""));
return container;
},
enableInterface: function() {
if (this.parent.enableInterface.apply(this, arguments)) {
this.focusser.prop("disabled", !this.isInterfaceEnabled());
}
},
opening: function () {
var el, range, len;
if (this.opts.minimumResultsForSearch >= 0) {
this.showSearch(true);
}
this.parent.opening.apply(this, arguments);
if (this.showSearchInput !== false) {
this.search.val(this.focusser.val());
}
if (this.opts.shouldFocusInput(this)) {
this.search.focus();
el = this.search.get(0);
if (el.createTextRange) {
range = el.createTextRange();
range.collapse(false);
range.select();
} else if (el.setSelectionRange) {
len = this.search.val().length;
el.setSelectionRange(len, len);
}
}
if(this.search.val() === "") {
if(this.nextSearchTerm != undefined){
this.search.val(this.nextSearchTerm);
this.search.select();
}
}
this.focusser.prop("disabled", true).val("");
this.updateResults(true);
this.opts.element.trigger($.Event("select2-open"));
},
close: function () {
if (!this.opened()) return;
this.parent.close.apply(this, arguments);
this.focusser.prop("disabled", false);
if (this.opts.shouldFocusInput(this)) {
this.focusser.focus();
}
},
focus: function () {
if (this.opened()) {
this.close();
} else {
this.focusser.prop("disabled", false);
if (this.opts.shouldFocusInput(this)) {
this.focusser.focus();
}
}
},
isFocused: function () {
return this.container.hasClass("select2-container-active");
},
cancel: function () {
this.parent.cancel.apply(this, arguments);
this.focusser.prop("disabled", false);
if (this.opts.shouldFocusInput(this)) {
this.focusser.focus();
}
},
destroy: function() {
$("label[for='" + this.focusser.attr('id') + "']")
.attr('for', this.opts.element.attr("id"));
this.parent.destroy.apply(this, arguments);
cleanupJQueryElements.call(this,
"selection",
"focusser"
);
},
initContainer: function () {
var selection,
container = this.container,
dropdown = this.dropdown,
idSuffix = nextUid(),
elementLabel;
if (this.opts.minimumResultsForSearch < 0) {
this.showSearch(false);
} else {
this.showSearch(true);
}
this.selection = selection = container.find(".select2-choice");
this.focusser = container.find(".select2-focusser");
selection.find(".select2-chosen").attr("id", "select2-chosen-"+idSuffix);
this.focusser.attr("aria-labelledby", "select2-chosen-"+idSuffix);
this.results.attr("id", "select2-results-"+idSuffix);
this.search.attr("aria-owns", "select2-results-"+idSuffix);
if (this.opts.element.attr('aria-required')) {
this.focusser.attr('aria-required', this.opts.element.attr('aria-required'));
}
this.focusser.attr("id", "s2id_autogen"+idSuffix);
this.originalLabel = $("label[for='" + this.opts.element.attr("id") + "']");
if (this.originalLabel.length) {
this.originalLabel.attr("for", this.focusser.attr('id'));
var id = this.originalLabel.attr("id") || this.focusser.attr('id') + "-label";
this.originalLabel.attr("id", id);
this.focusser.attr("aria-labelledby", this.focusser.attr("aria-labelledby") + " " + this.originalLabel.attr("id"));
}
var originalTitle = this.opts.element.attr("title");
this.opts.element.attr("title", (originalTitle || this.originalLabel.text()));
this.focusser.attr("tabindex", this.elementTabIndex);
this.search.attr("id", this.focusser.attr('id') + '_search');
this.search.prev()
.text($("label[for='" + this.focusser.attr('id') + "']").text())
.attr('for', this.search.attr('id'));
this.search.on("keydown", this.bind(function (e) {
if (!this.isInterfaceEnabled()) return;
if (229 == e.keyCode) return;
if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
killEvent(e);
return;
}
switch (e.which) {
case KEY.UP:
case KEY.DOWN:
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
killEvent(e);
return;
case KEY.ENTER:
this.selectHighlighted();
killEvent(e);
return;
case KEY.TAB:
this.selectHighlighted({noFocus: true});
return;
case KEY.ESC:
this.cancel(e);
killEvent(e);
return;
}
}));
this.search.on("blur", this.bind(function(e) {
if (document.activeElement === this.body.get(0)) {
window.setTimeout(this.bind(function() {
if (this.opened()) {
this.search.focus();
}
}), 0);
}
}));
this.focusser.on("keydown", this.bind(function (e) {
if (!this.isInterfaceEnabled()) return;
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
return;
}
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
killEvent(e);
return;
}
if (e.which == KEY.ENTER && this.opts.openOnEnter) {
if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
this.open();
killEvent(e);
return;
}
if (e.which == KEY.DELETE || e.which == KEY.BACKSPACE) {
if (this.opts.allowClear) {
this.clear();
}
killEvent(e);
return;
}
}));
installKeyUpChangeEvent(this.focusser);
this.focusser.on("keyup-change input", this.bind(function(e) {
if (this.opts.minimumResultsForSearch >= 0) {
e.stopPropagation();
if (this.opened()) return;
this.open();
}
}));
selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
if (!this.isInterfaceEnabled()) return;
this.clear();
killEventImmediately(e);
this.close();
this.selection.focus();
}));
selection.on("mousedown touchstart", this.bind(function (e) {
reinsertElement(selection);
if (!this.container.hasClass("select2-container-active")) {
this.opts.element.trigger($.Event("select2-focus"));
}
if (this.opened()) {
this.close();
} else if (this.isInterfaceEnabled()) {
this.open();
}
killEvent(e);
}));
dropdown.on("mousedown touchstart", this.bind(function() {
if (this.opts.shouldFocusInput(this)) {
this.search.focus();
}
}));
selection.on("focus", this.bind(function(e) {
killEvent(e);
}));
this.focusser.on("focus", this.bind(function(){
if (!this.container.hasClass("select2-container-active")) {
this.opts.element.trigger($.Event("select2-focus"));
}
this.container.addClass("select2-container-active");
})).on("blur", this.bind(function() {
if (!this.opened()) {
this.container.removeClass("select2-container-active");
this.opts.element.trigger($.Event("select2-blur"));
}
}));
this.search.on("focus", this.bind(function(){
if (!this.container.hasClass("select2-container-active")) {
this.opts.element.trigger($.Event("select2-focus"));
}
this.container.addClass("select2-container-active");
}));
this.initContainerWidth();
this.opts.element.addClass("select2-offscreen");
this.setPlaceholder();
},
clear: function(triggerChange) {
var data=this.selection.data("select2-data");
if (data) {
var evt = $.Event("select2-clearing");
this.opts.element.trigger(evt);
if (evt.isDefaultPrevented()) {
return;
}
var placeholderOption = this.getPlaceholderOption();
this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
this.selection.find(".select2-chosen").empty();
this.selection.removeData("select2-data");
this.setPlaceholder();
if (triggerChange !== false){
this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
this.triggerChange({removed:data});
}
}
},
initSelection: function () {
var selected;
if (this.isPlaceholderOptionSelected()) {
this.updateSelection(null);
this.close();
this.setPlaceholder();
} else {
var self = this;
this.opts.initSelection.call(null, this.opts.element, function(selected){
if (selected !== undefined && selected !== null) {
self.updateSelection(selected);
self.close();
self.setPlaceholder();
self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
}
});
}
},
isPlaceholderOptionSelected: function() {
var placeholderOption;
if (this.getPlaceholder() === undefined) return false;
return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.prop("selected"))
|| (this.opts.element.val() === "")
|| (this.opts.element.val() === undefined)
|| (this.opts.element.val() === null);
},
prepareOpts: function () {
var opts = this.parent.prepareOpts.apply(this, arguments),
self=this;
if (opts.element.get(0).tagName.toLowerCase() === "select") {
opts.initSelection = function (element, callback) {
var selected = element.find("option").filter(function() { return this.selected && !this.disabled });
callback(self.optionToData(selected));
};
} else if ("data" in opts) {
opts.initSelection = opts.initSelection || function (element, callback) {
var id = element.val();
var match = null;
opts.query({
matcher: function(term, text, el){
var is_match = equal(id, opts.id(el));
if (is_match) {
match = el;
}
return is_match;
},
callback: !$.isFunction(callback) ? $.noop : function() {
callback(match);
}
});
};
}
return opts;
},
getPlaceholder: function() {
if (this.select) {
if (this.getPlaceholderOption() === undefined) {
return undefined;
}
}
return this.parent.getPlaceholder.apply(this, arguments);
},
setPlaceholder: function () {
var placeholder = this.getPlaceholder();
if (this.isPlaceholderOptionSelected() && placeholder !== undefined) {
if (this.select && this.getPlaceholderOption() === undefined) return;
this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
this.selection.addClass("select2-default");
this.container.removeClass("select2-allowclear");
}
},
postprocessResults: function (data, initial, noHighlightUpdate) {
var selected = 0, self = this, showSearchInput = true;
this.findHighlightableChoices().each2(function (i, elm) {
if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
selected = i;
return false;
}
});
if (noHighlightUpdate !== false) {
if (initial === true && selected >= 0) {
this.highlight(selected);
} else {
this.highlight(0);
}
}
if (initial === true) {
var min = this.opts.minimumResultsForSearch;
if (min >= 0) {
this.showSearch(countResults(data.results) >= min);
}
}
},
showSearch: function(showSearchInput) {
if (this.showSearchInput === showSearchInput) return;
this.showSearchInput = showSearchInput;
this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !showSearchInput);
this.dropdown.find(".select2-search").toggleClass("select2-offscreen", !showSearchInput);
$(this.dropdown, this.container).toggleClass("select2-with-searchbox", showSearchInput);
},
onSelect: function (data, options) {
if (!this.triggerSelect(data)) { return; }
var old = this.opts.element.val(),
oldData = this.data();
this.opts.element.val(this.id(data));
this.updateSelection(data);
this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
this.close();
if ((!options || !options.noFocus) && this.opts.shouldFocusInput(this)) {
this.focusser.focus();
}
if (!equal(old, this.id(data))) {
this.triggerChange({ added: data, removed: oldData });
}
},
updateSelection: function (data) {
var container=this.selection.find(".select2-chosen"), formatted, cssClass;
this.selection.data("select2-data", data);
container.empty();
if (data !== null) {
formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
}
if (formatted !== undefined) {
container.append(formatted);
}
cssClass=this.opts.formatSelectionCssClass(data, container);
if (cssClass !== undefined) {
container.addClass(cssClass);
}
this.selection.removeClass("select2-default");
if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
this.container.addClass("select2-allowclear");
}
},
val: function () {
var val,
triggerChange = false,
data = null,
self = this,
oldData = this.data();
if (arguments.length === 0) {
return this.opts.element.val();
}
val = arguments[0];
if (arguments.length > 1) {
triggerChange = arguments[1];
}
if (this.select) {
this.select
.val(val)
.find("option").filter(function() { return this.selected }).each2(function (i, elm) {
data = self.optionToData(elm);
return false;
});
this.updateSelection(data);
this.setPlaceholder();
if (triggerChange) {
this.triggerChange({added: data, removed:oldData});
}
} else {
if (!val && val !== 0) {
this.clear(triggerChange);
return;
}
if (this.opts.initSelection === undefined) {
throw new Error("cannot call val() if initSelection() is not defined");
}
this.opts.element.val(val);
this.opts.initSelection(this.opts.element, function(data){
self.opts.element.val(!data ? "" : self.id(data));
self.updateSelection(data);
self.setPlaceholder();
if (triggerChange) {
self.triggerChange({added: data, removed:oldData});
}
});
}
},
clearSearch: function () {
this.search.val("");
this.focusser.val("");
},
data: function(value) {
var data,
triggerChange = false;
if (arguments.length === 0) {
data = this.selection.data("select2-data");
if (data == undefined) data = null;
return data;
} else {
if (arguments.length > 1) {
triggerChange = arguments[1];
}
if (!value) {
this.clear(triggerChange);
} else {
data = this.data();
this.opts.element.val(!value ? "" : this.id(value));
this.updateSelection(value);
if (triggerChange) {
this.triggerChange({added: value, removed:data});
}
}
}
}
});
MultiSelect2 = clazz(AbstractSelect2, {
createContainer: function () {
var container = $(document.createElement("div")).attr({
"class": "select2-container select2-container-multi"
}).html([
"<ul class='select2-choices' role='presentation'>",
"  <li class='select2-search-field'>",
"    <label for='' class='select2-offscreen'></label>",
"    <input type='text' role='combobox' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' aria-autocomplete='list' />",
"  </li>",
"</ul>",
"<div class='select2-drop select2-drop-multi select2-display-none'>",
"   <ul class='select2-results' role='listbox'>",
"   </ul>",
"</div>"].join(""));
return container;
},
prepareOpts: function () {
var opts = this.parent.prepareOpts.apply(this, arguments),
self=this;
if (opts.element.get(0).tagName.toLowerCase() === "select") {
opts.initSelection = function (element, callback) {
var data = [];
element.find("option").filter(function() { return this.selected && !this.disabled }).each2(function (i, elm) {
data.push(self.optionToData(elm));
});
callback(data);
};
} else if ("data" in opts) {
opts.initSelection = opts.initSelection || function (element, callback) {
var ids = splitVal(element.val(), opts.separator);
var matches = [];
opts.query({
matcher: function(term, text, el){
var is_match = $.grep(ids, function(id) {
return equal(id, opts.id(el));
}).length;
if (is_match) {
matches.push(el);
}
return is_match;
},
callback: !$.isFunction(callback) ? $.noop : function() {
var ordered = [];
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
for (var j = 0; j < matches.length; j++) {
var match = matches[j];
if (equal(id, opts.id(match))) {
ordered.push(match);
matches.splice(j, 1);
break;
}
}
}
callback(ordered);
}
});
};
}
return opts;
},
selectChoice: function (choice) {
var selected = this.container.find(".select2-search-choice-focus");
if (selected.length && choice && choice[0] == selected[0]) {
} else {
if (selected.length) {
this.opts.element.trigger("choice-deselected", selected);
}
selected.removeClass("select2-search-choice-focus");
if (choice && choice.length) {
this.close();
choice.addClass("select2-search-choice-focus");
this.opts.element.trigger("choice-selected", choice);
this.liveRegion.text(choice.text());
}
}
},
destroy: function() {
$("label[for='" + this.search.attr('id') + "']")
.attr('for', this.opts.element.attr("id"));
this.parent.destroy.apply(this, arguments);
cleanupJQueryElements.call(this,
"searchContainer",
"selection"
);
},
initContainer: function () {
var selector = ".select2-choices", selection;
this.searchContainer = this.container.find(".select2-search-field");
this.selection = selection = this.container.find(selector);
var _this = this;
this.selection.on("click", ".select2-search-choice:not(.select2-locked)", function (e) {
_this.search[0].focus();
_this.selectChoice($(this));
});
this.search.attr("id", "s2id_autogen"+nextUid());
this.results.attr("id", this.search.attr("id") + '_results');
this.search.attr("aria-owns", this.results.attr("id"));
this.originalLabel = $("label[for='" + this.opts.element.attr("id") + "']");
if (this.originalLabel.length) {
this.originalLabel.attr("for", this.search.attr('id'));
}
if (this.opts.element.attr('aria-required')) {
this.search.attr('aria-required', this.opts.element.attr('aria-required'));
}
this.search.on("input paste", this.bind(function() {
if (this.search.attr('placeholder') && this.search.val().length == 0) return;
if (!this.isInterfaceEnabled()) return;
if (!this.opened()) {
this.open();
}
}));
this.search.attr("tabindex", this.elementTabIndex);
this.keydowns = 0;
this.search.on("keydown", this.bind(function (e) {
if (!this.isInterfaceEnabled()) return;
++this.keydowns;
var selected = selection.find(".select2-search-choice-focus");
var prev = selected.prev(".select2-search-choice:not(.select2-locked)");
var next = selected.next(".select2-search-choice:not(.select2-locked)");
var pos = getCursorInfo(this.search);
if (selected.length &&
(e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
var selectedChoice = selected;
if (e.which == KEY.LEFT && prev.length) {
selectedChoice = prev;
}
else if (e.which == KEY.RIGHT) {
selectedChoice = next.length ? next : null;
}
else if (e.which === KEY.BACKSPACE) {
if (this.unselect(selected.first())) {
this.search.width(10);
selectedChoice = prev.length ? prev : next;
}
} else if (e.which == KEY.DELETE) {
if (this.unselect(selected.first())) {
this.search.width(10);
selectedChoice = next.length ? next : null;
}
} else if (e.which == KEY.ENTER) {
selectedChoice = null;
}
this.selectChoice(selectedChoice);
killEvent(e);
if (!selectedChoice || !selectedChoice.length) {
this.open();
}
return;
} else if (((e.which === KEY.BACKSPACE && this.keydowns == 1)
|| e.which == KEY.LEFT) && (pos.offset == 0 && !pos.length)) {
this.selectChoice(selection.find(".select2-search-choice:not(.select2-locked)").last());
killEvent(e);
return;
} else {
this.selectChoice(null);
}
if (this.opened()) {
switch (e.which) {
case KEY.UP:
case KEY.DOWN:
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
killEvent(e);
return;
case KEY.ENTER:
this.selectHighlighted();
killEvent(e);
return;
case KEY.TAB:
this.selectHighlighted({noFocus:true});
this.close();
return;
case KEY.ESC:
this.cancel(e);
killEvent(e);
return;
}
}
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|| e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
return;
}
if (e.which === KEY.ENTER) {
if (this.opts.openOnEnter === false) {
return;
} else if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
return;
}
}
this.open();
if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
killEvent(e);
}
if (e.which === KEY.ENTER) {
killEvent(e);
}
}));
this.search.on("keyup", this.bind(function (e) {
this.keydowns = 0;
this.resizeSearch();
})
);
this.search.on("blur", this.bind(function(e) {
this.container.removeClass("select2-container-active");
this.search.removeClass("select2-focused");
this.selectChoice(null);
if (!this.opened()) this.clearSearch();
e.stopImmediatePropagation();
this.opts.element.trigger($.Event("select2-blur"));
}));
this.container.on("click", selector, this.bind(function (e) {
if (!this.isInterfaceEnabled()) return;
if ($(e.target).closest(".select2-search-choice").length > 0) {
return;
}
this.selectChoice(null);
this.clearPlaceholder();
if (!this.container.hasClass("select2-container-active")) {
this.opts.element.trigger($.Event("select2-focus"));
}
this.open();
this.focusSearch();
e.preventDefault();
}));
this.container.on("focus", selector, this.bind(function () {
if (!this.isInterfaceEnabled()) return;
if (!this.container.hasClass("select2-container-active")) {
this.opts.element.trigger($.Event("select2-focus"));
}
this.container.addClass("select2-container-active");
this.dropdown.addClass("select2-drop-active");
this.clearPlaceholder();
}));
this.initContainerWidth();
this.opts.element.addClass("select2-offscreen");
this.clearSearch();
},
enableInterface: function() {
if (this.parent.enableInterface.apply(this, arguments)) {
this.search.prop("disabled", !this.isInterfaceEnabled());
}
},
initSelection: function () {
var data;
if (this.opts.element.val() === "" && this.opts.element.text() === "") {
this.updateSelection([]);
this.close();
this.clearSearch();
}
if (this.select || this.opts.element.val() !== "") {
var self = this;
this.opts.initSelection.call(null, this.opts.element, function(data){
if (data !== undefined && data !== null) {
self.updateSelection(data);
self.close();
self.clearSearch();
}
});
}
},
clearSearch: function () {
var placeholder = this.getPlaceholder(),
maxWidth = this.getMaxSearchWidth();
if (placeholder !== undefined  && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
this.search.val(placeholder).addClass("select2-default");
this.search.width(maxWidth > 0 ? maxWidth : this.container.css("width"));
} else {
this.search.val("").width(10);
}
},
clearPlaceholder: function () {
if (this.search.hasClass("select2-default")) {
this.search.val("").removeClass("select2-default");
}
},
opening: function () {
this.clearPlaceholder();
this.resizeSearch();
this.parent.opening.apply(this, arguments);
this.focusSearch();
if(this.search.val() === "") {
if(this.nextSearchTerm != undefined){
this.search.val(this.nextSearchTerm);
this.search.select();
}
}
this.updateResults(true);
if (this.opts.shouldFocusInput(this)) {
this.search.focus();
}
this.opts.element.trigger($.Event("select2-open"));
},
close: function () {
if (!this.opened()) return;
this.parent.close.apply(this, arguments);
},
focus: function () {
this.close();
this.search.focus();
},
isFocused: function () {
return this.search.hasClass("select2-focused");
},
updateSelection: function (data) {
var ids = [], filtered = [], self = this;
$(data).each(function () {
if (indexOf(self.id(this), ids) < 0) {
ids.push(self.id(this));
filtered.push(this);
}
});
data = filtered;
this.selection.find(".select2-search-choice").remove();
var val = this.getVal();
$(data).each(function () {
self.addSelectedChoice(this);
val.push(self.id(this));
});
this.setVal(val);
self.postprocessResults();
},
tokenize: function() {
var input = this.search.val();
input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
if (input != null && input != undefined) {
this.search.val(input);
if (input.length > 0) {
this.open();
}
}
},
onSelect: function (data, options) {
if (!this.triggerSelect(data) || data.text === "") { return; }
var val = this.getVal();
this.addSelectedChoice(data);
val.push(this.id(data));
this.setVal(val);
this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
this.clearSearch();
this.updateResults();
var describedString = this.getVal().map(function(val) {
return this.search.attr('id') + "_choice_" + val;
}, this).join(" ");
this.search.attr("aria-describedby", describedString);
if (this.select || !this.opts.closeOnSelect) this.postprocessResults(data, false, this.opts.closeOnSelect===true);
if (this.opts.closeOnSelect) {
this.close();
this.search.width(10);
} else {
if (this.countSelectableResults()>0) {
this.search.width(10);
this.resizeSearch();
if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
this.updateResults(true);
} else {
if(this.nextSearchTerm != undefined){
this.search.val(this.nextSearchTerm);
this.updateResults();
this.search.select();
}
}
this.positionDropdown();
} else {
this.close();
this.search.width(10);
}
}
this.triggerChange({ added: data });
if (!options || !options.noFocus)
this.focusSearch();
},
cancel: function () {
this.close();
this.focusSearch();
},
addSelectedChoice: function (data) {
var enableChoice = !data.locked,
enabledItem = $(
"<li class='select2-search-choice'>" +
"    <div></div>" +
"    <a href='#' role='button' class='select2-search-choice-close' tabindex='-1'></a>" +
"</li>"),
disabledItem = $(
"<li class='select2-search-choice select2-locked'>" +
"<div></div>" +
"</li>");
var choice = enableChoice ? enabledItem : disabledItem,
id = this.id(data),
formatted,
cssClass;
choice.attr("id", this.search.attr('id') + "_choice_" + id);
formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
if (formatted != undefined) {
choice.find("div").replaceWith("<div>"+formatted+"</div>");
}
cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
if (cssClass != undefined) {
choice.addClass(cssClass);
}
if(enableChoice){
choice.find(".select2-search-choice-close")
.on("mousedown", killEvent)
.on("click dblclick", this.bind(function (e) {
if (!this.isInterfaceEnabled()) return;
this.unselect($(e.target));
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
killEvent(e);
this.close();
this.focusSearch();
})).on("focus", this.bind(function () {
if (!this.isInterfaceEnabled()) return;
this.container.addClass("select2-container-active");
this.dropdown.addClass("select2-drop-active");
}));
}
choice.data("select2-data", data);
choice.insertBefore(this.searchContainer);
},
unselect: function (selected) {
var val = this.getVal(),
data,
index;
selected = selected.closest(".select2-search-choice");
if (selected.length === 0) {
throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
}
data = selected.data("select2-data");
if (!data) {
return;
}
var evt = $.Event("select2-removing");
evt.val = this.id(data);
evt.choice = data;
this.opts.element.trigger(evt);
if (evt.isDefaultPrevented()) {
return false;
}
while((index = indexOf(this.id(data), val)) >= 0) {
val.splice(index, 1);
this.setVal(val);
if (this.select) this.postprocessResults();
}
selected.remove();
this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
this.triggerChange({ removed: data });
return true;
},
postprocessResults: function (data, initial, noHighlightUpdate) {
var val = this.getVal(),
choices = this.results.find(".select2-result"),
compound = this.results.find(".select2-result-with-children"),
self = this;
choices.each2(function (i, choice) {
var id = self.id(choice.data("select2-data"));
if (indexOf(id, val) >= 0) {
choice.addClass("select2-selected");
choice.find(".select2-result-selectable").addClass("select2-selected");
}
});
compound.each2(function(i, choice) {
if (!choice.is('.select2-result-selectable')
&& choice.find(".select2-result-selectable:not(.select2-selected)").length === 0) {
choice.addClass("select2-selected");
}
});
if (this.highlight() == -1 && noHighlightUpdate !== false){
self.highlight(0);
}
if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
this.results.append("<li class='select2-no-results'>" + evaluate(self.opts.formatNoMatches, self.opts.element, self.search.val()) + "</li>");
}
}
}
},
getMaxSearchWidth: function() {
return this.selection.width() - getSideBorderPadding(this.search);
},
resizeSearch: function () {
var minimumWidth, left, maxWidth, containerLeft, searchWidth,
sideBorderPadding = getSideBorderPadding(this.search);
minimumWidth = measureTextWidth(this.search) + 10;
left = this.search.offset().left;
maxWidth = this.selection.width();
containerLeft = this.selection.offset().left;
searchWidth = maxWidth - (left - containerLeft) - sideBorderPadding;
if (searchWidth < minimumWidth) {
searchWidth = maxWidth - sideBorderPadding;
}
if (searchWidth < 40) {
searchWidth = maxWidth - sideBorderPadding;
}
if (searchWidth <= 0) {
searchWidth = minimumWidth;
}
this.search.width(Math.floor(searchWidth));
},
getVal: function () {
var val;
if (this.select) {
val = this.select.val();
return val === null ? [] : val;
} else {
val = this.opts.element.val();
return splitVal(val, this.opts.separator);
}
},
setVal: function (val) {
var unique;
if (this.select) {
this.select.val(val);
} else {
unique = [];
$(val).each(function () {
if (indexOf(this, unique) < 0) unique.push(this);
});
this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
}
},
buildChangeDetails: function (old, current) {
var current = current.slice(0),
old = old.slice(0);
for (var i = 0; i < current.length; i++) {
for (var j = 0; j < old.length; j++) {
if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
current.splice(i, 1);
if(i>0){
i--;
}
old.splice(j, 1);
j--;
}
}
}
return {added: current, removed: old};
},
val: function (val, triggerChange) {
var oldData, self=this;
if (arguments.length === 0) {
return this.getVal();
}
oldData=this.data();
if (!oldData.length) oldData=[];
if (!val && val !== 0) {
this.opts.element.val("");
this.updateSelection([]);
this.clearSearch();
if (triggerChange) {
this.triggerChange({added: this.data(), removed: oldData});
}
return;
}
this.setVal(val);
if (this.select) {
this.opts.initSelection(this.select, this.bind(this.updateSelection));
if (triggerChange) {
this.triggerChange(this.buildChangeDetails(oldData, this.data()));
}
} else {
if (this.opts.initSelection === undefined) {
throw new Error("val() cannot be called if initSelection() is not defined");
}
this.opts.initSelection(this.opts.element, function(data){
var ids=$.map(data, self.id);
self.setVal(ids);
self.updateSelection(data);
self.clearSearch();
if (triggerChange) {
self.triggerChange(self.buildChangeDetails(oldData, self.data()));
}
});
}
this.clearSearch();
},
onSortStart: function() {
if (this.select) {
throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
}
this.search.width(0);
this.searchContainer.hide();
},
onSortEnd:function() {
var val=[], self=this;
this.searchContainer.show();
this.searchContainer.appendTo(this.searchContainer.parent());
this.resizeSearch();
this.selection.find(".select2-search-choice").each(function() {
val.push(self.opts.id($(this).data("select2-data")));
});
this.setVal(val);
this.triggerChange();
},
data: function(values, triggerChange) {
var self=this, ids, old;
if (arguments.length === 0) {
return this.selection
.children(".select2-search-choice")
.map(function() { return $(this).data("select2-data"); })
.get();
} else {
old = this.data();
if (!values) { values = []; }
ids = $.map(values, function(e) { return self.opts.id(e); });
this.setVal(ids);
this.updateSelection(values);
this.clearSearch();
if (triggerChange) {
this.triggerChange(this.buildChangeDetails(old, this.data()));
}
}
}
});
$.fn.select2 = function () {
var args = Array.prototype.slice.call(arguments, 0),
opts,
select2,
method, value, multiple,
allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
valueMethods = ["opened", "isFocused", "container", "dropdown"],
propertyMethods = ["val", "data"],
methodsMap = { search: "externalSearch" };
this.each(function () {
if (args.length === 0 || typeof(args[0]) === "object") {
opts = args.length === 0 ? {} : $.extend({}, args[0]);
opts.element = $(this);
if (opts.element.get(0).tagName.toLowerCase() === "select") {
multiple = opts.element.prop("multiple");
} else {
multiple = opts.multiple || false;
if ("tags" in opts) {opts.multiple = multiple = true;}
}
select2 = multiple ? new window.Select2["class"].multi() : new window.Select2["class"].single();
select2.init(opts);
} else if (typeof(args[0]) === "string") {
if (indexOf(args[0], allowedMethods) < 0) {
throw "Unknown method: " + args[0];
}
value = undefined;
select2 = $(this).data("select2");
if (select2 === undefined) return;
method=args[0];
if (method === "container") {
value = select2.container;
} else if (method === "dropdown") {
value = select2.dropdown;
} else {
if (methodsMap[method]) method = methodsMap[method];
value = select2[method].apply(select2, args.slice(1));
}
if (indexOf(args[0], valueMethods) >= 0
|| (indexOf(args[0], propertyMethods) >= 0 && args.length == 1)) {
return false;
}
} else {
throw "Invalid arguments to select2 plugin: " + args;
}
});
return (value === undefined) ? this : value;
};
$.fn.select2.defaults = {
width: "copy",
loadMorePadding: 0,
closeOnSelect: true,
openOnEnter: true,
containerCss: {},
dropdownCss: {},
containerCssClass: "",
dropdownCssClass: "",
formatResult: function(result, container, query, escapeMarkup) {
var markup=[];
markMatch(result.text, query.term, markup, escapeMarkup);
return markup.join("");
},
formatSelection: function (data, container, escapeMarkup) {
return data ? escapeMarkup(data.text) : undefined;
},
sortResults: function (results, container, query) {
return results;
},
formatResultCssClass: function(data) {return data.css;},
formatSelectionCssClass: function(data, container) {return undefined;},
minimumResultsForSearch: 0,
minimumInputLength: 0,
maximumInputLength: null,
maximumSelectionSize: 0,
id: function (e) { return e == undefined ? null : e.id; },
matcher: function(term, text) {
return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
},
separator: ",",
tokenSeparators: [],
tokenizer: defaultTokenizer,
escapeMarkup: defaultEscapeMarkup,
blurOnChange: false,
selectOnBlur: false,
adaptContainerCssClass: function(c) { return c; },
adaptDropdownCssClass: function(c) { return null; },
nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
searchInputPlaceholder: '',
createSearchChoicePosition: 'top',
shouldFocusInput: function (instance) {
var supportsTouchEvents = (('ontouchstart' in window) ||
(navigator.msMaxTouchPoints > 0));
if (!supportsTouchEvents) {
return true;
}
if (instance.opts.minimumResultsForSearch < 0) {
return false;
}
return true;
}
};
$.fn.select2.locales = [];
$.fn.select2.locales['en'] = {
formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; },
formatNoMatches: function () { return "No matches found"; },
formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; },
formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); },
formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
formatLoadMore: function (pageNumber) { return "Loading more results…"; },
formatSearching: function () { return "Searching…"; },
};
$.extend($.fn.select2.defaults, $.fn.select2.locales['en']);
$.fn.select2.ajaxDefaults = {
transport: $.ajax,
params: {
type: "GET",
cache: false,
dataType: "json"
}
};
window.Select2 = {
query: {
ajax: ajax,
local: local,
tags: tags
}, util: {
debounce: debounce,
markMatch: markMatch,
escapeMarkup: defaultEscapeMarkup,
stripDiacritics: stripDiacritics
}, "class": {
"abstract": AbstractSelect2,
"single": SingleSelect2,
"multi": MultiSelect2
}
};
}(jQuery));
;
/*! RESOURCE: /scripts/libs/select2wrapper.js */
(function() {
if (window.Select2 !== undefined) {
var initSelect2 = window.Select2.class.abstract.prototype.init;
var searchingMsg = '';
angular.element(document).ready(function () {
var i18n = angular.element('*[ng-app]').injector().get('i18n');
searchingMsg = i18n.getMessage('Searching...');
});
window.Select2.class.single.prototype.init = function(opts) {
var self = this;
initSelect2.call(this, opts);
this.opts.element.attr("aria-hidden", "true");
this.selection.off('touchstart');
this.opts.element.on('$destroy', function() {
self.opts.element.select2('destroy');
});
this.opts.element.on('select2-open', function() {
if (!self.dropdown)
return;
var ddInput = self.dropdown.find('input');
var acVal = ddInput.attr('aria-activedescendant');
var lrText = self.liveRegion.text();
if (lrText !== searchingMsg)
self.liveRegion.text('');
ddInput.removeAttr('aria-activedescendant');
setTimeout(function() {
ddInput.attr('aria-activedescendant', acVal);
if (lrText !== searchingMsg)
self.liveRegion.text(lrText);
}, 500);
});
this.opts.element.on('select2-close', function() {
if (!self.dropdown)
return;
var ddInput = self.dropdown.find('input');
ddInput.removeAttr('aria-activedescendant');
});
}
var highlightSelect2 = window.Select2.class.abstract.prototype.highlight;
window.Select2.class.single.prototype.highlight = window.Select2.class.multi.prototype.highlight = highlightWrapper;
}
function highlightWrapper(index) {
if (typeof index !== "undefined")
highlightSelect2.call(this, index);
else
return highlightSelect2.call(this);
this.liveRegion.text('');
}
}())
;
/*! RESOURCE: /scripts/sp.geo.js */
function spLoadMaps(api_key) {
if (typeof g_google_maps_api_loaded == "undefined") {
spLoadScript("https://maps.googleapis.com/maps/api/js?key=" + api_key + "&v=3.exp&callback=initMap");
g_google_maps_api_loaded = true;
} else
CustomEvent.fireAll('map.initialized');
}
function spLoadScript(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.body.appendChild(script);
}
function initMap() {
CustomEvent.fireAll('map.initialized');
}
;
/*! RESOURCE: /scripts/bootstrap-datetimepicker.js */
;(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery', 'moment'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'), require('moment'));
}
else {
if (!jQuery) {
throw new Error('bootstrap-datetimepicker requires jQuery to be loaded first');
}
if (!moment) {
throw new Error('bootstrap-datetimepicker requires moment.js to be loaded first');
}
factory(root.jQuery, moment);
}
}(this, function ($, moment) {
'use strict';
if (typeof moment === 'undefined') {
throw new Error('momentjs is required');
}
var dpgId = 0,
DateTimePicker = function (element, options) {
var defaults = $.fn.datetimepicker.defaults,
icons = {
time: 'glyphicon glyphicon-time',
date: 'glyphicon glyphicon-calendar',
up: 'glyphicon glyphicon-chevron-up',
down: 'glyphicon glyphicon-chevron-down'
},
picker = this,
errored = false,
dDate,
init = function () {
var icon = false, localeData, rInterval;
picker.options = $.extend({}, defaults, options);
picker.options.icons = $.extend({}, icons, picker.options.icons);
picker.element = $(element);
dataToOptions();
if (!(picker.options.pickTime || picker.options.pickDate)) {
throw new Error('Must choose at least one picker');
}
picker.id = dpgId++;
moment.locale(picker.options.language);
picker.date = moment();
picker.unset = false;
picker.isInput = picker.element.is('input');
picker.component = false;
if (picker.element.hasClass('input-group')) {
if (picker.element.find('.datepickerbutton').size() === 0) {
picker.component = picker.element.find('[class^="input-group-"]');
}
else {
picker.component = picker.element.find('.datepickerbutton');
}
}
picker.format = picker.options.format;
localeData = moment().localeData();
if (!picker.format) {
picker.format = (picker.options.pickDate ? localeData.longDateFormat('L') : '');
if (picker.options.pickDate && picker.options.pickTime) {
picker.format += ' ';
}
picker.format += (picker.options.pickTime ? localeData.longDateFormat('LT') : '');
if (picker.options.useSeconds) {
if (localeData.longDateFormat('LT').indexOf(' A') !== -1) {
picker.format = picker.format.split(' A')[0] + ':ss A';
}
else {
picker.format += ':ss';
}
}
}
picker.use24hours = (picker.format.toLowerCase().indexOf('a') < 0 && picker.format.indexOf('h') < 0);
if (picker.component) {
icon = picker.component.find('span');
}
if (picker.options.pickTime) {
if (icon) {
icon.addClass(picker.options.icons.time);
}
}
if (picker.options.pickDate) {
if (icon) {
icon.removeClass(picker.options.icons.time);
icon.addClass(picker.options.icons.date);
}
}
picker.options.widgetParent =
typeof picker.options.widgetParent === 'string' && picker.options.widgetParent ||
picker.element.parents().filter(function () {
return 'scroll' === $(this).css('overflow-y');
}).get(0) ||
'body';
picker.widget = $(getTemplate()).appendTo(picker.options.widgetParent);
picker.minViewMode = picker.options.minViewMode || 0;
if (typeof picker.minViewMode === 'string') {
switch (picker.minViewMode) {
case 'months':
picker.minViewMode = 1;
break;
case 'years':
picker.minViewMode = 2;
break;
default:
picker.minViewMode = 0;
break;
}
}
picker.viewMode = picker.options.viewMode || 0;
if (typeof picker.viewMode === 'string') {
switch (picker.viewMode) {
case 'months':
picker.viewMode = 1;
break;
case 'years':
picker.viewMode = 2;
break;
default:
picker.viewMode = 0;
break;
}
}
picker.viewMode = Math.max(picker.viewMode, picker.minViewMode);
picker.options.disabledDates = indexGivenDates(picker.options.disabledDates);
picker.options.enabledDates = indexGivenDates(picker.options.enabledDates);
picker.startViewMode = picker.viewMode;
picker.setMinDate(picker.options.minDate);
picker.setMaxDate(picker.options.maxDate);
fillDow();
fillMonths();
fillHours();
fillMinutes();
fillSeconds();
update();
showMode();
if (!getPickerInput().prop('disabled')) {
attachDatePickerEvents();
}
if (picker.options.defaultDate !== '' && getPickerInput().val() === '') {
picker.setValue(picker.options.defaultDate);
}
if (picker.options.minuteStepping !== 1) {
rInterval = picker.options.minuteStepping;
picker.date.minutes((Math.round(picker.date.minutes() / rInterval) * rInterval) % 60).seconds(0);
}
},
getPickerInput = function () {
var input;
if (picker.isInput) {
return picker.element;
}
input = picker.element.find('.datepickerinput');
if (input.size() === 0) {
input = picker.element.find('input');
}
else if (!input.is('input')) {
throw new Error('CSS class "datepickerinput" cannot be applied to non input element');
}
return input;
},
dataToOptions = function () {
var eData;
if (picker.element.is('input')) {
eData = picker.element.data();
}
else {
eData = picker.element.find('input').data();
}
if (eData.dateFormat !== undefined) {
picker.options.format = eData.dateFormat;
}
if (eData.datePickdate !== undefined) {
picker.options.pickDate = eData.datePickdate;
}
if (eData.datePicktime !== undefined) {
picker.options.pickTime = eData.datePicktime;
}
if (eData.dateUseminutes !== undefined) {
picker.options.useMinutes = eData.dateUseminutes;
}
if (eData.dateUseseconds !== undefined) {
picker.options.useSeconds = eData.dateUseseconds;
}
if (eData.dateUsecurrent !== undefined) {
picker.options.useCurrent = eData.dateUsecurrent;
}
if (eData.calendarWeeks !== undefined) {
picker.options.calendarWeeks = eData.calendarWeeks;
}
if (eData.dateMinutestepping !== undefined) {
picker.options.minuteStepping = eData.dateMinutestepping;
}
if (eData.dateMindate !== undefined) {
picker.options.minDate = eData.dateMindate;
}
if (eData.dateMaxdate !== undefined) {
picker.options.maxDate = eData.dateMaxdate;
}
if (eData.dateShowtoday !== undefined) {
picker.options.showToday = eData.dateShowtoday;
}
if (eData.dateCollapse !== undefined) {
picker.options.collapse = eData.dateCollapse;
}
if (eData.dateLanguage !== undefined) {
picker.options.language = eData.dateLanguage;
}
if (eData.dateDefaultdate !== undefined) {
picker.options.defaultDate = eData.dateDefaultdate;
}
if (eData.dateDisableddates !== undefined) {
picker.options.disabledDates = eData.dateDisableddates;
}
if (eData.dateEnableddates !== undefined) {
picker.options.enabledDates = eData.dateEnableddates;
}
if (eData.dateIcons !== undefined) {
picker.options.icons = eData.dateIcons;
}
if (eData.dateUsestrict !== undefined) {
picker.options.useStrict = eData.dateUsestrict;
}
if (eData.dateDirection !== undefined) {
picker.options.direction = eData.dateDirection;
}
if (eData.dateSidebyside !== undefined) {
picker.options.sideBySide = eData.dateSidebyside;
}
if (eData.dateDaysofweekdisabled !== undefined) {
picker.options.daysOfWeekDisabled = eData.dateDaysofweekdisabled;
}
},
place = function () {
var position = 'fixed',
offset = picker.component ? picker.component.offset() : picker.element.offset(),
$window = $(window),
placePosition;
picker.width = picker.component ? picker.component.outerWidth() : picker.element.outerWidth();
offset.top = offset.top + picker.element.outerHeight();
if (picker.options.direction === 'up') {
placePosition = 'top';
} else if (picker.options.direction === 'bottom') {
placePosition = 'bottom';
} else if (picker.options.direction === 'auto') {
if (offset.top + picker.widget.height() > $window.height() + $window.scrollTop() && picker.widget.height() + picker.element.outerHeight() < offset.top) {
placePosition = 'top';
} else {
placePosition = 'bottom';
}
}
if (placePosition === 'top') {
offset.top = offset.top - picker.element.outerHeight() - picker.widget.height() - 13;
picker.widget.addClass('top').removeClass('bottom');
} else {
offset.top += 1;
picker.widget.addClass('bottom').removeClass('top');
}
if (picker.options.width !== undefined) {
picker.widget.width(picker.options.width);
}
if (picker.options.orientation === 'left') {
picker.widget.addClass('left-oriented');
offset.left = offset.left - picker.widget.width() + 20;
}
if (isInFixed()) {
position = 'fixed';
offset.top -= $window.scrollTop();
offset.left -= $window.scrollLeft();
}
if ($window.width() < offset.left + picker.widget.outerWidth()) {
offset.right = $window.width() - offset.left - picker.width;
offset.left = 'auto';
picker.widget.addClass('pull-right');
} else {
offset.right = 'auto';
picker.widget.removeClass('pull-right');
}
if (placePosition === 'top') {
picker.widget.css({
position: position,
bottom: 'auto',
top: offset.top,
left: offset.left,
right: offset.right
});
} else {
picker.widget.css({
position: position,
top: offset.top,
bottom: 'auto',
left: offset.left,
right: offset.right
});
}
},
notifyChange = function (oldDate, eventType) {
if (moment(picker.date).isSame(moment(oldDate)) && !errored) {
return;
}
errored = false;
picker.element.trigger({
type: 'dp.change',
date: moment(picker.date),
oldDate: moment(oldDate)
});
if (eventType !== 'change') {
picker.element.change();
}
},
notifyError = function (date) {
errored = true;
picker.element.trigger({
type: 'dp.error',
date: moment(date, picker.format, picker.options.useStrict)
});
},
update = function (newDate) {
moment.locale(picker.options.language);
var dateStr = newDate;
if (!dateStr) {
dateStr = getPickerInput().val();
if (dateStr) {
picker.date = moment(dateStr, picker.format, picker.options.useStrict);
}
if (!picker.date) {
picker.date = moment();
}
}
picker.viewDate = moment(picker.date).startOf('month');
fillDate();
fillTime();
},
fillDow = function () {
moment.locale(picker.options.language);
var html = $('<tr>'), weekdaysMin = moment.weekdaysMin(), i, j,
startOfWeek = moment().localeData()._week.dow;
if (picker.options.calendarWeeks === true) {
html.append('<th class="cw">#</th>');
}
for (i = 0; i < 7; i++) {
j = (startOfWeek + i) % 7;
html.append('<th class="dow">' + weekdaysMin[j] + '</th>');
}
picker.widget.find('.datepicker-days thead').append(html);
},
fillMonths = function () {
moment.locale(picker.options.language);
var html = '', i, monthsShort = moment.monthsShort();
for (i = 0; i < 12; i++) {
html += '<span class="month">' + monthsShort[i] + '</span>';
}
picker.widget.find('.datepicker-months td').append(html);
},
fillDate = function () {
if (!picker.options.pickDate) {
return;
}
moment.locale(picker.options.language);
var year = picker.viewDate.year(),
month = picker.viewDate.month(),
startYear = picker.options.minDate.year(),
startMonth = picker.options.minDate.month(),
endYear = picker.options.maxDate.year(),
endMonth = picker.options.maxDate.month(),
currentDate,
prevMonth, nextMonth, html = [], row, clsName, i, days, yearCont, currentYear, months = moment.months();
picker.widget.find('.datepicker-days').find('.disabled').removeClass('disabled');
picker.widget.find('.datepicker-months').find('.disabled').removeClass('disabled');
picker.widget.find('.datepicker-years').find('.disabled').removeClass('disabled');
picker.widget.find('.datepicker-days th:eq(1)').text(
months[month] + ' ' + year);
prevMonth = moment(picker.viewDate, picker.format, picker.options.useStrict).subtract(1, 'months');
days = prevMonth.daysInMonth();
prevMonth.date(days).startOf('week');
if ((year === startYear && month <= startMonth) || year < startYear) {
picker.widget.find('.datepicker-days th:eq(0)').addClass('disabled');
}
if ((year === endYear && month >= endMonth) || year > endYear) {
picker.widget.find('.datepicker-days th:eq(2)').addClass('disabled');
}
nextMonth = moment(prevMonth).add(42, 'd');
while (prevMonth.isBefore(nextMonth)) {
if (prevMonth.weekday() === moment().startOf('week').weekday()) {
row = $('<tr>');
html.push(row);
if (picker.options.calendarWeeks === true) {
row.append('<td class="cw">' + prevMonth.week() + '</td>');
}
}
clsName = '';
if (prevMonth.year() < year || (prevMonth.year() === year && prevMonth.month() < month)) {
clsName += ' old';
} else if (prevMonth.year() > year || (prevMonth.year() === year && prevMonth.month() > month)) {
clsName += ' new';
}
if (prevMonth.isSame(moment({y: picker.date.year(), M: picker.date.month(), d: picker.date.date()}))) {
clsName += ' active';
}
if (isInDisableDates(prevMonth, 'day') || !isInEnableDates(prevMonth)) {
clsName += ' disabled';
}
if (picker.options.showToday === true) {
if (prevMonth.isSame(moment(), 'day')) {
clsName += ' today';
}
}
if (picker.options.daysOfWeekDisabled) {
for (i = 0; i < picker.options.daysOfWeekDisabled.length; i++) {
if (prevMonth.day() === picker.options.daysOfWeekDisabled[i]) {
clsName += ' disabled';
break;
}
}
}
row.append('<td class="day' + clsName + '"><div role="button" tabindex="-1">' + prevMonth.date() + '</div></td>');
currentDate = prevMonth.date();
prevMonth.add(1, 'd');
if (currentDate === prevMonth.date()) {
prevMonth.add(1, 'd');
}
}
picker.widget.find('.datepicker-days tbody').empty().append(html);
currentYear = picker.date.year();
months = picker.widget.find('.datepicker-months').find('th:eq(1)').text(year).end().find('span').removeClass('active');
if (currentYear === year) {
months.eq(picker.date.month()).addClass('active');
}
if (year - 1 < startYear) {
picker.widget.find('.datepicker-months th:eq(0)').addClass('disabled');
}
if (year + 1 > endYear) {
picker.widget.find('.datepicker-months th:eq(2)').addClass('disabled');
}
for (i = 0; i < 12; i++) {
if ((year === startYear && startMonth > i) || (year < startYear)) {
$(months[i]).addClass('disabled');
} else if ((year === endYear && endMonth < i) || (year > endYear)) {
$(months[i]).addClass('disabled');
}
}
html = '';
year = parseInt(year / 10, 10) * 10;
yearCont = picker.widget.find('.datepicker-years').find(
'th:eq(1)').text(year + '-' + (year + 9)).parents('table').find('td');
picker.widget.find('.datepicker-years').find('th').removeClass('disabled');
if (startYear > year) {
picker.widget.find('.datepicker-years').find('th:eq(0)').addClass('disabled');
}
if (endYear < year + 9) {
picker.widget.find('.datepicker-years').find('th:eq(2)').addClass('disabled');
}
year -= 1;
for (i = -1; i < 11; i++) {
html += '<span class="year' + (i === -1 || i === 10 ? ' old' : '') + (currentYear === year ? ' active' : '') + ((year < startYear || year > endYear) ? ' disabled' : '') + '">' + year + '</span>';
year += 1;
}
yearCont.html(html);
},
fillHours = function () {
moment.locale(picker.options.language);
var table = picker.widget.find('.timepicker .timepicker-hours table'), html = '', current, i, j;
table.parent().hide();
if (picker.use24hours) {
current = 0;
for (i = 0; i < 6; i += 1) {
html += '<tr>';
for (j = 0; j < 4; j += 1) {
html += '<td class="hour">' + padLeft(current.toString()) + '</td>';
current++;
}
html += '</tr>';
}
}
else {
current = 1;
for (i = 0; i < 3; i += 1) {
html += '<tr>';
for (j = 0; j < 4; j += 1) {
html += '<td class="hour">' + padLeft(current.toString()) + '</td>';
current++;
}
html += '</tr>';
}
}
table.html(html);
},
fillMinutes = function () {
var table = picker.widget.find('.timepicker .timepicker-minutes table'), html = '', current = 0, i, j, step = picker.options.minuteStepping;
table.parent().hide();
if (step === 1)  {
step = 5;
}
for (i = 0; i < Math.ceil(60 / step / 4) ; i++) {
html += '<tr>';
for (j = 0; j < 4; j += 1) {
if (current < 60) {
html += '<td class="minute">' + padLeft(current.toString()) + '</td>';
current += step;
} else {
html += '<td></td>';
}
}
html += '</tr>';
}
table.html(html);
},
fillSeconds = function () {
var table = picker.widget.find('.timepicker .timepicker-seconds table'), html = '', current = 0, i, j;
table.parent().hide();
for (i = 0; i < 3; i++) {
html += '<tr>';
for (j = 0; j < 4; j += 1) {
html += '<td class="second">' + padLeft(current.toString()) + '</td>';
current += 5;
}
html += '</tr>';
}
table.html(html);
},
fillTime = function () {
if (!picker.date) {
return;
}
var timeComponents = picker.widget.find('.timepicker span[data-time-component]'),
hour = picker.date.hours(),
period = picker.date.format('A');
if (!picker.use24hours) {
if (hour === 0) {
hour = 12;
} else if (hour !== 12) {
hour = hour % 12;
}
picker.widget.find('.timepicker [data-action=togglePeriod]').text(period);
}
timeComponents.filter('[data-time-component=hours]').text(padLeft(hour));
timeComponents.filter('[data-time-component=minutes]').text(padLeft(picker.date.minutes()));
timeComponents.filter('[data-time-component=seconds]').text(padLeft(picker.date.second()));
},
click = function (e) {
e.stopPropagation();
e.preventDefault();
picker.unset = false;
var target = $(e.target).closest('span, td, th'), month, year, step, day, oldDate = moment(picker.date);
if (target.length === 1) {
if (!target.is('.disabled')) {
switch (target[0].nodeName.toLowerCase()) {
case 'th':
switch (target[0].className) {
case 'picker-switch':
showMode(1);
break;
case 'prev':
case 'next':
step = dpGlobal.modes[picker.viewMode].navStep;
if (target[0].className === 'prev') {
step = step * -1;
}
picker.viewDate.add(step, dpGlobal.modes[picker.viewMode].navFnc);
fillDate();
break;
}
break;
case 'span':
if (target.is('.month')) {
month = target.parent().find('span').index(target);
picker.viewDate.month(month);
} else {
year = parseInt(target.text(), 10) || 0;
picker.viewDate.year(year);
}
if (picker.viewMode === picker.minViewMode) {
picker.date = moment({
y: picker.viewDate.year(),
M: picker.viewDate.month(),
d: picker.viewDate.date(),
h: picker.date.hours(),
m: picker.date.minutes(),
s: picker.date.seconds()
});
set();
notifyChange(oldDate, e.type);
}
showMode(-1);
fillDate();
break;
case 'td':
if (target.is('.day')) {
day = parseInt(target.text(), 10) || 1;
month = picker.viewDate.month();
year = picker.viewDate.year();
if (target.is('.old')) {
if (month === 0) {
month = 11;
year -= 1;
} else {
month -= 1;
}
} else if (target.is('.new')) {
if (month === 11) {
month = 0;
year += 1;
} else {
month += 1;
}
}
picker.date = moment({
y: year,
M: month,
d: day,
h: picker.date.hours(),
m: picker.date.minutes(),
s: picker.date.seconds()
}
);
picker.viewDate = moment({
y: year, M: month, d: Math.min(28, day)
});
fillDate();
set();
notifyChange(oldDate, e.type);
}
break;
}
}
}
},
actions = {
incrementYears: function () {
checkDate('add', 'years', 1);
},
incrementMonths: function () {
checkDate('add', 'months', 1);
},
incrementDays: function () {
checkDate('add', 'days', 1);
},
incrementWeeks: function () {
checkDate('add', 'weeks', 1);
},
incrementHours: function () {
checkDate('add', 'hours', 1);
},
incrementMinutes: function () {
checkDate('add', 'minutes', picker.options.minuteStepping);
},
incrementSeconds: function () {
checkDate('add', 'seconds', 1);
},
decrementYears: function () {
checkDate('subtract', 'years', 1);
},
decrementMonths: function () {
checkDate('subtract', 'months', 1);
},
decrementWeeks: function () {
checkDate('subtract', 'weeks', 1);
},
decrementDays: function () {
checkDate('subtract', 'days', 1);
},
decrementHours: function () {
checkDate('subtract', 'hours', 1);
},
decrementMinutes: function () {
checkDate('subtract', 'minutes', picker.options.minuteStepping);
},
decrementSeconds: function () {
checkDate('subtract', 'seconds', 1);
},
startOfMonth: function () {
picker.setValue(moment().startOf('month'));
},
endOfMonth: function () {
picker.setValue(moment().endOf('month'));
},
startOfCurrentMonth: function () {
picker.setValue(moment(picker.date).startOf('month'));
},
endOfCurrentMonth: function () {
picker.setValue(moment(picker.date).endOf('month'));
},
togglePeriod: function () {
var hour = picker.date.hours();
if (hour >= 12) {
hour -= 12;
} else {
hour += 12;
}
picker.date.hours(hour);
},
showPicker: function () {
picker.widget.find('.timepicker > div:not(.timepicker-picker)').hide();
picker.widget.find('.timepicker .timepicker-picker').show();
},
showHours: function () {
picker.widget.find('.timepicker .timepicker-picker').hide();
picker.widget.find('.timepicker .timepicker-hours').show();
},
showMinutes: function () {
picker.widget.find('.timepicker .timepicker-picker').hide();
picker.widget.find('.timepicker .timepicker-minutes').show();
},
showSeconds: function () {
picker.widget.find('.timepicker .timepicker-picker').hide();
picker.widget.find('.timepicker .timepicker-seconds').show();
},
selectHour: function (e) {
var hour = parseInt($(e.target).text(), 10);
if (!picker.use24hours) {
if (picker.date.hours() >= 12) {
if (hour !== 12) {
hour += 12;
}
} else {
if (hour === 12) {
hour = 0;
}
}
}
picker.date.hours(hour);
actions.showPicker.call(picker);
},
selectMinute: function (e) {
picker.date.minutes(parseInt($(e.target).text(), 10));
actions.showPicker.call(picker);
},
selectSecond: function (e) {
picker.date.seconds(parseInt($(e.target).text(), 10));
actions.showPicker.call(picker);
},
toggleDateTimePicker: function (e) {
var toggleElement = picker.widget.find('.accordion-toggle')[0];
$(toggleElement).trigger('click.togglePicker');
}
},
doAction = function (e) {
var oldDate = moment(picker.date),
action = $(e.currentTarget).data('action') || e.action,
rv = actions[action].apply(picker, arguments);
stopEvent(e);
if (!picker.date) {
picker.date = moment({y: 1970});
}
set();
fillTime();
notifyChange(oldDate, e.type);
picker.element.trigger({
type: 'dp.action',
picker: picker,
date: picker.date,
action: action
});
return rv;
},
stopEvent = function (e) {
e.stopPropagation();
e.preventDefault();
},
keydown = function (e) {
if (e.keyCode === 27) {
picker.hide();
}
},
change = function (e) {
moment.locale(picker.options.language);
var input = $(e.target), oldDate = moment(picker.date), newDate = moment(input.val(), picker.format, picker.options.useStrict);
if (newDate.isValid() && !isInDisableDates(newDate) && isInEnableDates(newDate)) {
update();
picker.setValue(newDate);
notifyChange(oldDate, e.type);
set();
}
else {
picker.viewDate = oldDate;
picker.unset = true;
notifyChange(oldDate, e.type);
notifyError(newDate);
}
},
showMode = function (dir) {
if (dir) {
picker.viewMode = Math.max(picker.minViewMode, Math.min(2, picker.viewMode + dir));
}
picker.widget.find('.datepicker > div').hide().filter('.datepicker-' + dpGlobal.modes[picker.viewMode].clsName).show();
},
attachDatePickerEvents = function () {
var $this, $parent, expanded, closed, collapseData;
picker.widget.on('click', '.datepicker *', $.proxy(click, this));
picker.widget.on('click', '[data-action]', $.proxy(doAction, this));
picker.widget.on('mousedown', $.proxy(stopEvent, this));
picker.element.on('keydown', $.proxy(keydown, this));
picker.widget.on('doAction', $.proxy(doAction, this));
if (picker.options.pickDate && picker.options.pickTime) {
picker.widget.on('click.togglePicker', '.accordion-toggle', function (e) {
e.stopPropagation();
$this = $(this);
$parent = $this.closest('ul');
expanded = $parent.find('.in');
closed = $parent.find('.collapse:not(.in)');
if (expanded && expanded.length) {
collapseData = expanded.data('collapse');
if (collapseData && collapseData.transitioning) {
return;
}
expanded.collapse('hide');
closed.collapse('show');
$this.find('span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date);
if (picker.component) {
picker.component.find('span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date);
}
}
picker.element.trigger({
type: 'dp.toggle'
});
});
}
if (picker.isInput) {
picker.element.on({
'click': $.proxy(picker.show, this),
'focus': $.proxy(picker.show, this),
'change': $.proxy(change, this),
'blur': $.proxy(picker.hide, this)
});
} else {
picker.element.on({
'change': $.proxy(change, this)
}, 'input');
if (picker.component) {
picker.component.on('click', $.proxy(picker.show, this));
picker.component.on('mousedown', $.proxy(stopEvent, this));
} else {
picker.element.on('click', $.proxy(picker.show, this));
}
}
},
attachDatePickerGlobalEvents = function () {
$(window).on(
'resize.datetimepicker' + picker.id, $.proxy(place, this));
if (!picker.isInput) {
$(document).on(
'mousedown.datetimepicker' + picker.id, $.proxy(picker.hide, this));
}
},
detachDatePickerEvents = function () {
picker.widget.off('click', '.datepicker *', picker.click);
picker.widget.off('click', '[data-action]');
picker.widget.off('mousedown', picker.stopEvent);
if (picker.options.pickDate && picker.options.pickTime) {
picker.widget.off('click.togglePicker');
}
if (picker.isInput) {
picker.element.off({
'focus': picker.show,
'change': change,
'click': picker.show,
'blur' : picker.hide
});
} else {
picker.element.off({
'change': change
}, 'input');
if (picker.component) {
picker.component.off('click', picker.show);
picker.component.off('mousedown', picker.stopEvent);
} else {
picker.element.off('click', picker.show);
}
}
},
detachDatePickerGlobalEvents = function () {
$(window).off('resize.datetimepicker' + picker.id);
if (!picker.isInput) {
$(document).off('mousedown.datetimepicker' + picker.id);
}
},
isInFixed = function () {
if (picker.element) {
var parents = picker.element.parents(), inFixed = false, i;
for (i = 0; i < parents.length; i++) {
if ($(parents[i]).css('position') === 'fixed') {
inFixed = true;
break;
}
}
return inFixed;
} else {
return false;
}
},
set = function () {
moment.locale(picker.options.language);
var formatted = '';
if (!picker.unset) {
formatted = moment(picker.date).format(picker.format);
}
getPickerInput().val(formatted);
picker.element.data('date', formatted);
},
checkDate = function (direction, unit, amount) {
moment.locale(picker.options.language);
var newDate;
if (direction === 'add') {
newDate = moment(picker.date);
if (newDate.hours() === 23) {
newDate.add(amount, unit);
}
newDate.add(amount, unit);
}
else {
newDate = moment(picker.date).subtract(amount, unit);
}
if (isInDisableDates(moment(newDate.subtract(amount, unit))) || isInDisableDates(newDate)) {
notifyError(newDate.format(picker.format));
return;
}
if (direction === 'add') {
picker.date.add(amount, unit);
}
else {
picker.date.subtract(amount, unit);
}
picker.unset = false;
},
isInDisableDates = function (date, timeUnit) {
moment.locale(picker.options.language);
var maxDate = moment(picker.options.maxDate, picker.format, picker.options.useStrict),
minDate = moment(picker.options.minDate, picker.format, picker.options.useStrict);
if (timeUnit) {
maxDate = maxDate.endOf(timeUnit);
minDate = minDate.startOf(timeUnit);
}
if (date.isAfter(maxDate) || date.isBefore(minDate)) {
return true;
}
if (picker.options.disabledDates === false) {
return false;
}
return picker.options.disabledDates[date.format('YYYY-MM-DD')] === true;
},
isInEnableDates = function (date) {
moment.locale(picker.options.language);
if (picker.options.enabledDates === false) {
return true;
}
return picker.options.enabledDates[date.format('YYYY-MM-DD')] === true;
},
indexGivenDates = function (givenDatesArray) {
var givenDatesIndexed = {}, givenDatesCount = 0, i;
for (i = 0; i < givenDatesArray.length; i++) {
if (moment.isMoment(givenDatesArray[i]) || givenDatesArray[i] instanceof Date) {
dDate = moment(givenDatesArray[i]);
} else {
dDate = moment(givenDatesArray[i], picker.format, picker.options.useStrict);
}
if (dDate.isValid()) {
givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
givenDatesCount++;
}
}
if (givenDatesCount > 0) {
return givenDatesIndexed;
}
return false;
},
padLeft = function (string) {
string = string.toString();
if (string.length >= 2) {
return string;
}
return '0' + string;
},
getTemplate = function () {
var
headTemplate =
'<thead>' +
'<tr>' +
'<th class="prev">&lsaquo;</th><th colspan="' + (picker.options.calendarWeeks ? '6' : '5') + '" class="picker-switch"></th><th class="next">&rsaquo;</th>' +
'</tr>' +
'</thead>',
contTemplate =
'<tbody><tr><td colspan="' + (picker.options.calendarWeeks ? '8' : '7') + '"></td></tr></tbody>',
template = '<div class="datepicker-days">' +
'<table class="table-condensed">' + headTemplate + '<tbody></tbody></table>' +
'</div>' +
'<div class="datepicker-months">' +
'<table class="table-condensed">' + headTemplate + contTemplate + '</table>' +
'</div>' +
'<div class="datepicker-years">' +
'<table class="table-condensed">' + headTemplate + contTemplate + '</table>' +
'</div>',
ret = '';
if (picker.options.pickDate && picker.options.pickTime) {
ret = '<div role="application" class="bootstrap-datetimepicker-widget' + (picker.options.sideBySide ? ' timepicker-sbs' : '') + (picker.use24hours ? ' usetwentyfour' : '') + ' dropdown-menu" style="z-index:9999 !important;">';
if (picker.options.sideBySide) {
ret += '<div class="row">' +
'<div class="col-sm-6 datepicker">' + template + '</div>' +
'<div class="col-sm-6 timepicker">' + tpGlobal.getTemplate() + '</div>' +
'</div>';
} else {
ret += '<ul class="list-unstyled">' +
'<li' + (picker.options.collapse ? ' class="collapse in"' : '') + '>' +
'<div class="datepicker">' + template + '</div>' +
'</li>' +
'<li class="picker-switch accordion-toggle"><a href="#" data-action="toggleDateTimePicker" class="btn" style="width:100%"><span class="' + picker.options.icons.time + '"></span></a></li>' +
'<li' + (picker.options.collapse ? ' class="collapse"' : '') + '>' +
'<div class="timepicker">' + tpGlobal.getTemplate() + '</div>' +
'</li>' +
'</ul>';
}
ret += '</div>';
return ret;
}
if (picker.options.pickTime) {
return (
'<div role="application" class="bootstrap-datetimepicker-widget dropdown-menu">' +
'<div class="timepicker">' + tpGlobal.getTemplate() + '</div>' +
'</div>'
);
}
return (
'<div role="application" class="bootstrap-datetimepicker-widget dropdown-menu">' +
'<div class="datepicker">' + template + '</div>' +
'</div>'
);
},
dpGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'year',
navStep: 1
},
{
clsName: 'years',
navFnc: 'year',
navStep: 10
}
]
},
tpGlobal = {
hourTemplate: '<span data-action="showHours" data-time-component="hours"   class="timepicker-hour"></span>',
minuteTemplate: '<span data-action="showMinutes" data-time-component="minutes" class="timepicker-minute"></span>',
secondTemplate: '<span data-action="showSeconds"  data-time-component="seconds" class="timepicker-second"></span>'
};
tpGlobal.getTemplate = function () {
return (
'<div class="timepicker-picker">' +
'<table class="table-condensed">' +
'<tr>' +
'<td><a href="#" class="btn" data-action="incrementHours"><span class="' + picker.options.icons.up + '"></span></a></td>' +
'<td class="separator"></td>' +
'<td>' + (picker.options.useMinutes ? '<a href="#" class="btn" data-action="incrementMinutes"><span class="' + picker.options.icons.up + '"></span></a>' : '') + '</td>' +
(picker.options.useSeconds ?
'<td class="separator"></td><td><a href="#" class="btn" data-action="incrementSeconds"><span class="' + picker.options.icons.up + '"></span></a></td>' : '') +
(picker.use24hours ? '' : '<td class="separator"></td>') +
'</tr>' +
'<tr>' +
'<td>' + tpGlobal.hourTemplate + '</td> ' +
'<td class="separator">:</td>' +
'<td>' + (picker.options.useMinutes ? tpGlobal.minuteTemplate : '<span class="timepicker-minute">00</span>') + '</td> ' +
(picker.options.useSeconds ?
'<td class="separator">:</td><td>' + tpGlobal.secondTemplate + '</td>' : '') +
(picker.use24hours ? '' : '<td class="separator"></td>' +
'<td><button type="button" class="btn btn-primary" data-action="togglePeriod"></button></td>') +
'</tr>' +
'<tr>' +
'<td><a href="#" class="btn" data-action="decrementHours"><span class="' + picker.options.icons.down + '"></span></a></td>' +
'<td class="separator"></td>' +
'<td>' + (picker.options.useMinutes ? '<a href="#" class="btn" data-action="decrementMinutes"><span class="' + picker.options.icons.down + '"></span></a>' : '') + '</td>' +
(picker.options.useSeconds ?
'<td class="separator"></td><td><a href="#" class="btn" data-action="decrementSeconds"><span class="' + picker.options.icons.down + '"></span></a></td>' : '') +
(picker.use24hours ? '' : '<td class="separator"></td>') +
'</tr>' +
'</table>' +
'</div>' +
'<div class="timepicker-hours" data-action="selectHour">' +
'<table class="table-condensed"></table>' +
'</div>' +
'<div class="timepicker-minutes" data-action="selectMinute">' +
'<table class="table-condensed"></table>' +
'</div>' +
(picker.options.useSeconds ?
'<div class="timepicker-seconds" data-action="selectSecond"><table class="table-condensed"></table></div>' : '')
);
};
picker.destroy = function () {
detachDatePickerEvents();
detachDatePickerGlobalEvents();
picker.widget.remove();
picker.element.removeData('DateTimePicker');
if (picker.component) {
picker.component.removeData('DateTimePicker');
}
};
picker.place = function() {
place();
};
picker.show = function (e) {
if (getPickerInput().prop('disabled')) {
return;
}
if (picker.options.useCurrent) {
if (getPickerInput().val() === '') {
if (picker.options.minuteStepping !== 1) {
var mDate = moment(),
rInterval = picker.options.minuteStepping;
mDate.minutes((Math.round(mDate.minutes() / rInterval) * rInterval) % 60).seconds(0);
picker.setValue(mDate.format(picker.format));
} else {
picker.setValue(moment().format(picker.format));
}
notifyChange('', e.type);
}
}
if (e && e.type === 'click' && picker.isInput && picker.widget.hasClass('picker-open')) {
return;
}
if (picker.widget.hasClass('picker-open')) {
picker.widget.hide();
picker.widget.removeClass('picker-open');
}
else {
picker.widget.show();
picker.widget.addClass('picker-open');
}
picker.height = picker.component ? picker.component.outerHeight() : picker.element.outerHeight();
place();
picker.element.trigger({
type: 'dp.show',
date: moment(picker.date)
});
attachDatePickerGlobalEvents();
if (e) {
stopEvent(e);
}
};
picker.disable = function () {
var input = getPickerInput();
if (input.prop('disabled')) {
return;
}
input.prop('disabled', true);
detachDatePickerEvents();
};
picker.enable = function () {
var input = getPickerInput();
if (!input.prop('disabled')) {
return;
}
input.prop('disabled', false);
attachDatePickerEvents();
};
picker.hide = function () {
var collapse = picker.widget.find('.collapse'), i, collapseData;
for (i = 0; i < collapse.length; i++) {
collapseData = collapse.eq(i).data('collapse');
if (collapseData && collapseData.transitioning) {
return;
}
}
picker.widget.hide();
picker.widget.removeClass('picker-open');
picker.viewMode = picker.startViewMode;
showMode();
picker.element.trigger({
type: 'dp.hide',
date: moment(picker.date)
});
detachDatePickerGlobalEvents();
};
picker.setValue = function (newDate) {
moment.locale(picker.options.language);
if (!newDate) {
picker.unset = true;
set();
} else {
picker.unset = false;
}
if (!moment.isMoment(newDate)) {
newDate = (newDate instanceof Date) ? moment(newDate) : moment(newDate, picker.format, picker.options.useStrict);
} else {
newDate = newDate.locale(picker.options.language);
}
if (newDate.isValid()) {
picker.date = newDate;
set();
picker.viewDate = moment({y: picker.date.year(), M: picker.date.month()});
fillDate();
fillTime();
}
else {
notifyError(newDate);
}
};
picker.getDate = function () {
if (picker.unset) {
return null;
}
return moment(picker.date);
};
picker.setDate = function (date) {
var oldDate = moment(picker.date);
if (!date) {
picker.setValue(null);
} else {
picker.setValue(date);
}
notifyChange(oldDate, 'function');
};
picker.setDisabledDates = function (dates) {
picker.options.disabledDates = indexGivenDates(dates);
if (picker.viewDate) {
update();
}
};
picker.setEnabledDates = function (dates) {
picker.options.enabledDates = indexGivenDates(dates);
if (picker.viewDate) {
update();
}
};
picker.setMaxDate = function (date) {
if (date === undefined) {
return;
}
if (moment.isMoment(date) || date instanceof Date) {
picker.options.maxDate = moment(date);
} else {
picker.options.maxDate = moment(date, picker.format, picker.options.useStrict);
}
if (picker.viewDate) {
update();
}
};
picker.setMinDate = function (date) {
if (date === undefined) {
return;
}
if (moment.isMoment(date) || date instanceof Date) {
picker.options.minDate = moment(date);
} else {
picker.options.minDate = moment(date, picker.format, picker.options.useStrict);
}
if (picker.viewDate) {
update();
}
};
init();
};
$.fn.datetimepicker = function (options) {
return this.each(function () {
var $this = $(this),
data = $this.data('DateTimePicker');
if (!data) {
$this.data('DateTimePicker', new DateTimePicker(this, options));
}
});
};
$.fn.datetimepicker.defaults = {
format: false,
pickDate: true,
pickTime: true,
useMinutes: true,
useSeconds: false,
useCurrent: true,
calendarWeeks: false,
minuteStepping: 1,
minDate: moment({y: 1900}),
maxDate: moment().add(100, 'y'),
showToday: true,
collapse: true,
language: moment.locale(),
defaultDate: '',
disabledDates: false,
enabledDates: false,
icons: {},
useStrict: false,
direction: 'auto',
sideBySide: false,
daysOfWeekDisabled: [],
widgetParent: false
};
}));
;
/*! RESOURCE: /scripts/libs/sortable.min.js */
/*! Sortable 1.4.2 - MIT | git://github.com/rubaxa/Sortable.git */
!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=r({},b),a[L]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1};for(var d in c)!(d in b)&&(b[d]=c[d]);V(b);for(var f in this)"_"===f.charAt(0)&&(this[f]=this[f].bind(this));this.nativeDraggable=b.forceFallback?!1:P,e(a,"mousedown",this._onTapStart),e(a,"touchstart",this._onTapStart),this.nativeDraggable&&(e(a,"dragover",this),e(a,"dragenter",this)),T.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){v&&v.state!==a&&(h(v,"display",a?"none":""),!a&&v.state&&w.insertBefore(v,s),v.state=a)}function c(a,b,c){if(a){c=c||N,b=b.split(".");var d=b.shift().toUpperCase(),e=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");do if(">*"===d&&a.parentNode===c||(""===d||a.nodeName.toUpperCase()==d)&&(!b.length||((" "+a.className+" ").match(e)||[]).length==b.length))return a;while(a!==c&&(a=a.parentNode))}return null}function d(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function e(a,b,c){a.addEventListener(b,c,!1)}function f(a,b,c){a.removeEventListener(b,c,!1)}function g(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(K," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(K," ")}}function h(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return N.defaultView&&N.defaultView.getComputedStyle?c=N.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function i(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;f>e;e++)c(d[e],e);return d}return[]}function j(a,b,c,d,e,f,g){var h=N.createEvent("Event"),i=(a||b[L]).options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=v,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function k(a,b,c,d,e,f){var g,h,i=a[L],j=i.options.onMove;return g=N.createEvent("Event"),g.initEvent("move",!0,!0),g.to=b,g.from=a,g.dragged=c,g.draggedRect=d,g.related=e||b,g.relatedRect=f||b.getBoundingClientRect(),a.dispatchEvent(g),j&&(h=j.call(i,g)),h}function l(a){a.draggable=!1}function m(){R=!1}function n(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return(b.clientY-(d.top+d.height)>5||b.clientX-(d.right+d.width)>5)&&c}function o(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function p(a){var b=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"!==a.nodeName.toUpperCase()&&b++;return b}function q(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function r(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}var s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K=/\s+/g,L="Sortable"+(new Date).getTime(),M=window,N=M.document,O=M.parseInt,P=!!("draggable"in N.createElement("div")),Q=function(a){return a=N.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),R=!1,S=Math.abs,T=([].slice,[]),U=q(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h=b.scrollSensitivity,i=b.scrollSpeed,j=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight;if(z!==c&&(y=b.scroll,z=c,y===!0)){y=c;do if(y.offsetWidth<y.scrollWidth||y.offsetHeight<y.scrollHeight)break;while(y=y.parentNode)}y&&(d=y,e=y.getBoundingClientRect(),f=(S(e.right-j)<=h)-(S(e.left-j)<=h),g=(S(e.bottom-k)<=h)-(S(e.top-k)<=h)),f||g||(f=(h>=l-j)-(h>=j),g=(h>=m-k)-(h>=k),(f||g)&&(d=M)),(J.vx!==f||J.vy!==g||J.el!==d)&&(J.el=d,J.vx=f,J.vy=g,clearInterval(J.pid),d&&(J.pid=setInterval(function(){d===M?M.scrollTo(M.pageXOffset+f*i,M.pageYOffset+g*i):(g&&(d.scrollTop+=g*i),f&&(d.scrollLeft+=f*i))},24)))}},30),V=function(a){var b=a.group;b&&"object"==typeof b||(b=a.group={name:b}),["pull","put"].forEach(function(a){a in b||(b[a]=!0)}),a.groups=" "+b.name+(b.put.join?" "+b.put.join(" "):"")+" "};return a.prototype={constructor:a,_onTapStart:function(a){var b=this,d=this.el,e=this.options,f=a.type,g=a.touches&&a.touches[0],h=(g||a).target,i=h,k=e.filter;if(!("mousedown"===f&&0!==a.button||e.disabled)&&(h=c(h,e.draggable,d))){if(D=p(h),"function"==typeof k){if(k.call(this,a,h,this))return j(b,i,"filter",h,d,D),void a.preventDefault()}else if(k&&(k=k.split(",").some(function(a){return a=c(i,a.trim(),d),a?(j(b,a,"filter",h,d,D),!0):void 0})))return void a.preventDefault();(!e.handle||c(i,e.handle,d))&&this._prepareDragStart(a,g,h)}},_prepareDragStart:function(a,b,c){var d,f=this,h=f.el,j=f.options,k=h.ownerDocument;c&&!s&&c.parentNode===h&&(G=a,w=h,s=c,t=s.parentNode,x=s.nextSibling,F=j.group,d=function(){f._disableDelayedDrag(),s.draggable=!0,g(s,f.options.chosenClass,!0),f._triggerDragStart(b)},j.ignore.split(",").forEach(function(a){i(s,a.trim(),l)}),e(k,"mouseup",f._onDrop),e(k,"touchend",f._onDrop),e(k,"touchcancel",f._onDrop),j.delay?(e(k,"mouseup",f._disableDelayedDrag),e(k,"touchend",f._disableDelayedDrag),e(k,"touchcancel",f._disableDelayedDrag),e(k,"mousemove",f._disableDelayedDrag),e(k,"touchmove",f._disableDelayedDrag),f._dragStartTimer=setTimeout(d,j.delay)):d())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),f(a,"mouseup",this._disableDelayedDrag),f(a,"touchend",this._disableDelayedDrag),f(a,"touchcancel",this._disableDelayedDrag),f(a,"mousemove",this._disableDelayedDrag),f(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(G={target:s,clientX:a.clientX,clientY:a.clientY},this._onDragStart(G,"touch")):this.nativeDraggable?(e(s,"dragend",this),e(w,"dragstart",this._onDragStart)):this._onDragStart(G,!0);try{N.selection?N.selection.empty():window.getSelection().removeAllRanges()}catch(b){}},_dragStarted:function(){w&&s&&(g(s,this.options.ghostClass,!0),a.active=this,j(this,w,"start",s,w,D))},_emulateDragOver:function(){if(H){if(this._lastX===H.clientX&&this._lastY===H.clientY)return;this._lastX=H.clientX,this._lastY=H.clientY,Q||h(u,"display","none");var a=N.elementFromPoint(H.clientX,H.clientY),b=a,c=" "+this.options.group.name,d=T.length;if(b)do{if(b[L]&&b[L].options.groups.indexOf(c)>-1){for(;d--;)T[d]({clientX:H.clientX,clientY:H.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);Q||h(u,"display","")}},_onTouchMove:function(b){if(G){a.active||this._dragStarted(),this._appendGhost();var c=b.touches?b.touches[0]:b,d=c.clientX-G.clientX,e=c.clientY-G.clientY,f=b.touches?"translate3d("+d+"px,"+e+"px,0)":"translate("+d+"px,"+e+"px)";I=!0,H=c,h(u,"webkitTransform",f),h(u,"mozTransform",f),h(u,"msTransform",f),h(u,"transform",f),b.preventDefault()}},_appendGhost:function(){if(!u){var a,b=s.getBoundingClientRect(),c=h(s),d=this.options;u=s.cloneNode(!0),g(u,d.ghostClass,!1),g(u,d.fallbackClass,!0),h(u,"top",b.top-O(c.marginTop,10)),h(u,"left",b.left-O(c.marginLeft,10)),h(u,"width",b.width),h(u,"height",b.height),h(u,"opacity","0.8"),h(u,"position","fixed"),h(u,"zIndex","100000"),h(u,"pointerEvents","none"),d.fallbackOnBody&&N.body.appendChild(u)||w.appendChild(u),a=u.getBoundingClientRect(),h(u,"width",2*b.width-a.width),h(u,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),"clone"==F.pull&&(v=s.cloneNode(!0),h(v,"display","none"),w.insertBefore(v,s)),b?("touch"===b?(e(N,"touchmove",this._onTouchMove),e(N,"touchend",this._onDrop),e(N,"touchcancel",this._onDrop)):(e(N,"mousemove",this._onTouchMove),e(N,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,s)),e(N,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(a){var d,e,f,g=this.el,i=this.options,j=i.group,l=j.put,o=F===j,p=i.sort;if(void 0!==a.preventDefault&&(a.preventDefault(),!i.dragoverBubble&&a.stopPropagation()),I=!0,F&&!i.disabled&&(o?p||(f=!w.contains(s)):F.pull&&l&&(F.name===j.name||l.indexOf&&~l.indexOf(F.name)))&&(void 0===a.rootEl||a.rootEl===this.el)){if(U(a,i,this.el),R)return;if(d=c(a.target,i.draggable,g),e=s.getBoundingClientRect(),f)return b(!0),void(v||x?w.insertBefore(s,v||x):p||w.appendChild(s));if(0===g.children.length||g.children[0]===u||g===a.target&&(d=n(g,a))){if(d){if(d.animated)return;r=d.getBoundingClientRect()}b(o),k(w,g,s,e,d,r)!==!1&&(s.contains(g)||(g.appendChild(s),t=g),this._animate(e,s),d&&this._animate(r,d))}else if(d&&!d.animated&&d!==s&&void 0!==d.parentNode[L]){A!==d&&(A=d,B=h(d),C=h(d.parentNode));var q,r=d.getBoundingClientRect(),y=r.right-r.left,z=r.bottom-r.top,D=/left|right|inline/.test(B.cssFloat+B.display)||"flex"==C.display&&0===C["flex-direction"].indexOf("row"),E=d.offsetWidth>s.offsetWidth,G=d.offsetHeight>s.offsetHeight,H=(D?(a.clientX-r.left)/y:(a.clientY-r.top)/z)>.5,J=d.nextElementSibling,K=k(w,g,s,e,d,r);if(K!==!1){if(R=!0,setTimeout(m,30),b(o),1===K||-1===K)q=1===K;else if(D){var M=s.offsetTop,N=d.offsetTop;q=M===N?d.previousElementSibling===s&&!E||H&&E:N>M}else q=J!==s&&!G||H&&G;s.contains(g)||(q&&!J?g.appendChild(s):d.parentNode.insertBefore(s,q?J:d)),t=s.parentNode,this._animate(e,s),this._animate(r,d)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();h(b,"transition","none"),h(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,h(b,"transition","all "+c+"ms"),h(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){h(b,"transition",""),h(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;f(N,"touchmove",this._onTouchMove),f(a,"mouseup",this._onDrop),f(a,"touchend",this._onDrop),f(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(J.pid),clearTimeout(this._dragStartTimer),f(N,"mousemove",this._onTouchMove),this.nativeDraggable&&(f(N,"drop",this),f(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(I&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),u&&u.parentNode.removeChild(u),s&&(this.nativeDraggable&&f(s,"dragend",this),l(s),g(s,this.options.ghostClass,!1),g(s,this.options.chosenClass,!1),w!==t?(E=p(s),E>=0&&(j(null,t,"sort",s,w,D,E),j(this,w,"sort",s,w,D,E),j(null,t,"add",s,w,D,E),j(this,w,"remove",s,w,D,E))):(v&&v.parentNode.removeChild(v),s.nextSibling!==x&&(E=p(s),E>=0&&(j(this,w,"update",s,w,D,E),j(this,w,"sort",s,w,D,E)))),a.active&&((null===E||-1===E)&&(E=D),j(this,w,"end",s,w,D,E),this.save())),w=s=t=u=x=v=y=z=G=H=I=E=A=B=F=a.active=null)},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?s&&(this._onDragOver(a),d(a)):("drop"===b||"dragend"===b)&&this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;f>e;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||o(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&V(c)))},destroy:function(){var a=this.el;a[L]=null,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),T.splice(T.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},a.utils={on:e,off:f,css:h,find:i,is:function(a,b){return!!c(a,b,a)},extend:r,throttle:q,closest:c,toggleClass:g,index:p},a.create=function(b,c){return new a(b,c)},a.version="1.4.2",a});
/*! RESOURCE: /scripts/libs/lodash.min.js */
/**
 * @license
 * Lodash <https://lodash.com/>
 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */
(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;
return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){
for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);
}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;
return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);
return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];
}function Q(n){return n.match(Fr)||[]}var X,nn="4.17.21",tn=200,rn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",en="Expected a function",un="Invalid `variable` option passed into `_.template`",on="__lodash_hash_undefined__",fn=500,cn="__lodash_placeholder__",an=1,ln=2,sn=4,hn=1,pn=2,_n=1,vn=2,gn=4,yn=8,dn=16,bn=32,wn=64,mn=128,xn=256,jn=512,An=30,kn="...",On=800,In=16,Rn=1,zn=2,En=3,Sn=1/0,Wn=9007199254740991,Ln=1.7976931348623157e308,Cn=NaN,Un=4294967295,Bn=Un-1,Tn=Un>>>1,$n=[["ary",mn],["bind",_n],["bindKey",vn],["curry",yn],["curryRight",dn],["flip",jn],["partial",bn],["partialRight",wn],["rearg",xn]],Dn="[object Arguments]",Mn="[object Array]",Fn="[object AsyncFunction]",Nn="[object Boolean]",Pn="[object Date]",qn="[object DOMException]",Zn="[object Error]",Kn="[object Function]",Vn="[object GeneratorFunction]",Gn="[object Map]",Hn="[object Number]",Jn="[object Null]",Yn="[object Object]",Qn="[object Promise]",Xn="[object Proxy]",nt="[object RegExp]",tt="[object Set]",rt="[object String]",et="[object Symbol]",ut="[object Undefined]",it="[object WeakMap]",ot="[object WeakSet]",ft="[object ArrayBuffer]",ct="[object DataView]",at="[object Float32Array]",lt="[object Float64Array]",st="[object Int8Array]",ht="[object Int16Array]",pt="[object Int32Array]",_t="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",dt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,wt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,jt=RegExp(mt.source),At=RegExp(xt.source),kt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zt=/^\w*$/,Et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,St=/[\\^$.*+?()[\]{}|]/g,Wt=RegExp(St.source),Lt=/^\s+/,Ct=/\s/,Ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bt=/\{\n\/\* \[wrapped with (.+)\] \*/,Tt=/,? & /,$t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dt=/[()=,{}\[\]\/\s]/,Mt=/\\(\\)?/g,Ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Pt=/^[-+]0x[0-9a-f]+$/i,qt=/^0b[01]+$/i,Zt=/^\[object .+?Constructor\]$/,Kt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,Gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ht=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",Qt="\\u0300-\\u036f",Xt="\\ufe20-\\ufe2f",nr="\\u20d0-\\u20ff",tr=Qt+Xt+nr,rr="\\u2700-\\u27bf",er="a-z\\xdf-\\xf6\\xf8-\\xff",ur="\\xac\\xb1\\xd7\\xf7",ir="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",or="\\u2000-\\u206f",fr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cr="A-Z\\xc0-\\xd6\\xd8-\\xde",ar="\\ufe0e\\ufe0f",lr=ur+ir+or+fr,sr="['\u2019]",hr="["+Yt+"]",pr="["+lr+"]",_r="["+tr+"]",vr="\\d+",gr="["+rr+"]",yr="["+er+"]",dr="[^"+Yt+lr+vr+rr+er+cr+"]",br="\\ud83c[\\udffb-\\udfff]",wr="(?:"+_r+"|"+br+")",mr="[^"+Yt+"]",xr="(?:\\ud83c[\\udde6-\\uddff]){2}",jr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ar="["+cr+"]",kr="\\u200d",Or="(?:"+yr+"|"+dr+")",Ir="(?:"+Ar+"|"+dr+")",Rr="(?:"+sr+"(?:d|ll|m|re|s|t|ve))?",zr="(?:"+sr+"(?:D|LL|M|RE|S|T|VE))?",Er=wr+"?",Sr="["+ar+"]?",Wr="(?:"+kr+"(?:"+[mr,xr,jr].join("|")+")"+Sr+Er+")*",Lr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ur=Sr+Er+Wr,Br="(?:"+[gr,xr,jr].join("|")+")"+Ur,Tr="(?:"+[mr+_r+"?",_r,xr,jr,hr].join("|")+")",$r=RegExp(sr,"g"),Dr=RegExp(_r,"g"),Mr=RegExp(br+"(?="+br+")|"+Tr+Ur,"g"),Fr=RegExp([Ar+"?"+yr+"+"+Rr+"(?="+[pr,Ar,"$"].join("|")+")",Ir+"+"+zr+"(?="+[pr,Ar+Or,"$"].join("|")+")",Ar+"?"+Or+"+"+Rr,Ar+"+"+zr,Cr,Lr,vr,Br].join("|"),"g"),Nr=RegExp("["+kr+Yt+tr+ar+"]"),Pr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zr=-1,Kr={};
Kr[at]=Kr[lt]=Kr[st]=Kr[ht]=Kr[pt]=Kr[_t]=Kr[vt]=Kr[gt]=Kr[yt]=!0,Kr[Dn]=Kr[Mn]=Kr[ft]=Kr[Nn]=Kr[ct]=Kr[Pn]=Kr[Zn]=Kr[Kn]=Kr[Gn]=Kr[Hn]=Kr[Yn]=Kr[nt]=Kr[tt]=Kr[rt]=Kr[it]=!1;var Vr={};Vr[Dn]=Vr[Mn]=Vr[ft]=Vr[ct]=Vr[Nn]=Vr[Pn]=Vr[at]=Vr[lt]=Vr[st]=Vr[ht]=Vr[pt]=Vr[Gn]=Vr[Hn]=Vr[Yn]=Vr[nt]=Vr[tt]=Vr[rt]=Vr[et]=Vr[_t]=Vr[vt]=Vr[gt]=Vr[yt]=!0,Vr[Zn]=Vr[Kn]=Vr[it]=!1;var Gr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a",
"\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae",
"\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g",
"\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O",
"\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w",
"\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Jr={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Yr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qr=parseFloat,Xr=parseInt,ne="object"==typeof global&&global&&global.Object===Object&&global,te="object"==typeof self&&self&&self.Object===Object&&self,re=ne||te||Function("return this")(),ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,ue=ee&&"object"==typeof module&&module&&!module.nodeType&&module,ie=ue&&ue.exports===ee,oe=ie&&ne.process,fe=function(){
try{var n=ue&&ue.require&&ue.require("util").types;return n?n:oe&&oe.binding&&oe.binding("util")}catch(n){}}(),ce=fe&&fe.isArrayBuffer,ae=fe&&fe.isDate,le=fe&&fe.isMap,se=fe&&fe.isRegExp,he=fe&&fe.isSet,pe=fe&&fe.isTypedArray,_e=m("length"),ve=x(Gr),ge=x(Hr),ye=x(Jr),de=function p(x){function Z(n){if(cc(n)&&!bh(n)&&!(n instanceof Ct)){if(n instanceof Y)return n;if(bl.call(n,"__wrapped__"))return eo(n)}return new Y(n)}function J(){}function Y(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,
this.__index__=0,this.__values__=X}function Ct(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Un,this.__views__=[]}function $t(){var n=new Ct(this.__wrapped__);return n.__actions__=Tu(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Tu(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Tu(this.__views__),n}function Yt(){if(this.__filtered__){var n=new Ct(this);n.__dir__=-1,
n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Qt(){var n=this.__wrapped__.value(),t=this.__dir__,r=bh(n),e=t<0,u=r?n.length:0,i=Oi(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Hl(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return wu(n,this.__actions__);var _=[];n:for(;c--&&h<p;){a+=t;for(var v=-1,g=n[a];++v<s;){var y=l[v],d=y.iteratee,b=y.type,w=d(g);if(b==zn)g=w;else if(!w){if(b==Rn)continue n;break n}}_[h++]=g}return _}function Xt(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function nr(){this.__data__=is?is(null):{},this.size=0}function tr(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function rr(n){var t=this.__data__;if(is){var r=t[n];return r===on?X:r}return bl.call(t,n)?t[n]:X}function er(n){var t=this.__data__;return is?t[n]!==X:bl.call(t,n)}function ur(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=is&&t===X?on:t,this}function ir(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function or(){this.__data__=[],this.size=0}function fr(n){var t=this.__data__,r=Wr(t,n);return!(r<0)&&(r==t.length-1?t.pop():Ll.call(t,r,1),--this.size,!0)}function cr(n){var t=this.__data__,r=Wr(t,n);return r<0?X:t[r][1]}function ar(n){return Wr(this.__data__,n)>-1}function lr(n,t){var r=this.__data__,e=Wr(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this}function sr(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){
var e=n[t];this.set(e[0],e[1])}}function hr(){this.size=0,this.__data__={hash:new Xt,map:new(ts||ir),string:new Xt}}function pr(n){var t=xi(this,n).delete(n);return this.size-=t?1:0,t}function _r(n){return xi(this,n).get(n)}function vr(n){return xi(this,n).has(n)}function gr(n,t){var r=xi(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this}function yr(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new sr;++t<r;)this.add(n[t])}function dr(n){return this.__data__.set(n,on),this}function br(n){
return this.__data__.has(n)}function wr(n){this.size=(this.__data__=new ir(n)).size}function mr(){this.__data__=new ir,this.size=0}function xr(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jr(n){return this.__data__.get(n)}function Ar(n){return this.__data__.has(n)}function kr(n,t){var r=this.__data__;if(r instanceof ir){var e=r.__data__;if(!ts||e.length<tn-1)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new sr(e)}return r.set(n,t),this.size=r.size,this}function Or(n,t){
var r=bh(n),e=!r&&dh(n),u=!r&&!e&&mh(n),i=!r&&!e&&!u&&Oh(n),o=r||e||u||i,f=o?O(n.length,hl):[],c=f.length;for(var a in n)!t&&!bl.call(n,a)||o&&("length"==a||u&&("offset"==a||"parent"==a)||i&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Ci(a,c))||f.push(a);return f}function Ir(n){var t=n.length;return t?n[tu(0,t-1)]:X}function Rr(n,t){return Xi(Tu(n),Mr(t,0,n.length))}function zr(n){return Xi(Tu(n))}function Er(n,t,r){(r===X||Gf(n[t],r))&&(r!==X||t in n)||Br(n,t,r)}function Sr(n,t,r){var e=n[t];
bl.call(n,t)&&Gf(e,r)&&(r!==X||t in n)||Br(n,t,r)}function Wr(n,t){for(var r=n.length;r--;)if(Gf(n[r][0],t))return r;return-1}function Lr(n,t,r,e){return ys(n,function(n,u,i){t(e,n,r(n),i)}),e}function Cr(n,t){return n&&$u(t,Pc(t),n)}function Ur(n,t){return n&&$u(t,qc(t),n)}function Br(n,t,r){"__proto__"==t&&Tl?Tl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Tr(n,t){for(var r=-1,e=t.length,u=il(e),i=null==n;++r<e;)u[r]=i?X:Mc(n,t[r]);return u}function Mr(n,t,r){return n===n&&(r!==X&&(n=n<=r?n:r),
t!==X&&(n=n>=t?n:t)),n}function Fr(n,t,e,u,i,o){var f,c=t&an,a=t&ln,l=t&sn;if(e&&(f=i?e(n,u,i,o):e(n)),f!==X)return f;if(!fc(n))return n;var s=bh(n);if(s){if(f=zi(n),!c)return Tu(n,f)}else{var h=zs(n),p=h==Kn||h==Vn;if(mh(n))return Iu(n,c);if(h==Yn||h==Dn||p&&!i){if(f=a||p?{}:Ei(n),!c)return a?Mu(n,Ur(f,n)):Du(n,Cr(f,n))}else{if(!Vr[h])return i?n:{};f=Si(n,h,c)}}o||(o=new wr);var _=o.get(n);if(_)return _;o.set(n,f),kh(n)?n.forEach(function(r){f.add(Fr(r,t,e,r,n,o))}):jh(n)&&n.forEach(function(r,u){
f.set(u,Fr(r,t,e,u,n,o))});var v=l?a?di:yi:a?qc:Pc,g=s?X:v(n);return r(g||n,function(r,u){g&&(u=r,r=n[u]),Sr(f,u,Fr(r,t,e,u,n,o))}),f}function Nr(n){var t=Pc(n);return function(r){return Pr(r,n,t)}}function Pr(n,t,r){var e=r.length;if(null==n)return!e;for(n=ll(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===X&&!(u in n)||!i(o))return!1}return!0}function Gr(n,t,r){if("function"!=typeof n)throw new pl(en);return Ws(function(){n.apply(X,r)},t)}function Hr(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length;
if(!l)return s;r&&(t=c(t,z(r))),e?(i=f,a=!1):t.length>=tn&&(i=S,a=!1,t=new yr(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p);if(p=e||0!==p?p:0,a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function Jr(n,t){var r=!0;return ys(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Yr(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===X?o===o&&!bc(o):r(o,f)))var f=o,c=i}return c}function ne(n,t,r,e){var u=n.length;for(r=kc(r),r<0&&(r=-r>u?0:u+r),
e=e===X||e>u?u:kc(e),e<0&&(e+=u),e=r>e?0:Oc(e);r<e;)n[r++]=t;return n}function te(n,t){var r=[];return ys(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function ee(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Li),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?ee(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function ue(n,t){return n&&bs(n,t,Pc)}function oe(n,t){return n&&ws(n,t,Pc)}function fe(n,t){return i(t,function(t){return uc(n[t])})}function _e(n,t){t=ku(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[no(t[r++])];
return r&&r==e?n:X}function de(n,t,r){var e=t(n);return bh(n)?e:a(e,r(n))}function we(n){return null==n?n===X?ut:Jn:Bl&&Bl in ll(n)?ki(n):Ki(n)}function me(n,t){return n>t}function xe(n,t){return null!=n&&bl.call(n,t)}function je(n,t){return null!=n&&t in ll(n)}function Ae(n,t,r){return n>=Hl(t,r)&&n<Gl(t,r)}function ke(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=il(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,z(t))),s=Hl(p.length,s),l[a]=!r&&(t||u>=120&&p.length>=120)?new yr(a&&p):X}p=n[0];
var _=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],y=t?t(g):g;if(g=r||0!==g?g:0,!(v?S(v,y):e(h,y,r))){for(a=i;--a;){var d=l[a];if(!(d?S(d,y):e(n[a],y,r)))continue n}v&&v.push(y),h.push(g)}}return h}function Oe(n,t,r,e){return ue(n,function(n,u,i){t(e,r(n),u,i)}),e}function Ie(t,r,e){r=ku(r,t),t=Gi(t,r);var u=null==t?t:t[no(jo(r))];return null==u?X:n(u,t,e)}function Re(n){return cc(n)&&we(n)==Dn}function ze(n){return cc(n)&&we(n)==ft}function Ee(n){return cc(n)&&we(n)==Pn}function Se(n,t,r,e,u){
return n===t||(null==n||null==t||!cc(n)&&!cc(t)?n!==n&&t!==t:We(n,t,r,e,Se,u))}function We(n,t,r,e,u,i){var o=bh(n),f=bh(t),c=o?Mn:zs(n),a=f?Mn:zs(t);c=c==Dn?Yn:c,a=a==Dn?Yn:a;var l=c==Yn,s=a==Yn,h=c==a;if(h&&mh(n)){if(!mh(t))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new wr),o||Oh(n)?pi(n,t,r,e,u,i):_i(n,t,c,r,e,u,i);if(!(r&hn)){var p=l&&bl.call(n,"__wrapped__"),_=s&&bl.call(t,"__wrapped__");if(p||_){var v=p?n.value():n,g=_?t.value():t;return i||(i=new wr),u(v,g,r,e,i)}}return!!h&&(i||(i=new wr),vi(n,t,r,e,u,i));
}function Le(n){return cc(n)&&zs(n)==Gn}function Ce(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=ll(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<i;){f=r[u];var c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===X&&!(c in n))return!1}else{var s=new wr;if(e)var h=e(a,l,c,n,t,s);if(!(h===X?Se(l,a,hn|pn,e,s):h))return!1}}return!0}function Ue(n){return!(!fc(n)||Di(n))&&(uc(n)?kl:Zt).test(to(n))}function Be(n){return cc(n)&&we(n)==nt}function Te(n){return cc(n)&&zs(n)==tt;
}function $e(n){return cc(n)&&oc(n.length)&&!!Kr[we(n)]}function De(n){return"function"==typeof n?n:null==n?La:"object"==typeof n?bh(n)?Ze(n[0],n[1]):qe(n):Fa(n)}function Me(n){if(!Mi(n))return Vl(n);var t=[];for(var r in ll(n))bl.call(n,r)&&"constructor"!=r&&t.push(r);return t}function Fe(n){if(!fc(n))return Zi(n);var t=Mi(n),r=[];for(var e in n)("constructor"!=e||!t&&bl.call(n,e))&&r.push(e);return r}function Ne(n,t){return n<t}function Pe(n,t){var r=-1,e=Hf(n)?il(n.length):[];return ys(n,function(n,u,i){
e[++r]=t(n,u,i)}),e}function qe(n){var t=ji(n);return 1==t.length&&t[0][2]?Ni(t[0][0],t[0][1]):function(r){return r===n||Ce(r,n,t)}}function Ze(n,t){return Bi(n)&&Fi(t)?Ni(no(n),t):function(r){var e=Mc(r,n);return e===X&&e===t?Nc(r,n):Se(t,e,hn|pn)}}function Ke(n,t,r,e,u){n!==t&&bs(t,function(i,o){if(u||(u=new wr),fc(i))Ve(n,t,o,r,Ke,e,u);else{var f=e?e(Ji(n,o),i,o+"",n,t,u):X;f===X&&(f=i),Er(n,o,f)}},qc)}function Ve(n,t,r,e,u,i,o){var f=Ji(n,r),c=Ji(t,r),a=o.get(c);if(a)return Er(n,r,a),X;var l=i?i(f,c,r+"",n,t,o):X,s=l===X;
if(s){var h=bh(c),p=!h&&mh(c),_=!h&&!p&&Oh(c);l=c,h||p||_?bh(f)?l=f:Jf(f)?l=Tu(f):p?(s=!1,l=Iu(c,!0)):_?(s=!1,l=Wu(c,!0)):l=[]:gc(c)||dh(c)?(l=f,dh(f)?l=Rc(f):fc(f)&&!uc(f)||(l=Ei(c))):s=!1}s&&(o.set(c,l),u(l,c,e,i,o),o.delete(c)),Er(n,r,l)}function Ge(n,t){var r=n.length;if(r)return t+=t<0?r:0,Ci(t,r)?n[t]:X}function He(n,t,r){t=t.length?c(t,function(n){return bh(n)?function(t){return _e(t,1===n.length?n[0]:n)}:n}):[La];var e=-1;return t=c(t,z(mi())),A(Pe(n,function(n,r,u){return{criteria:c(t,function(t){
return t(n)}),index:++e,value:n}}),function(n,t){return Cu(n,t,r)})}function Je(n,t){return Ye(n,t,function(t,r){return Nc(n,r)})}function Ye(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=_e(n,o);r(f,o)&&fu(i,ku(o,n),f)}return i}function Qe(n){return function(t){return _e(t,n)}}function Xe(n,t,r,e){var u=e?d:y,i=-1,o=t.length,f=n;for(n===t&&(t=Tu(t)),r&&(f=c(n,z(r)));++i<o;)for(var a=0,l=t[i],s=r?r(l):l;(a=u(f,s,a,e))>-1;)f!==n&&Ll.call(f,a,1),Ll.call(n,a,1);return n}function nu(n,t){for(var r=n?t.length:0,e=r-1;r--;){
var u=t[r];if(r==e||u!==i){var i=u;Ci(u)?Ll.call(n,u,1):yu(n,u)}}return n}function tu(n,t){return n+Nl(Ql()*(t-n+1))}function ru(n,t,r,e){for(var u=-1,i=Gl(Fl((t-n)/(r||1)),0),o=il(i);i--;)o[e?i:++u]=n,n+=r;return o}function eu(n,t){var r="";if(!n||t<1||t>Wn)return r;do t%2&&(r+=n),t=Nl(t/2),t&&(n+=n);while(t);return r}function uu(n,t){return Ls(Vi(n,t,La),n+"")}function iu(n){return Ir(ra(n))}function ou(n,t){var r=ra(n);return Xi(r,Mr(t,0,r.length))}function fu(n,t,r,e){if(!fc(n))return n;t=ku(t,n);
for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=no(t[u]),a=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(u!=o){var l=f[c];a=e?e(l,c,f):X,a===X&&(a=fc(l)?l:Ci(t[u+1])?[]:{})}Sr(f,c,a),f=f[c]}return n}function cu(n){return Xi(ra(n))}function au(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=il(u);++e<u;)i[e]=n[e+t];return i}function lu(n,t){var r;return ys(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function su(n,t,r){
var e=0,u=null==n?e:n.length;if("number"==typeof t&&t===t&&u<=Tn){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!bc(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return hu(n,t,La,r)}function hu(n,t,r,e){var u=0,i=null==n?0:n.length;if(0===i)return 0;t=r(t);for(var o=t!==t,f=null===t,c=bc(t),a=t===X;u<i;){var l=Nl((u+i)/2),s=r(n[l]),h=s!==X,p=null===s,_=s===s,v=bc(s);if(o)var g=e||_;else g=a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):!p&&!v&&(e?s<=t:s<t);g?u=l+1:i=l}return Hl(i,Bn)}function pu(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
var o=n[r],f=t?t(o):o;if(!r||!Gf(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function _u(n){return"number"==typeof n?n:bc(n)?Cn:+n}function vu(n){if("string"==typeof n)return n;if(bh(n))return c(n,vu)+"";if(bc(n))return vs?vs.call(n):"";var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function gu(n,t,r){var e=-1,u=o,i=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(i>=tn){var s=t?null:ks(n);if(s)return P(s);c=!1,u=S,l=new yr}else l=t?[]:a;n:for(;++e<i;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,c&&p===p){for(var _=l.length;_--;)if(l[_]===p)continue n;
t&&l.push(p),a.push(h)}else u(l,p,r)||(l!==a&&l.push(p),a.push(h))}return a}function yu(n,t){return t=ku(t,n),n=Gi(n,t),null==n||delete n[no(jo(t))]}function du(n,t,r,e){return fu(n,t,r(_e(n,t)),e)}function bu(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?au(n,e?0:i,e?i+1:u):au(n,e?i+1:0,e?u:i)}function wu(n,t){var r=n;return r instanceof Ct&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mu(n,t,r){var e=n.length;if(e<2)return e?gu(n[0]):[];
for(var u=-1,i=il(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=Hr(i[u]||o,n[f],t,r));return gu(ee(i,1),t,r)}function xu(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;){r(o,n[e],e<i?t[e]:X)}return o}function ju(n){return Jf(n)?n:[]}function Au(n){return"function"==typeof n?n:La}function ku(n,t){return bh(n)?n:Bi(n,t)?[n]:Cs(Ec(n))}function Ou(n,t,r){var e=n.length;return r=r===X?e:r,!t&&r>=e?n:au(n,t,r)}function Iu(n,t){if(t)return n.slice();var r=n.length,e=zl?zl(r):new n.constructor(r);
return n.copy(e),e}function Ru(n){var t=new n.constructor(n.byteLength);return new Rl(t).set(new Rl(n)),t}function zu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.byteLength)}function Eu(n){var t=new n.constructor(n.source,Nt.exec(n));return t.lastIndex=n.lastIndex,t}function Su(n){return _s?ll(_s.call(n)):{}}function Wu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.length)}function Lu(n,t){if(n!==t){var r=n!==X,e=null===n,u=n===n,i=bc(n),o=t!==X,f=null===t,c=t===t,a=bc(t);
if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Cu(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var c=Lu(u[e],i[e]);if(c){if(e>=f)return c;return c*("desc"==r[e]?-1:1)}}return n.index-t.index}function Uu(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Gl(i-o,0),l=il(c+a),s=!e;++f<c;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l;
}function Bu(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Gl(i-f,0),s=il(l+a),h=!e;++u<l;)s[u]=n[u];for(var p=u;++c<a;)s[p+c]=t[c];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function Tu(n,t){var r=-1,e=n.length;for(t||(t=il(e));++r<e;)t[r]=n[r];return t}function $u(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):X;c===X&&(c=n[f]),u?Br(r,f,c):Sr(r,f,c)}return r}function Du(n,t){return $u(n,Is(n),t)}function Mu(n,t){return $u(n,Rs(n),t);
}function Fu(n,r){return function(e,u){var i=bh(e)?t:Lr,o=r?r():{};return i(e,n,mi(u,2),o)}}function Nu(n){return uu(function(t,r){var e=-1,u=r.length,i=u>1?r[u-1]:X,o=u>2?r[2]:X;for(i=n.length>3&&"function"==typeof i?(u--,i):X,o&&Ui(r[0],r[1],o)&&(i=u<3?X:i,u=1),t=ll(t);++e<u;){var f=r[e];f&&n(t,f,e,i)}return t})}function Pu(n,t){return function(r,e){if(null==r)return r;if(!Hf(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=ll(r);(t?i--:++i<u)&&e(o[i],i,o)!==!1;);return r}}function qu(n){return function(t,r,e){
for(var u=-1,i=ll(t),o=e(t),f=o.length;f--;){var c=o[n?f:++u];if(r(i[c],c,i)===!1)break}return t}}function Zu(n,t,r){function e(){return(this&&this!==re&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=t&_n,i=Gu(n);return e}function Ku(n){return function(t){t=Ec(t);var r=T(t)?G(t):X,e=r?r[0]:t.charAt(0),u=r?Ou(r,1).join(""):t.slice(1);return e[n]()+u}}function Vu(n){return function(t){return l(Ra(ca(t).replace($r,"")),n,"")}}function Gu(n){return function(){var t=arguments;switch(t.length){
case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=gs(n.prototype),e=n.apply(r,t);return fc(e)?e:r}}function Hu(t,r,e){function u(){for(var o=arguments.length,f=il(o),c=o,a=wi(u);c--;)f[c]=arguments[c];var l=o<3&&f[0]!==a&&f[o-1]!==a?[]:N(f,a);
return o-=l.length,o<e?oi(t,r,Qu,u.placeholder,X,f,l,X,X,e-o):n(this&&this!==re&&this instanceof u?i:t,this,f)}var i=Gu(t);return u}function Ju(n){return function(t,r,e){var u=ll(t);if(!Hf(t)){var i=mi(r,3);t=Pc(t),r=function(n){return i(u[n],n,u)}}var o=n(t,r,e);return o>-1?u[i?t[o]:o]:X}}function Yu(n){return gi(function(t){var r=t.length,e=r,u=Y.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new pl(en);if(u&&!o&&"wrapper"==bi(i))var o=new Y([],!0)}for(e=o?e:r;++e<r;){
i=t[e];var f=bi(i),c="wrapper"==f?Os(i):X;o=c&&$i(c[0])&&c[1]==(mn|yn|bn|xn)&&!c[4].length&&1==c[9]?o[bi(c[0])].apply(o,c[3]):1==i.length&&$i(i)?o[f]():o.thru(i)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&bh(e))return o.plant(e).value();for(var u=0,i=r?t[u].apply(this,n):e;++u<r;)i=t[u].call(this,i);return i}})}function Qu(n,t,r,e,u,i,o,f,c,a){function l(){for(var y=arguments.length,d=il(y),b=y;b--;)d[b]=arguments[b];if(_)var w=wi(l),m=C(d,w);if(e&&(d=Uu(d,e,u,_)),i&&(d=Bu(d,i,o,_)),
y-=m,_&&y<a){return oi(n,t,Qu,l.placeholder,r,d,N(d,w),f,c,a-y)}var x=h?r:this,j=p?x[n]:n;return y=d.length,f?d=Hi(d,f):v&&y>1&&d.reverse(),s&&c<y&&(d.length=c),this&&this!==re&&this instanceof l&&(j=g||Gu(j)),j.apply(x,d)}var s=t&mn,h=t&_n,p=t&vn,_=t&(yn|dn),v=t&jn,g=p?X:Gu(n);return l}function Xu(n,t){return function(r,e){return Oe(r,n,t(e),{})}}function ni(n,t){return function(r,e){var u;if(r===X&&e===X)return t;if(r!==X&&(u=r),e!==X){if(u===X)return e;"string"==typeof r||"string"==typeof e?(r=vu(r),
e=vu(e)):(r=_u(r),e=_u(e)),u=n(r,e)}return u}}function ti(t){return gi(function(r){return r=c(r,z(mi())),uu(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ri(n,t){t=t===X?" ":vu(t);var r=t.length;if(r<2)return r?eu(t,n):t;var e=eu(t,Fl(n/V(t)));return T(t)?Ou(G(e),0,n).join(""):e.slice(0,n)}function ei(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=il(l+c),h=this&&this!==re&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];
return n(h,o?e:this,s)}var o=r&_n,f=Gu(t);return i}function ui(n){return function(t,r,e){return e&&"number"!=typeof e&&Ui(t,r,e)&&(r=e=X),t=Ac(t),r===X?(r=t,t=0):r=Ac(r),e=e===X?t<r?1:-1:Ac(e),ru(t,r,e,n)}}function ii(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Ic(t),r=Ic(r)),n(t,r)}}function oi(n,t,r,e,u,i,o,f,c,a){var l=t&yn,s=l?o:X,h=l?X:o,p=l?i:X,_=l?X:i;t|=l?bn:wn,t&=~(l?wn:bn),t&gn||(t&=~(_n|vn));var v=[n,t,u,p,s,_,h,f,c,a],g=r.apply(X,v);return $i(n)&&Ss(g,v),g.placeholder=e,
Yi(g,n,t)}function fi(n){var t=al[n];return function(n,r){if(n=Ic(n),r=null==r?0:Hl(kc(r),292),r&&Zl(n)){var e=(Ec(n)+"e").split("e");return e=(Ec(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"),+(e[0]+"e"+(+e[1]-r))}return t(n)}}function ci(n){return function(t){var r=zs(t);return r==Gn?M(t):r==tt?q(t):I(t,n(t))}}function ai(n,t,r,e,u,i,o,f){var c=t&vn;if(!c&&"function"!=typeof n)throw new pl(en);var a=e?e.length:0;if(a||(t&=~(bn|wn),e=u=X),o=o===X?o:Gl(kc(o),0),f=f===X?f:kc(f),a-=u?u.length:0,t&wn){var l=e,s=u;
e=u=X}var h=c?X:Os(n),p=[n,t,r,e,u,l,s,i,o,f];if(h&&qi(p,h),n=p[0],t=p[1],r=p[2],e=p[3],u=p[4],f=p[9]=p[9]===X?c?0:n.length:Gl(p[9]-a,0),!f&&t&(yn|dn)&&(t&=~(yn|dn)),t&&t!=_n)_=t==yn||t==dn?Hu(n,t,f):t!=bn&&t!=(_n|bn)||u.length?Qu.apply(X,p):ei(n,t,r,e);else var _=Zu(n,t,r);return Yi((h?ms:Ss)(_,p),n,t)}function li(n,t,r,e){return n===X||Gf(n,gl[r])&&!bl.call(e,r)?t:n}function si(n,t,r,e,u,i){return fc(n)&&fc(t)&&(i.set(t,n),Ke(n,t,X,si,i),i.delete(t)),n}function hi(n){return gc(n)?X:n}function pi(n,t,r,e,u,i){
var o=r&hn,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=r&pn?new yr:X;for(i.set(n,t),i.set(t,n);++s<f;){var v=n[s],g=t[s];if(e)var y=o?e(g,v,s,t,n,i):e(v,g,s,n,t,i);if(y!==X){if(y)continue;p=!1;break}if(_){if(!h(t,function(n,t){if(!S(_,t)&&(v===n||u(v,n,r,e,i)))return _.push(t)})){p=!1;break}}else if(v!==g&&!u(v,g,r,e,i)){p=!1;break}}return i.delete(n),i.delete(t),p}function _i(n,t,r,e,u,i,o){switch(r){case ct:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;
n=n.buffer,t=t.buffer;case ft:return!(n.byteLength!=t.byteLength||!i(new Rl(n),new Rl(t)));case Nn:case Pn:case Hn:return Gf(+n,+t);case Zn:return n.name==t.name&&n.message==t.message;case nt:case rt:return n==t+"";case Gn:var f=M;case tt:var c=e&hn;if(f||(f=P),n.size!=t.size&&!c)return!1;var a=o.get(n);if(a)return a==t;e|=pn,o.set(n,t);var l=pi(f(n),f(t),e,u,i,o);return o.delete(n),l;case et:if(_s)return _s.call(n)==_s.call(t)}return!1}function vi(n,t,r,e,u,i){var o=r&hn,f=yi(n),c=f.length;if(c!=yi(t).length&&!o)return!1;
for(var a=c;a--;){var l=f[a];if(!(o?l in t:bl.call(t,l)))return!1}var s=i.get(n),h=i.get(t);if(s&&h)return s==t&&h==n;var p=!0;i.set(n,t),i.set(t,n);for(var _=o;++a<c;){l=f[a];var v=n[l],g=t[l];if(e)var y=o?e(g,v,l,t,n,i):e(v,g,l,n,t,i);if(!(y===X?v===g||u(v,g,r,e,i):y)){p=!1;break}_||(_="constructor"==l)}if(p&&!_){var d=n.constructor,b=t.constructor;d!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(n),
i.delete(t),p}function gi(n){return Ls(Vi(n,X,_o),n+"")}function yi(n){return de(n,Pc,Is)}function di(n){return de(n,qc,Rs)}function bi(n){for(var t=n.name+"",r=fs[t],e=bl.call(fs,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function wi(n){return(bl.call(Z,"placeholder")?Z:n).placeholder}function mi(){var n=Z.iteratee||Ca;return n=n===Ca?De:n,arguments.length?n(arguments[0],arguments[1]):n}function xi(n,t){var r=n.__data__;return Ti(t)?r["string"==typeof t?"string":"hash"]:r.map;
}function ji(n){for(var t=Pc(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Fi(u)]}return t}function Ai(n,t){var r=B(n,t);return Ue(r)?r:X}function ki(n){var t=bl.call(n,Bl),r=n[Bl];try{n[Bl]=X;var e=!0}catch(n){}var u=xl.call(n);return e&&(t?n[Bl]=r:delete n[Bl]),u}function Oi(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Hl(t,n+o);break;case"takeRight":n=Gl(n,t-o)}}return{start:n,end:t}}function Ii(n){var t=n.match(Bt);
return t?t[1].split(Tt):[]}function Ri(n,t,r){t=ku(t,n);for(var e=-1,u=t.length,i=!1;++e<u;){var o=no(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&oc(u)&&Ci(o,u)&&(bh(n)||dh(n)))}function zi(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&bl.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ei(n){return"function"!=typeof n.constructor||Mi(n)?{}:gs(El(n))}function Si(n,t,r){var e=n.constructor;switch(t){case ft:return Ru(n);
case Nn:case Pn:return new e(+n);case ct:return zu(n,r);case at:case lt:case st:case ht:case pt:case _t:case vt:case gt:case yt:return Wu(n,r);case Gn:return new e;case Hn:case rt:return new e(n);case nt:return Eu(n);case tt:return new e;case et:return Su(n)}}function Wi(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Ut,"{\n/* [wrapped with "+t+"] */\n")}function Li(n){return bh(n)||dh(n)||!!(Cl&&n&&n[Cl])}function Ci(n,t){var r=typeof n;
return t=null==t?Wn:t,!!t&&("number"==r||"symbol"!=r&&Vt.test(n))&&n>-1&&n%1==0&&n<t}function Ui(n,t,r){if(!fc(r))return!1;var e=typeof t;return!!("number"==e?Hf(r)&&Ci(t,r.length):"string"==e&&t in r)&&Gf(r[t],n)}function Bi(n,t){if(bh(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!bc(n))||(zt.test(n)||!Rt.test(n)||null!=t&&n in ll(t))}function Ti(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}function $i(n){
var t=bi(n),r=Z[t];if("function"!=typeof r||!(t in Ct.prototype))return!1;if(n===r)return!0;var e=Os(r);return!!e&&n===e[0]}function Di(n){return!!ml&&ml in n}function Mi(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||gl)}function Fi(n){return n===n&&!fc(n)}function Ni(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==X||n in ll(r)))}}function Pi(n){var t=Cf(n,function(n){return r.size===fn&&r.clear(),n}),r=t.cache;return t}function qi(n,t){var r=n[1],e=t[1],u=r|e,i=u<(_n|vn|mn),o=e==mn&&r==yn||e==mn&&r==xn&&n[7].length<=t[8]||e==(mn|xn)&&t[7].length<=t[8]&&r==yn;
if(!i&&!o)return n;e&_n&&(n[2]=t[2],u|=r&_n?0:gn);var f=t[3];if(f){var c=n[3];n[3]=c?Uu(c,f,t[4]):f,n[4]=c?N(n[3],cn):t[4]}return f=t[5],f&&(c=n[5],n[5]=c?Bu(c,f,t[6]):f,n[6]=c?N(n[5],cn):t[6]),f=t[7],f&&(n[7]=f),e&mn&&(n[8]=null==n[8]?t[8]:Hl(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u,n}function Zi(n){var t=[];if(null!=n)for(var r in ll(n))t.push(r);return t}function Ki(n){return xl.call(n)}function Vi(t,r,e){return r=Gl(r===X?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Gl(u.length-r,0),f=il(o);++i<o;)f[i]=u[r+i];
i=-1;for(var c=il(r+1);++i<r;)c[i]=u[i];return c[r]=e(f),n(t,this,c)}}function Gi(n,t){return t.length<2?n:_e(n,au(t,0,-1))}function Hi(n,t){for(var r=n.length,e=Hl(t.length,r),u=Tu(n);e--;){var i=t[e];n[e]=Ci(i,r)?u[i]:X}return n}function Ji(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Yi(n,t,r){var e=t+"";return Ls(n,Wi(e,ro(Ii(e),r)))}function Qi(n){var t=0,r=0;return function(){var e=Jl(),u=In-(e-r);if(r=e,u>0){if(++t>=On)return arguments[0]}else t=0;
return n.apply(X,arguments)}}function Xi(n,t){var r=-1,e=n.length,u=e-1;for(t=t===X?e:t;++r<t;){var i=tu(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}function no(n){if("string"==typeof n||bc(n))return n;var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function to(n){if(null!=n){try{return dl.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function ro(n,t){return r($n,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function eo(n){if(n instanceof Ct)return n.clone();var t=new Y(n.__wrapped__,n.__chain__);
return t.__actions__=Tu(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function uo(n,t,r){t=(r?Ui(n,t,r):t===X)?1:Gl(kc(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=il(Fl(e/t));u<e;)o[i++]=au(n,u,u+=t);return o}function io(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u}function oo(){var n=arguments.length;if(!n)return[];for(var t=il(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return a(bh(r)?Tu(r):[r],ee(t,1));
}function fo(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),au(n,t<0?0:t,e)):[]}function co(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,0,t<0?0:t)):[]}function ao(n,t){return n&&n.length?bu(n,mi(t,3),!0,!0):[]}function lo(n,t){return n&&n.length?bu(n,mi(t,3),!0):[]}function so(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Ui(n,t,r)&&(r=0,e=u),ne(n,t,r,e)):[]}function ho(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);
return u<0&&(u=Gl(e+u,0)),g(n,mi(t,3),u)}function po(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==X&&(u=kc(r),u=r<0?Gl(e+u,0):Hl(u,e-1)),g(n,mi(t,3),u,!0)}function _o(n){return(null==n?0:n.length)?ee(n,1):[]}function vo(n){return(null==n?0:n.length)?ee(n,Sn):[]}function go(n,t){return(null==n?0:n.length)?(t=t===X?1:kc(t),ee(n,t)):[]}function yo(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e}function bo(n){return n&&n.length?n[0]:X}function wo(n,t,r){
var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);return u<0&&(u=Gl(e+u,0)),y(n,t,u)}function mo(n){return(null==n?0:n.length)?au(n,0,-1):[]}function xo(n,t){return null==n?"":Kl.call(n,t)}function jo(n){var t=null==n?0:n.length;return t?n[t-1]:X}function Ao(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==X&&(u=kc(r),u=u<0?Gl(e+u,0):Hl(u,e-1)),t===t?K(n,t,u):g(n,b,u,!0)}function ko(n,t){return n&&n.length?Ge(n,kc(t)):X}function Oo(n,t){return n&&n.length&&t&&t.length?Xe(n,t):n;
}function Io(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,mi(r,2)):n}function Ro(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,X,r):n}function zo(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=mi(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return nu(n,u),r}function Eo(n){return null==n?n:Xl.call(n)}function So(n,t,r){var e=null==n?0:n.length;return e?(r&&"number"!=typeof r&&Ui(n,t,r)?(t=0,r=e):(t=null==t?0:kc(t),r=r===X?e:kc(r)),au(n,t,r)):[]}function Wo(n,t){
return su(n,t)}function Lo(n,t,r){return hu(n,t,mi(r,2))}function Co(n,t){var r=null==n?0:n.length;if(r){var e=su(n,t);if(e<r&&Gf(n[e],t))return e}return-1}function Uo(n,t){return su(n,t,!0)}function Bo(n,t,r){return hu(n,t,mi(r,2),!0)}function To(n,t){if(null==n?0:n.length){var r=su(n,t,!0)-1;if(Gf(n[r],t))return r}return-1}function $o(n){return n&&n.length?pu(n):[]}function Do(n,t){return n&&n.length?pu(n,mi(t,2)):[]}function Mo(n){var t=null==n?0:n.length;return t?au(n,1,t):[]}function Fo(n,t,r){
return n&&n.length?(t=r||t===X?1:kc(t),au(n,0,t<0?0:t)):[]}function No(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,t<0?0:t,e)):[]}function Po(n,t){return n&&n.length?bu(n,mi(t,3),!1,!0):[]}function qo(n,t){return n&&n.length?bu(n,mi(t,3)):[]}function Zo(n){return n&&n.length?gu(n):[]}function Ko(n,t){return n&&n.length?gu(n,mi(t,2)):[]}function Vo(n,t){return t="function"==typeof t?t:X,n&&n.length?gu(n,X,t):[]}function Go(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){
if(Jf(n))return t=Gl(n.length,t),!0}),O(t,function(t){return c(n,m(t))})}function Ho(t,r){if(!t||!t.length)return[];var e=Go(t);return null==r?e:c(e,function(t){return n(r,X,t)})}function Jo(n,t){return xu(n||[],t||[],Sr)}function Yo(n,t){return xu(n||[],t||[],fu)}function Qo(n){var t=Z(n);return t.__chain__=!0,t}function Xo(n,t){return t(n),n}function nf(n,t){return t(n)}function tf(){return Qo(this)}function rf(){return new Y(this.value(),this.__chain__)}function ef(){this.__values__===X&&(this.__values__=jc(this.value()));
var n=this.__index__>=this.__values__.length;return{done:n,value:n?X:this.__values__[this.__index__++]}}function uf(){return this}function of(n){for(var t,r=this;r instanceof J;){var e=eo(r);e.__index__=0,e.__values__=X,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t}function ff(){var n=this.__wrapped__;if(n instanceof Ct){var t=n;return this.__actions__.length&&(t=new Ct(this)),t=t.reverse(),t.__actions__.push({func:nf,args:[Eo],thisArg:X}),new Y(t,this.__chain__)}return this.thru(Eo);
}function cf(){return wu(this.__wrapped__,this.__actions__)}function af(n,t,r){var e=bh(n)?u:Jr;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function lf(n,t){return(bh(n)?i:te)(n,mi(t,3))}function sf(n,t){return ee(yf(n,t),1)}function hf(n,t){return ee(yf(n,t),Sn)}function pf(n,t,r){return r=r===X?1:kc(r),ee(yf(n,t),r)}function _f(n,t){return(bh(n)?r:ys)(n,mi(t,3))}function vf(n,t){return(bh(n)?e:ds)(n,mi(t,3))}function gf(n,t,r,e){n=Hf(n)?n:ra(n),r=r&&!e?kc(r):0;var u=n.length;return r<0&&(r=Gl(u+r,0)),
dc(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&y(n,t,r)>-1}function yf(n,t){return(bh(n)?c:Pe)(n,mi(t,3))}function df(n,t,r,e){return null==n?[]:(bh(t)||(t=null==t?[]:[t]),r=e?X:r,bh(r)||(r=null==r?[]:[r]),He(n,t,r))}function bf(n,t,r){var e=bh(n)?l:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ys)}function wf(n,t,r){var e=bh(n)?s:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ds)}function mf(n,t){return(bh(n)?i:te)(n,Uf(mi(t,3)))}function xf(n){return(bh(n)?Ir:iu)(n)}function jf(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),
(bh(n)?Rr:ou)(n,t)}function Af(n){return(bh(n)?zr:cu)(n)}function kf(n){if(null==n)return 0;if(Hf(n))return dc(n)?V(n):n.length;var t=zs(n);return t==Gn||t==tt?n.size:Me(n).length}function Of(n,t,r){var e=bh(n)?h:lu;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function If(n,t){if("function"!=typeof t)throw new pl(en);return n=kc(n),function(){if(--n<1)return t.apply(this,arguments)}}function Rf(n,t,r){return t=r?X:t,t=n&&null==t?n.length:t,ai(n,mn,X,X,X,X,t)}function zf(n,t){var r;if("function"!=typeof t)throw new pl(en);
return n=kc(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=X),r}}function Ef(n,t,r){t=r?X:t;var e=ai(n,yn,X,X,X,X,X,t);return e.placeholder=Ef.placeholder,e}function Sf(n,t,r){t=r?X:t;var e=ai(n,dn,X,X,X,X,X,t);return e.placeholder=Sf.placeholder,e}function Wf(n,t,r){function e(t){var r=h,e=p;return h=p=X,d=t,v=n.apply(e,r)}function u(n){return d=n,g=Ws(f,t),b?e(n):v}function i(n){var r=n-y,e=n-d,u=t-r;return w?Hl(u,_-e):u}function o(n){var r=n-y,e=n-d;return y===X||r>=t||r<0||w&&e>=_;
}function f(){var n=fh();return o(n)?c(n):(g=Ws(f,i(n)),X)}function c(n){return g=X,m&&h?e(n):(h=p=X,v)}function a(){g!==X&&As(g),d=0,h=y=p=g=X}function l(){return g===X?v:c(fh())}function s(){var n=fh(),r=o(n);if(h=arguments,p=this,y=n,r){if(g===X)return u(y);if(w)return As(g),g=Ws(f,t),e(y)}return g===X&&(g=Ws(f,t)),v}var h,p,_,v,g,y,d=0,b=!1,w=!1,m=!0;if("function"!=typeof n)throw new pl(en);return t=Ic(t)||0,fc(r)&&(b=!!r.leading,w="maxWait"in r,_=w?Gl(Ic(r.maxWait)||0,t):_,m="trailing"in r?!!r.trailing:m),
s.cancel=a,s.flush=l,s}function Lf(n){return ai(n,jn)}function Cf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new pl(en);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Cf.Cache||sr),r}function Uf(n){if("function"!=typeof n)throw new pl(en);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:
return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Bf(n){return zf(2,n)}function Tf(n,t){if("function"!=typeof n)throw new pl(en);return t=t===X?t:kc(t),uu(n,t)}function $f(t,r){if("function"!=typeof t)throw new pl(en);return r=null==r?0:Gl(kc(r),0),uu(function(e){var u=e[r],i=Ou(e,0,r);return u&&a(i,u),n(t,this,i)})}function Df(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new pl(en);return fc(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),
Wf(n,t,{leading:e,maxWait:t,trailing:u})}function Mf(n){return Rf(n,1)}function Ff(n,t){return ph(Au(t),n)}function Nf(){if(!arguments.length)return[];var n=arguments[0];return bh(n)?n:[n]}function Pf(n){return Fr(n,sn)}function qf(n,t){return t="function"==typeof t?t:X,Fr(n,sn,t)}function Zf(n){return Fr(n,an|sn)}function Kf(n,t){return t="function"==typeof t?t:X,Fr(n,an|sn,t)}function Vf(n,t){return null==t||Pr(n,t,Pc(t))}function Gf(n,t){return n===t||n!==n&&t!==t}function Hf(n){return null!=n&&oc(n.length)&&!uc(n);
}function Jf(n){return cc(n)&&Hf(n)}function Yf(n){return n===!0||n===!1||cc(n)&&we(n)==Nn}function Qf(n){return cc(n)&&1===n.nodeType&&!gc(n)}function Xf(n){if(null==n)return!0;if(Hf(n)&&(bh(n)||"string"==typeof n||"function"==typeof n.splice||mh(n)||Oh(n)||dh(n)))return!n.length;var t=zs(n);if(t==Gn||t==tt)return!n.size;if(Mi(n))return!Me(n).length;for(var r in n)if(bl.call(n,r))return!1;return!0}function nc(n,t){return Se(n,t)}function tc(n,t,r){r="function"==typeof r?r:X;var e=r?r(n,t):X;return e===X?Se(n,t,X,r):!!e;
}function rc(n){if(!cc(n))return!1;var t=we(n);return t==Zn||t==qn||"string"==typeof n.message&&"string"==typeof n.name&&!gc(n)}function ec(n){return"number"==typeof n&&Zl(n)}function uc(n){if(!fc(n))return!1;var t=we(n);return t==Kn||t==Vn||t==Fn||t==Xn}function ic(n){return"number"==typeof n&&n==kc(n)}function oc(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Wn}function fc(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function cc(n){return null!=n&&"object"==typeof n}function ac(n,t){
return n===t||Ce(n,t,ji(t))}function lc(n,t,r){return r="function"==typeof r?r:X,Ce(n,t,ji(t),r)}function sc(n){return vc(n)&&n!=+n}function hc(n){if(Es(n))throw new fl(rn);return Ue(n)}function pc(n){return null===n}function _c(n){return null==n}function vc(n){return"number"==typeof n||cc(n)&&we(n)==Hn}function gc(n){if(!cc(n)||we(n)!=Yn)return!1;var t=El(n);if(null===t)return!0;var r=bl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&dl.call(r)==jl}function yc(n){
return ic(n)&&n>=-Wn&&n<=Wn}function dc(n){return"string"==typeof n||!bh(n)&&cc(n)&&we(n)==rt}function bc(n){return"symbol"==typeof n||cc(n)&&we(n)==et}function wc(n){return n===X}function mc(n){return cc(n)&&zs(n)==it}function xc(n){return cc(n)&&we(n)==ot}function jc(n){if(!n)return[];if(Hf(n))return dc(n)?G(n):Tu(n);if(Ul&&n[Ul])return D(n[Ul]());var t=zs(n);return(t==Gn?M:t==tt?P:ra)(n)}function Ac(n){if(!n)return 0===n?n:0;if(n=Ic(n),n===Sn||n===-Sn){return(n<0?-1:1)*Ln}return n===n?n:0}function kc(n){
var t=Ac(n),r=t%1;return t===t?r?t-r:t:0}function Oc(n){return n?Mr(kc(n),0,Un):0}function Ic(n){if("number"==typeof n)return n;if(bc(n))return Cn;if(fc(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=fc(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=R(n);var r=qt.test(n);return r||Kt.test(n)?Xr(n.slice(2),r?2:8):Pt.test(n)?Cn:+n}function Rc(n){return $u(n,qc(n))}function zc(n){return n?Mr(kc(n),-Wn,Wn):0===n?n:0}function Ec(n){return null==n?"":vu(n)}function Sc(n,t){var r=gs(n);return null==t?r:Cr(r,t);
}function Wc(n,t){return v(n,mi(t,3),ue)}function Lc(n,t){return v(n,mi(t,3),oe)}function Cc(n,t){return null==n?n:bs(n,mi(t,3),qc)}function Uc(n,t){return null==n?n:ws(n,mi(t,3),qc)}function Bc(n,t){return n&&ue(n,mi(t,3))}function Tc(n,t){return n&&oe(n,mi(t,3))}function $c(n){return null==n?[]:fe(n,Pc(n))}function Dc(n){return null==n?[]:fe(n,qc(n))}function Mc(n,t,r){var e=null==n?X:_e(n,t);return e===X?r:e}function Fc(n,t){return null!=n&&Ri(n,t,xe)}function Nc(n,t){return null!=n&&Ri(n,t,je);
}function Pc(n){return Hf(n)?Or(n):Me(n)}function qc(n){return Hf(n)?Or(n,!0):Fe(n)}function Zc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,t(n,e,u),n)}),r}function Kc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,e,t(n,e,u))}),r}function Vc(n,t){return Gc(n,Uf(mi(t)))}function Gc(n,t){if(null==n)return{};var r=c(di(n),function(n){return[n]});return t=mi(t),Ye(n,r,function(n,r){return t(n,r[0])})}function Hc(n,t,r){t=ku(t,n);var e=-1,u=t.length;for(u||(u=1,n=X);++e<u;){var i=null==n?X:n[no(t[e])];
i===X&&(e=u,i=r),n=uc(i)?i.call(n):i}return n}function Jc(n,t,r){return null==n?n:fu(n,t,r)}function Yc(n,t,r,e){return e="function"==typeof e?e:X,null==n?n:fu(n,t,r,e)}function Qc(n,t,e){var u=bh(n),i=u||mh(n)||Oh(n);if(t=mi(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:fc(n)&&uc(o)?gs(El(n)):{}}return(i?r:ue)(n,function(n,r,u){return t(e,n,r,u)}),e}function Xc(n,t){return null==n||yu(n,t)}function na(n,t,r){return null==n?n:du(n,t,Au(r))}function ta(n,t,r,e){return e="function"==typeof e?e:X,
null==n?n:du(n,t,Au(r),e)}function ra(n){return null==n?[]:E(n,Pc(n))}function ea(n){return null==n?[]:E(n,qc(n))}function ua(n,t,r){return r===X&&(r=t,t=X),r!==X&&(r=Ic(r),r=r===r?r:0),t!==X&&(t=Ic(t),t=t===t?t:0),Mr(Ic(n),t,r)}function ia(n,t,r){return t=Ac(t),r===X?(r=t,t=0):r=Ac(r),n=Ic(n),Ae(n,t,r)}function oa(n,t,r){if(r&&"boolean"!=typeof r&&Ui(n,t,r)&&(t=r=X),r===X&&("boolean"==typeof t?(r=t,t=X):"boolean"==typeof n&&(r=n,n=X)),n===X&&t===X?(n=0,t=1):(n=Ac(n),t===X?(t=n,n=0):t=Ac(t)),n>t){
var e=n;n=t,t=e}if(r||n%1||t%1){var u=Ql();return Hl(n+u*(t-n+Qr("1e-"+((u+"").length-1))),t)}return tu(n,t)}function fa(n){return Qh(Ec(n).toLowerCase())}function ca(n){return n=Ec(n),n&&n.replace(Gt,ve).replace(Dr,"")}function aa(n,t,r){n=Ec(n),t=vu(t);var e=n.length;r=r===X?e:Mr(kc(r),0,e);var u=r;return r-=t.length,r>=0&&n.slice(r,u)==t}function la(n){return n=Ec(n),n&&At.test(n)?n.replace(xt,ge):n}function sa(n){return n=Ec(n),n&&Wt.test(n)?n.replace(St,"\\$&"):n}function ha(n,t,r){n=Ec(n),t=kc(t);
var e=t?V(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return ri(Nl(u),r)+n+ri(Fl(u),r)}function pa(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?n+ri(t-e,r):n}function _a(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?ri(t-e,r)+n:n}function va(n,t,r){return r||null==t?t=0:t&&(t=+t),Yl(Ec(n).replace(Lt,""),t||0)}function ga(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),eu(Ec(n),t)}function ya(){var n=arguments,t=Ec(n[0]);return n.length<3?t:t.replace(n[1],n[2])}function da(n,t,r){return r&&"number"!=typeof r&&Ui(n,t,r)&&(t=r=X),
(r=r===X?Un:r>>>0)?(n=Ec(n),n&&("string"==typeof t||null!=t&&!Ah(t))&&(t=vu(t),!t&&T(n))?Ou(G(n),0,r):n.split(t,r)):[]}function ba(n,t,r){return n=Ec(n),r=null==r?0:Mr(kc(r),0,n.length),t=vu(t),n.slice(r,r+t.length)==t}function wa(n,t,r){var e=Z.templateSettings;r&&Ui(n,t,r)&&(t=X),n=Ec(n),t=Sh({},t,e,li);var u,i,o=Sh({},t.imports,e.imports,li),f=Pc(o),c=E(o,f),a=0,l=t.interpolate||Ht,s="__p += '",h=sl((t.escape||Ht).source+"|"+l.source+"|"+(l===It?Ft:Ht).source+"|"+(t.evaluate||Ht).source+"|$","g"),p="//# sourceURL="+(bl.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zr+"]")+"\n";
n.replace(h,function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(Jt,U),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t}),s+="';\n";var _=bl.call(t,"variable")&&t.variable;if(_){if(Dt.test(_))throw new fl(un)}else s="with (obj) {\n"+s+"\n}\n";s=(i?s.replace(dt,""):s).replace(bt,"$1").replace(wt,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";
var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");
if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;
c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){
return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;
if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";
}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;
}function el(n){return n&&n.length?k(n,La):0}function ul(n,t){return n&&n.length?k(n,mi(t,2)):0}x=null==x?re:be.defaults(re.Object(),x,be.pick(re,qr));var il=x.Array,ol=x.Date,fl=x.Error,cl=x.Function,al=x.Math,ll=x.Object,sl=x.RegExp,hl=x.String,pl=x.TypeError,_l=il.prototype,vl=cl.prototype,gl=ll.prototype,yl=x["__core-js_shared__"],dl=vl.toString,bl=gl.hasOwnProperty,wl=0,ml=function(){var n=/[^.]+$/.exec(yl&&yl.keys&&yl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),xl=gl.toString,jl=dl.call(ll),Al=re._,kl=sl("^"+dl.call(bl).replace(St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ol=ie?x.Buffer:X,Il=x.Symbol,Rl=x.Uint8Array,zl=Ol?Ol.allocUnsafe:X,El=F(ll.getPrototypeOf,ll),Sl=ll.create,Wl=gl.propertyIsEnumerable,Ll=_l.splice,Cl=Il?Il.isConcatSpreadable:X,Ul=Il?Il.iterator:X,Bl=Il?Il.toStringTag:X,Tl=function(){
try{var n=Ai(ll,"defineProperty");return n({},"",{}),n}catch(n){}}(),$l=x.clearTimeout!==re.clearTimeout&&x.clearTimeout,Dl=ol&&ol.now!==re.Date.now&&ol.now,Ml=x.setTimeout!==re.setTimeout&&x.setTimeout,Fl=al.ceil,Nl=al.floor,Pl=ll.getOwnPropertySymbols,ql=Ol?Ol.isBuffer:X,Zl=x.isFinite,Kl=_l.join,Vl=F(ll.keys,ll),Gl=al.max,Hl=al.min,Jl=ol.now,Yl=x.parseInt,Ql=al.random,Xl=_l.reverse,ns=Ai(x,"DataView"),ts=Ai(x,"Map"),rs=Ai(x,"Promise"),es=Ai(x,"Set"),us=Ai(x,"WeakMap"),is=Ai(ll,"create"),os=us&&new us,fs={},cs=to(ns),as=to(ts),ls=to(rs),ss=to(es),hs=to(us),ps=Il?Il.prototype:X,_s=ps?ps.valueOf:X,vs=ps?ps.toString:X,gs=function(){
function n(){}return function(t){if(!fc(t))return{};if(Sl)return Sl(t);n.prototype=t;var r=new n;return n.prototype=X,r}}();Z.templateSettings={escape:kt,evaluate:Ot,interpolate:It,variable:"",imports:{_:Z}},Z.prototype=J.prototype,Z.prototype.constructor=Z,Y.prototype=gs(J.prototype),Y.prototype.constructor=Y,Ct.prototype=gs(J.prototype),Ct.prototype.constructor=Ct,Xt.prototype.clear=nr,Xt.prototype.delete=tr,Xt.prototype.get=rr,Xt.prototype.has=er,Xt.prototype.set=ur,ir.prototype.clear=or,ir.prototype.delete=fr,
ir.prototype.get=cr,ir.prototype.has=ar,ir.prototype.set=lr,sr.prototype.clear=hr,sr.prototype.delete=pr,sr.prototype.get=_r,sr.prototype.has=vr,sr.prototype.set=gr,yr.prototype.add=yr.prototype.push=dr,yr.prototype.has=br,wr.prototype.clear=mr,wr.prototype.delete=xr,wr.prototype.get=jr,wr.prototype.has=Ar,wr.prototype.set=kr;var ys=Pu(ue),ds=Pu(oe,!0),bs=qu(),ws=qu(!0),ms=os?function(n,t){return os.set(n,t),n}:La,xs=Tl?function(n,t){return Tl(n,"toString",{configurable:!0,enumerable:!1,value:Sa(t),
writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";
if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)}),t}),Us=uu(function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]}),Bs=uu(function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]}),Ts=uu(function(n,t){
var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),X,r):[]}),$s=uu(function(n){var t=c(n,ju);return t.length&&t[0]===n[0]?ke(t):[]}),Ds=uu(function(n){var t=jo(n),r=c(n,ju);return t===jo(r)?t=X:r.pop(),r.length&&r[0]===n[0]?ke(r,mi(t,2)):[]}),Ms=uu(function(n){var t=jo(n),r=c(n,ju);return t="function"==typeof t?t:X,t&&r.pop(),r.length&&r[0]===n[0]?ke(r,X,t):[]}),Fs=uu(Oo),Ns=gi(function(n,t){var r=null==n?0:n.length,e=Tr(n,t);return nu(n,c(t,function(n){return Ci(n,r)?+n:n}).sort(Lu)),e}),Ps=uu(function(n){
return gu(ee(n,1,Jf,!0))}),qs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),gu(ee(n,1,Jf,!0),mi(t,2))}),Zs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,gu(ee(n,1,Jf,!0),X,t)}),Ks=uu(function(n,t){return Jf(n)?Hr(n,t):[]}),Vs=uu(function(n){return mu(i(n,Jf))}),Gs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),mu(i(n,Jf),mi(t,2))}),Hs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,mu(i(n,Jf),X,t)}),Js=uu(Go),Ys=uu(function(n){var t=n.length,r=t>1?n[t-1]:X;return r="function"==typeof r?(n.pop(),
r):X,Ho(n,r)}),Qs=gi(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return Tr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Ct&&Ci(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:nf,args:[u],thisArg:X}),new Y(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(X),n})):this.thru(u)}),Xs=Fu(function(n,t,r){bl.call(n,r)?++n[r]:Br(n,r,1)}),nh=Ju(ho),th=Ju(po),rh=Fu(function(n,t,r){bl.call(n,r)?n[r].push(t):Br(n,r,[t])}),eh=uu(function(t,r,e){var u=-1,i="function"==typeof r,o=Hf(t)?il(t.length):[];
return ys(t,function(t){o[++u]=i?n(r,t,e):Ie(t,r,e)}),o}),uh=Fu(function(n,t,r){Br(n,r,t)}),ih=Fu(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),oh=uu(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ui(n,t[0],t[1])?t=[]:r>2&&Ui(t[0],t[1],t[2])&&(t=[t[0]]),He(n,ee(t,1),[])}),fh=Dl||function(){return re.Date.now()},ch=uu(function(n,t,r){var e=_n;if(r.length){var u=N(r,wi(ch));e|=bn}return ai(n,e,t,r,u)}),ah=uu(function(n,t,r){var e=_n|vn;if(r.length){var u=N(r,wi(ah));e|=bn;
}return ai(t,e,n,r,u)}),lh=uu(function(n,t){return Gr(n,1,t)}),sh=uu(function(n,t,r){return Gr(n,Ic(t)||0,r)});Cf.Cache=sr;var hh=js(function(t,r){r=1==r.length&&bh(r[0])?c(r[0],z(mi())):c(ee(r,1),z(mi()));var e=r.length;return uu(function(u){for(var i=-1,o=Hl(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)})}),ph=uu(function(n,t){return ai(n,bn,X,t,N(t,wi(ph)))}),_h=uu(function(n,t){return ai(n,wn,X,t,N(t,wi(_h)))}),vh=gi(function(n,t){return ai(n,xn,X,X,X,t)}),gh=ii(me),yh=ii(function(n,t){
return n>=t}),dh=Re(function(){return arguments}())?Re:function(n){return cc(n)&&bl.call(n,"callee")&&!Wl.call(n,"callee")},bh=il.isArray,wh=ce?z(ce):ze,mh=ql||qa,xh=ae?z(ae):Ee,jh=le?z(le):Le,Ah=se?z(se):Be,kh=he?z(he):Te,Oh=pe?z(pe):$e,Ih=ii(Ne),Rh=ii(function(n,t){return n<=t}),zh=Nu(function(n,t){if(Mi(t)||Hf(t))return $u(t,Pc(t),n),X;for(var r in t)bl.call(t,r)&&Sr(n,r,t[r])}),Eh=Nu(function(n,t){$u(t,qc(t),n)}),Sh=Nu(function(n,t,r,e){$u(t,qc(t),n,e)}),Wh=Nu(function(n,t,r,e){$u(t,Pc(t),n,e);
}),Lh=gi(Tr),Ch=uu(function(n,t){n=ll(n);var r=-1,e=t.length,u=e>2?t[2]:X;for(u&&Ui(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=qc(i),f=-1,c=o.length;++f<c;){var a=o[f],l=n[a];(l===X||Gf(l,gl[a])&&!bl.call(n,a))&&(n[a]=i[a])}return n}),Uh=uu(function(t){return t.push(X,si),n(Mh,X,t)}),Bh=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),n[t]=r},Sa(La)),Th=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),bl.call(n,t)?n[t].push(r):n[t]=[r]},mi),$h=uu(Ie),Dh=Nu(function(n,t,r){
Ke(n,t,r)}),Mh=Nu(function(n,t,r,e){Ke(n,t,r,e)}),Fh=gi(function(n,t){var r={};if(null==n)return r;var e=!1;t=c(t,function(t){return t=ku(t,n),e||(e=t.length>1),t}),$u(n,di(n),r),e&&(r=Fr(r,an|ln|sn,hi));for(var u=t.length;u--;)yu(r,t[u]);return r}),Nh=gi(function(n,t){return null==n?{}:Je(n,t)}),Ph=ci(Pc),qh=ci(qc),Zh=Vu(function(n,t,r){return t=t.toLowerCase(),n+(r?fa(t):t)}),Kh=Vu(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Vh=Vu(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Gh=Ku("toLowerCase"),Hh=Vu(function(n,t,r){
return n+(r?"_":"")+t.toLowerCase()}),Jh=Vu(function(n,t,r){return n+(r?" ":"")+Qh(t)}),Yh=Vu(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Qh=Ku("toUpperCase"),Xh=uu(function(t,r){try{return n(t,X,r)}catch(n){return rc(n)?n:new fl(n)}}),np=gi(function(n,t){return r(t,function(t){t=no(t),Br(n,t,ch(n[t],n))}),n}),tp=Yu(),rp=Yu(!0),ep=uu(function(n,t){return function(r){return Ie(r,n,t)}}),up=uu(function(n,t){return function(r){return Ie(n,r,t)}}),ip=ti(c),op=ti(u),fp=ti(h),cp=ui(),ap=ui(!0),lp=ni(function(n,t){
return n+t},0),sp=fi("ceil"),hp=ni(function(n,t){return n/t},1),pp=fi("floor"),_p=ni(function(n,t){return n*t},1),vp=fi("round"),gp=ni(function(n,t){return n-t},0);return Z.after=If,Z.ary=Rf,Z.assign=zh,Z.assignIn=Eh,Z.assignInWith=Sh,Z.assignWith=Wh,Z.at=Lh,Z.before=zf,Z.bind=ch,Z.bindAll=np,Z.bindKey=ah,Z.castArray=Nf,Z.chain=Qo,Z.chunk=uo,Z.compact=io,Z.concat=oo,Z.cond=za,Z.conforms=Ea,Z.constant=Sa,Z.countBy=Xs,Z.create=Sc,Z.curry=Ef,Z.curryRight=Sf,Z.debounce=Wf,Z.defaults=Ch,Z.defaultsDeep=Uh,
Z.defer=lh,Z.delay=sh,Z.difference=Us,Z.differenceBy=Bs,Z.differenceWith=Ts,Z.drop=fo,Z.dropRight=co,Z.dropRightWhile=ao,Z.dropWhile=lo,Z.fill=so,Z.filter=lf,Z.flatMap=sf,Z.flatMapDeep=hf,Z.flatMapDepth=pf,Z.flatten=_o,Z.flattenDeep=vo,Z.flattenDepth=go,Z.flip=Lf,Z.flow=tp,Z.flowRight=rp,Z.fromPairs=yo,Z.functions=$c,Z.functionsIn=Dc,Z.groupBy=rh,Z.initial=mo,Z.intersection=$s,Z.intersectionBy=Ds,Z.intersectionWith=Ms,Z.invert=Bh,Z.invertBy=Th,Z.invokeMap=eh,Z.iteratee=Ca,Z.keyBy=uh,Z.keys=Pc,Z.keysIn=qc,
Z.map=yf,Z.mapKeys=Zc,Z.mapValues=Kc,Z.matches=Ua,Z.matchesProperty=Ba,Z.memoize=Cf,Z.merge=Dh,Z.mergeWith=Mh,Z.method=ep,Z.methodOf=up,Z.mixin=Ta,Z.negate=Uf,Z.nthArg=Ma,Z.omit=Fh,Z.omitBy=Vc,Z.once=Bf,Z.orderBy=df,Z.over=ip,Z.overArgs=hh,Z.overEvery=op,Z.overSome=fp,Z.partial=ph,Z.partialRight=_h,Z.partition=ih,Z.pick=Nh,Z.pickBy=Gc,Z.property=Fa,Z.propertyOf=Na,Z.pull=Fs,Z.pullAll=Oo,Z.pullAllBy=Io,Z.pullAllWith=Ro,Z.pullAt=Ns,Z.range=cp,Z.rangeRight=ap,Z.rearg=vh,Z.reject=mf,Z.remove=zo,Z.rest=Tf,
Z.reverse=Eo,Z.sampleSize=jf,Z.set=Jc,Z.setWith=Yc,Z.shuffle=Af,Z.slice=So,Z.sortBy=oh,Z.sortedUniq=$o,Z.sortedUniqBy=Do,Z.split=da,Z.spread=$f,Z.tail=Mo,Z.take=Fo,Z.takeRight=No,Z.takeRightWhile=Po,Z.takeWhile=qo,Z.tap=Xo,Z.throttle=Df,Z.thru=nf,Z.toArray=jc,Z.toPairs=Ph,Z.toPairsIn=qh,Z.toPath=Ha,Z.toPlainObject=Rc,Z.transform=Qc,Z.unary=Mf,Z.union=Ps,Z.unionBy=qs,Z.unionWith=Zs,Z.uniq=Zo,Z.uniqBy=Ko,Z.uniqWith=Vo,Z.unset=Xc,Z.unzip=Go,Z.unzipWith=Ho,Z.update=na,Z.updateWith=ta,Z.values=ra,Z.valuesIn=ea,
Z.without=Ks,Z.words=Ra,Z.wrap=Ff,Z.xor=Vs,Z.xorBy=Gs,Z.xorWith=Hs,Z.zip=Js,Z.zipObject=Jo,Z.zipObjectDeep=Yo,Z.zipWith=Ys,Z.entries=Ph,Z.entriesIn=qh,Z.extend=Eh,Z.extendWith=Sh,Ta(Z,Z),Z.add=lp,Z.attempt=Xh,Z.camelCase=Zh,Z.capitalize=fa,Z.ceil=sp,Z.clamp=ua,Z.clone=Pf,Z.cloneDeep=Zf,Z.cloneDeepWith=Kf,Z.cloneWith=qf,Z.conformsTo=Vf,Z.deburr=ca,Z.defaultTo=Wa,Z.divide=hp,Z.endsWith=aa,Z.eq=Gf,Z.escape=la,Z.escapeRegExp=sa,Z.every=af,Z.find=nh,Z.findIndex=ho,Z.findKey=Wc,Z.findLast=th,Z.findLastIndex=po,
Z.findLastKey=Lc,Z.floor=pp,Z.forEach=_f,Z.forEachRight=vf,Z.forIn=Cc,Z.forInRight=Uc,Z.forOwn=Bc,Z.forOwnRight=Tc,Z.get=Mc,Z.gt=gh,Z.gte=yh,Z.has=Fc,Z.hasIn=Nc,Z.head=bo,Z.identity=La,Z.includes=gf,Z.indexOf=wo,Z.inRange=ia,Z.invoke=$h,Z.isArguments=dh,Z.isArray=bh,Z.isArrayBuffer=wh,Z.isArrayLike=Hf,Z.isArrayLikeObject=Jf,Z.isBoolean=Yf,Z.isBuffer=mh,Z.isDate=xh,Z.isElement=Qf,Z.isEmpty=Xf,Z.isEqual=nc,Z.isEqualWith=tc,Z.isError=rc,Z.isFinite=ec,Z.isFunction=uc,Z.isInteger=ic,Z.isLength=oc,Z.isMap=jh,
Z.isMatch=ac,Z.isMatchWith=lc,Z.isNaN=sc,Z.isNative=hc,Z.isNil=_c,Z.isNull=pc,Z.isNumber=vc,Z.isObject=fc,Z.isObjectLike=cc,Z.isPlainObject=gc,Z.isRegExp=Ah,Z.isSafeInteger=yc,Z.isSet=kh,Z.isString=dc,Z.isSymbol=bc,Z.isTypedArray=Oh,Z.isUndefined=wc,Z.isWeakMap=mc,Z.isWeakSet=xc,Z.join=xo,Z.kebabCase=Kh,Z.last=jo,Z.lastIndexOf=Ao,Z.lowerCase=Vh,Z.lowerFirst=Gh,Z.lt=Ih,Z.lte=Rh,Z.max=Ya,Z.maxBy=Qa,Z.mean=Xa,Z.meanBy=nl,Z.min=tl,Z.minBy=rl,Z.stubArray=Pa,Z.stubFalse=qa,Z.stubObject=Za,Z.stubString=Ka,
Z.stubTrue=Va,Z.multiply=_p,Z.nth=ko,Z.noConflict=$a,Z.noop=Da,Z.now=fh,Z.pad=ha,Z.padEnd=pa,Z.padStart=_a,Z.parseInt=va,Z.random=oa,Z.reduce=bf,Z.reduceRight=wf,Z.repeat=ga,Z.replace=ya,Z.result=Hc,Z.round=vp,Z.runInContext=p,Z.sample=xf,Z.size=kf,Z.snakeCase=Hh,Z.some=Of,Z.sortedIndex=Wo,Z.sortedIndexBy=Lo,Z.sortedIndexOf=Co,Z.sortedLastIndex=Uo,Z.sortedLastIndexBy=Bo,Z.sortedLastIndexOf=To,Z.startCase=Jh,Z.startsWith=ba,Z.subtract=gp,Z.sum=el,Z.sumBy=ul,Z.template=wa,Z.times=Ga,Z.toFinite=Ac,Z.toInteger=kc,
Z.toLength=Oc,Z.toLower=ma,Z.toNumber=Ic,Z.toSafeInteger=zc,Z.toString=Ec,Z.toUpper=xa,Z.trim=ja,Z.trimEnd=Aa,Z.trimStart=ka,Z.truncate=Oa,Z.unescape=Ia,Z.uniqueId=Ja,Z.upperCase=Yh,Z.upperFirst=Qh,Z.each=_f,Z.eachRight=vf,Z.first=bo,Ta(Z,function(){var n={};return ue(Z,function(t,r){bl.call(Z.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),Z.VERSION=nn,r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){Z[n].placeholder=Z}),r(["drop","take"],function(n,t){Ct.prototype[n]=function(r){
r=r===X?1:Gl(kc(r),0);var e=this.__filtered__&&!t?new Ct(this):this.clone();return e.__filtered__?e.__takeCount__=Hl(r,e.__takeCount__):e.__views__.push({size:Hl(r,Un),type:n+(e.__dir__<0?"Right":"")}),e},Ct.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==Rn||r==En;Ct.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:mi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){
var r="take"+(t?"Right":"");Ct.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ct.prototype[n]=function(){return this.__filtered__?new Ct(this):this[r](1)}}),Ct.prototype.compact=function(){return this.filter(La)},Ct.prototype.find=function(n){return this.filter(n).head()},Ct.prototype.findLast=function(n){return this.reverse().find(n)},Ct.prototype.invokeMap=uu(function(n,t){return"function"==typeof n?new Ct(this):this.map(function(r){
return Ie(r,n,t)})}),Ct.prototype.reject=function(n){return this.filter(Uf(mi(n)))},Ct.prototype.slice=function(n,t){n=kc(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Ct(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==X&&(t=kc(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Ct.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ct.prototype.toArray=function(){return this.take(Un)},ue(Ct.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=Z[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);
u&&(Z.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ct,c=o[0],l=f||bh(t),s=function(n){var t=u.apply(Z,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new Ct(this);var g=n.apply(t,o);return g.__actions__.push({func:nf,args:[s],thisArg:X}),new Y(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})}),r(["pop","push","shift","sort","splice","unshift"],function(n){
var t=_l[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Z.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(bh(u)?u:[],n)}return this[r](function(r){return t.apply(bh(r)?r:[],n)})}}),ue(Ct.prototype,function(n,t){var r=Z[t];if(r){var e=r.name+"";bl.call(fs,e)||(fs[e]=[]),fs[e].push({name:t,func:r})}}),fs[Qu(X,vn).name]=[{name:"wrapper",func:X}],Ct.prototype.clone=$t,Ct.prototype.reverse=Yt,Ct.prototype.value=Qt,Z.prototype.at=Qs,
Z.prototype.chain=tf,Z.prototype.commit=rf,Z.prototype.next=ef,Z.prototype.plant=of,Z.prototype.reverse=ff,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=cf,Z.prototype.first=Z.prototype.head,Ul&&(Z.prototype[Ul]=uf),Z},be=de();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(re._=be,define(function(){return be})):ue?((ue.exports=be)._=be,ee._=be):re._=be}).call(this);
/*! RESOURCE: /scripts/libs/ocLazyLoad.min.js */
/**
 * oclazyload - Load modules on demand (lazy load) with angularJS
 * @version v1.0.9
 * @link https://github.com/ocombe/ocLazyLoad
 * @license MIT
 * @author Olivier Combe <olivier.combe@gmail.com>
 */
!function(e,n){"use strict";var r=["ng","oc.lazyLoad"],o={},t=[],i=[],a=[],s=[],u=e.noop,c={},l=[],d=e.module("oc.lazyLoad",["ng"]);d.provider("$ocLazyLoad",["$controllerProvider","$provide","$compileProvider","$filterProvider","$injector","$animateProvider",function(d,f,p,m,v,y){function L(n,o,t){if(o){var i,s,d,f=[];for(i=o.length-1;i>=0;i--)if(s=o[i],e.isString(s)||(s=E(s)),s&&-1===l.indexOf(s)&&(!w[s]||-1!==a.indexOf(s))){var h=-1===r.indexOf(s);if(d=g(s),h&&(r.push(s),L(n,d.requires,t)),d._runBlocks.length>0)for(c[s]=[];d._runBlocks.length>0;)c[s].push(d._runBlocks.shift());e.isDefined(c[s])&&(h||t.rerun)&&(f=f.concat(c[s])),j(n,d._invokeQueue,s,t.reconfig),j(n,d._configBlocks,s,t.reconfig),u(h?"ocLazyLoad.moduleLoaded":"ocLazyLoad.moduleReloaded",s),o.pop(),l.push(s)}var p=n.getInstanceInjector();e.forEach(f,function(e){p.invoke(e)})}}function $(n,r){function t(n,r){var o,t=!0;return r.length&&(o=i(n),e.forEach(r,function(e){t=t&&i(e)!==o})),t}function i(n){return e.isArray(n)?M(n.toString()):e.isObject(n)?M(S(n)):e.isDefined(n)&&null!==n?M(n.toString()):n}var a=n[2][0],s=n[1],c=!1;e.isUndefined(o[r])&&(o[r]={}),e.isUndefined(o[r][s])&&(o[r][s]={});var l=function(e,n){o[r][s].hasOwnProperty(e)||(o[r][s][e]=[]),t(n,o[r][s][e])&&(c=!0,o[r][s][e].push(n),u("ocLazyLoad.componentLoaded",[r,s,e]))};if(e.isString(a))l(a,n[2][1]);else{if(!e.isObject(a))return!1;e.forEach(a,function(n,r){e.isString(n)?l(n,a[1]):l(r,n)})}return c}function j(n,r,o,i){if(r){var a,s,u,c;for(a=0,s=r.length;s>a;a++)if(u=r[a],e.isArray(u)){if(null!==n){if(!n.hasOwnProperty(u[0]))throw new Error("unsupported provider "+u[0]);c=n[u[0]]}var l=$(u,o);if("invoke"!==u[1])l&&e.isDefined(c)&&c[u[1]].apply(c,u[2]);else{var d=function(n){var r=t.indexOf(o+"-"+n);(-1===r||i)&&(-1===r&&t.push(o+"-"+n),e.isDefined(c)&&c[u[1]].apply(c,u[2]))};if(e.isFunction(u[2][0]))d(u[2][0]);else if(e.isArray(u[2][0]))for(var f=0,h=u[2][0].length;h>f;f++)e.isFunction(u[2][0][f])&&d(u[2][0][f])}}}}function E(n){var r=null;return e.isString(n)?r=n:e.isObject(n)&&n.hasOwnProperty("name")&&e.isString(n.name)&&(r=n.name),r}function _(n){if(!e.isString(n))return!1;try{return g(n)}catch(r){if(/No module/.test(r)||r.message.indexOf("$injector:nomod")>-1)return!1}}var w={},O={$controllerProvider:d,$compileProvider:p,$filterProvider:m,$provide:f,$injector:v,$animateProvider:y},x=!1,b=!1,z=[],D={};z.push=function(e){-1===this.indexOf(e)&&Array.prototype.push.apply(this,arguments)},this.config=function(n){e.isDefined(n.modules)&&(e.isArray(n.modules)?e.forEach(n.modules,function(e){w[e.name]=e}):w[n.modules.name]=n.modules),e.isDefined(n.debug)&&(x=n.debug),e.isDefined(n.events)&&(b=n.events)},this._init=function(o){if(0===i.length){var t=[o],a=["ng:app","ng-app","x-ng-app","data-ng-app"],u=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/,c=function(e){return e&&t.push(e)};e.forEach(a,function(n){a[n]=!0,c(document.getElementById(n)),n=n.replace(":","\\:"),"undefined"!=typeof o[0]&&o[0].querySelectorAll&&(e.forEach(o[0].querySelectorAll("."+n),c),e.forEach(o[0].querySelectorAll("."+n+"\\:"),c),e.forEach(o[0].querySelectorAll("["+n+"]"),c))}),e.forEach(t,function(n){if(0===i.length){var r=" "+o.className+" ",t=u.exec(r);t?i.push((t[2]||"").replace(/\s+/g,",")):e.forEach(n.attributes,function(e){0===i.length&&a[e.name]&&i.push(e.value)})}})}0!==i.length||(n.jasmine||n.mocha)&&e.isDefined(e.mock)||console.error("No module found during bootstrap, unable to init ocLazyLoad. You should always use the ng-app directive or angular.boostrap when you use ocLazyLoad.");var l=function d(n){if(-1===r.indexOf(n)){r.push(n);var o=e.module(n);j(null,o._invokeQueue,n),j(null,o._configBlocks,n),e.forEach(o.requires,d)}};e.forEach(i,function(e){l(e)}),i=[],s.pop()};var S=function(n){try{return JSON.stringify(n)}catch(r){var o=[];return JSON.stringify(n,function(n,r){if(e.isObject(r)&&null!==r){if(-1!==o.indexOf(r))return;o.push(r)}return r})}},M=function(e){var n,r,o,t=0;if(0==e.length)return t;for(n=0,o=e.length;o>n;n++)r=e.charCodeAt(n),t=(t<<5)-t+r,t|=0;return t};this.$get=["$log","$rootElement","$rootScope","$cacheFactory","$q",function(n,t,a,c,d){function f(e){var r=d.defer();return n.error(e.message),r.reject(e),r.promise}var p,m=c("ocLazyLoad");return x||(n={},n.error=e.noop,n.warn=e.noop,n.info=e.noop),O.getInstanceInjector=function(){return p?p:p=t.data("$injector")||e.injector()},u=function(e,r){b&&a.$broadcast(e,r),x&&n.info(e,r)},{_broadcast:u,_$log:n,_getFilesCache:function(){return m},toggleWatch:function(e){e?s.push(!0):s.pop()},getModuleConfig:function(n){if(!e.isString(n))throw new Error("You need to give the name of the module to get");return w[n]?e.copy(w[n]):null},setModuleConfig:function(n){if(!e.isObject(n))throw new Error("You need to give the module config object to set");return w[n.name]=n,n},getModules:function(){return r},isLoaded:function(n){var o=function(e){var n=r.indexOf(e)>-1;return n||(n=!!_(e)),n};if(e.isString(n)&&(n=[n]),e.isArray(n)){var t,i;for(t=0,i=n.length;i>t;t++)if(!o(n[t]))return!1;return!0}throw new Error("You need to define the module(s) name(s)")},_getModuleName:E,_getModule:function(e){try{return g(e)}catch(n){throw(/No module/.test(n)||n.message.indexOf("$injector:nomod")>-1)&&(n.message='The module "'+S(e)+'" that you are trying to load does not exist. '+n.message),n}},moduleExists:_,_loadDependencies:function(n,r){var o,t,i,a=[],s=this;if(n=s._getModuleName(n),null===n)return d.when();try{o=s._getModule(n)}catch(u){return f(u)}return t=s.getRequires(o),e.forEach(t,function(o){if(e.isString(o)){var t=s.getModuleConfig(o);if(null===t)return void z.push(o);o=t,t.name=void 0}if(s.moduleExists(o.name))return i=o.files.filter(function(e){return s.getModuleConfig(o.name).files.indexOf(e)<0}),0!==i.length&&s._$log.warn('Module "',n,'" attempted to redefine configuration for dependency. "',o.name,'"\n Additional Files Loaded:',i),e.isDefined(s.filesLoader)?void a.push(s.filesLoader(o,r).then(function(){return s._loadDependencies(o)})):f(new Error("Error: New dependencies need to be loaded from external files ("+o.files+"), but no loader has been defined."));if(e.isArray(o)){var u=[];e.forEach(o,function(e){var n=s.getModuleConfig(e);null===n?u.push(e):n.files&&(u=u.concat(n.files))}),u.length>0&&(o={files:u})}else e.isObject(o)&&o.hasOwnProperty("name")&&o.name&&(s.setModuleConfig(o),z.push(o.name));if(e.isDefined(o.files)&&0!==o.files.length){if(!e.isDefined(s.filesLoader))return f(new Error('Error: the module "'+o.name+'" is defined in external files ('+o.files+"), but no loader has been defined."));a.push(s.filesLoader(o,r).then(function(){return s._loadDependencies(o)}))}}),d.all(a)},inject:function(n){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],t=this,a=d.defer();if(e.isDefined(n)&&null!==n){if(e.isArray(n)){var s=[];return e.forEach(n,function(e){s.push(t.inject(e,r,o))}),d.all(s)}t._addToLoadList(t._getModuleName(n),!0,o)}if(i.length>0){var u=i.slice(),c=function f(e){z.push(e),D[e]=a.promise,t._loadDependencies(e,r).then(function(){try{l=[],L(O,z,r)}catch(e){return t._$log.error(e.message),void a.reject(e)}i.length>0?f(i.shift()):a.resolve(u)},function(e){a.reject(e)})};c(i.shift())}else{if(r&&r.name&&D[r.name])return D[r.name];a.resolve()}return a.promise},getRequires:function(n){var o=[];return e.forEach(n.requires,function(e){-1===r.indexOf(e)&&o.push(e)}),o},_invokeQueue:j,_registerInvokeList:$,_register:L,_addToLoadList:h,_unregister:function(n){e.isDefined(n)&&e.isArray(n)&&e.forEach(n,function(e){o[e]=void 0})}}}],this._init(e.element(n.document))}]);var f=e.bootstrap;e.bootstrap=function(n,r,o){return e.forEach(r.slice(),function(e){h(e,!0,!0)}),f(n,r,o)};var h=function(n,r,o){(s.length>0||r)&&e.isString(n)&&-1===i.indexOf(n)&&(i.push(n),o&&a.push(n))},g=e.module;e.module=function(e,n,r){return h(e,!1,!0),g(e,n,r)},"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="oc.lazyLoad")}(angular,window),function(e){"use strict";e.module("oc.lazyLoad").directive("ocLazyLoad",["$ocLazyLoad","$compile","$animate","$parse","$timeout",function(n,r,o,t,i){return{restrict:"A",terminal:!0,priority:1e3,compile:function(i,a){var s=i[0].innerHTML;return i.html(""),function(i,a,u){var c=t(u.ocLazyLoad);i.$watch(function(){return c(i)||u.ocLazyLoad},function(t){e.isDefined(t)&&n.load(t).then(function(){o.enter(s,a),r(a.contents())(i)})},!0)}}}}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(n){n.decorator("$ocLazyLoad",["$delegate","$q","$window","$interval",function(n,r,o,t){var i=!1,a=!1,s=o.document.getElementsByTagName("head")[0]||o.document.getElementsByTagName("body")[0];return n.buildElement=function(u,c,l){var d,f,h=r.defer(),g=n._getFilesCache(),p=function(e){var n=(new Date).getTime();return e.indexOf("?")>=0?"&"===e.substring(0,e.length-1)?e+"_dc="+n:e+"&_dc="+n:e+"?_dc="+n};switch(e.isUndefined(g.get(c))&&g.put(c,h.promise),u){case"css":d=o.document.createElement("link"),d.type="text/css",d.rel="stylesheet",d.href=l.cache===!1?p(c):c;break;case"js":d=o.document.createElement("script"),d.src=l.cache===!1?p(c):c;break;default:g.remove(c),h.reject(new Error('Requested type "'+u+'" is not known. Could not inject "'+c+'"'))}d.onload=d.onreadystatechange=function(e){d.readyState&&!/^c|loade/.test(d.readyState)||f||(d.onload=d.onreadystatechange=null,f=1,n._broadcast("ocLazyLoad.fileLoaded",c),h.resolve())},d.onerror=function(){g.remove(c),h.reject(new Error("Unable to load "+c))},d.async=l.serie?0:1;var m=s.lastChild;if(l.insertBefore){var v=e.element(e.isDefined(window.jQuery)?l.insertBefore:document.querySelector(l.insertBefore));v&&v.length>0&&(m=v[0])}if(m.parentNode.insertBefore(d,m),"css"==u){if(!i){var y=o.navigator.userAgent.toLowerCase();if(/iP(hone|od|ad)/.test(o.navigator.platform)){var L=o.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),$=parseFloat([parseInt(L[1],10),parseInt(L[2],10),parseInt(L[3]||0,10)].join("."));a=6>$}else if(y.indexOf("android")>-1){var j=parseFloat(y.slice(y.indexOf("android")+8));a=4.4>j}else if(y.indexOf("safari")>-1){var E=y.match(/version\/([\.\d]+)/i);a=E&&E[1]&&parseFloat(E[1])<6}}if(a)var _=1e3,w=t(function(){try{d.sheet.cssRules,t.cancel(w),d.onload()}catch(e){--_<=0&&d.onerror()}},20)}return h.promise},n}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(n){n.decorator("$ocLazyLoad",["$delegate","$q",function(n,r){return n.filesLoader=function(o){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=[],a=[],s=[],u=[],c=null,l=n._getFilesCache();n.toggleWatch(!0),e.extend(t,o);var d=function(r){var o,d=null;if(e.isObject(r)&&(d=r.type,r=r.path),c=l.get(r),e.isUndefined(c)||t.cache===!1){if(null!==(o=/^(css|less|html|htm|js)?(?=!)/.exec(r))&&(d=o[1],r=r.substr(o[1].length+1,r.length)),!d)if(null!==(o=/[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(r)))d=o[1];else{if(n.jsLoader.hasOwnProperty("ocLazyLoadLoader")||!n.jsLoader.hasOwnProperty("requirejs"))return void n._$log.error("File type could not be determined. "+r);d="js"}"css"!==d&&"less"!==d||-1!==i.indexOf(r)?"html"!==d&&"htm"!==d||-1!==a.indexOf(r)?"js"===d||-1===s.indexOf(r)?s.push(r):n._$log.error("File type is not valid. "+r):a.push(r):i.push(r)}else c&&u.push(c)};if(t.serie?d(t.files.shift()):e.forEach(t.files,function(e){d(e)}),i.length>0){var f=r.defer();n.cssLoader(i,function(r){e.isDefined(r)&&n.cssLoader.hasOwnProperty("ocLazyLoadLoader")?(n._$log.error(r),f.reject(r)):f.resolve()},t),u.push(f.promise)}if(a.length>0){var h=r.defer();n.templatesLoader(a,function(r){e.isDefined(r)&&n.templatesLoader.hasOwnProperty("ocLazyLoadLoader")?(n._$log.error(r),h.reject(r)):h.resolve()},t),u.push(h.promise)}if(s.length>0){var g=r.defer();n.jsLoader(s,function(r){e.isDefined(r)&&(n.jsLoader.hasOwnProperty("ocLazyLoadLoader")||n.jsLoader.hasOwnProperty("requirejs"))?(n._$log.error(r),g.reject(r)):g.resolve()},t),u.push(g.promise)}if(0===u.length){var p=r.defer(),m="Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'.";return n._$log.error(m),p.reject(m),p.promise}return t.serie&&t.files.length>0?r.all(u).then(function(){return n.filesLoader(o,t)}):r.all(u)["finally"](function(e){return n.toggleWatch(!1),e})},n.load=function(o){var t,i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=this,s=null,u=[],c=r.defer(),l=e.copy(o),d=e.copy(i);if(e.isArray(l))return e.forEach(l,function(e){u.push(a.load(e,d))}),r.all(u).then(function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise;if(e.isString(l)?(s=a.getModuleConfig(l),s||(s={files:[l]})):e.isObject(l)&&(s=e.isDefined(l.path)&&e.isDefined(l.type)?{files:[l]}:a.setModuleConfig(l)),null===s){var f=a._getModuleName(l);return t='Module "'+(f||"unknown")+'" is not configured, cannot load.',n._$log.error(t),c.reject(new Error(t)),c.promise}e.isDefined(s.template)&&(e.isUndefined(s.files)&&(s.files=[]),e.isString(s.template)?s.files.push(s.template):e.isArray(s.template)&&s.files.concat(s.template));var h=e.extend({},d,s);return e.isUndefined(s.files)&&e.isDefined(s.name)&&n.moduleExists(s.name)?n.inject(s.name,h,!0):(n.filesLoader(s,h).then(function(){n.inject(null,h).then(function(e){c.resolve(e)},function(e){c.reject(e)})},function(e){c.reject(e)}),c.promise)},n}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(n){n.decorator("$ocLazyLoad",["$delegate","$q",function(n,r){return n.cssLoader=function(o,t,i){var a=[];e.forEach(o,function(e){a.push(n.buildElement("css",e,i))}),r.all(a).then(function(){t()},function(e){t(e)})},n.cssLoader.ocLazyLoadLoader=!0,n}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(n){n.decorator("$ocLazyLoad",["$delegate","$q",function(n,r){return n.jsLoader=function(o,t,i){var a=[];e.forEach(o,function(e){a.push(n.buildElement("js",e,i))}),r.all(a).then(function(){t()},function(e){t(e)})},n.jsLoader.ocLazyLoadLoader=!0,n}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(n){n.decorator("$ocLazyLoad",["$delegate","$templateCache","$q","$http",function(n,r,o,t){return n.templatesLoader=function(i,a,s){var u=[],c=n._getFilesCache();return e.forEach(i,function(n){var i=o.defer();u.push(i.promise),t.get(n,s).success(function(o){e.isString(o)&&o.length>0&&e.forEach(e.element(o),function(e){"SCRIPT"===e.nodeName&&"text/ng-template"===e.type&&r.put(e.id,e.innerHTML)}),e.isUndefined(c.get(n))&&c.put(n,!0),i.resolve()}).error(function(e){i.reject(new Error('Unable to load template file "'+n+'": '+e))})}),o.all(u).then(function(){a()},function(e){a(e)})},n.templatesLoader.ocLazyLoadLoader=!0,n}])}])}(angular),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,n){var r;if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),t=o.length>>>0;if(0===t)return-1;var i=+n||0;if(Math.abs(i)===1/0&&(i=0),i>=t)return-1;for(r=Math.max(i>=0?i:t-Math.abs(i),0);t>r;){if(r in o&&o[r]===e)return r;r++}return-1});
/*! RESOURCE: /scripts/snm/cabrillo/js_includes_cabrillo.js */
/*! RESOURCE: /scripts/snm/cabrillo/core.js */
(function(window, undefined) {
'use strict';
var cabrillo = {
isNative: isNative,
getPackageUtils: getPackageUtils,
postMethod: postMethod,
callMethod: callMethod,
receiveMethod: receiveMethod,
EXPORT_NAME: 'snmCabrillo',
CLIENT_EXPORT_NAME: 'CabrilloClient',
PACKAGE: 'com.servicenow.cabrillo',
DEBUG: true,
extend: extend,
copyValues: copyValues,
log: log,
q: QInterface()
};
window[cabrillo.EXPORT_NAME] = cabrillo;
var CabrilloClient = window[cabrillo.CLIENT_EXPORT_NAME];
var cabrilloClientConfig = {
isNative: true,
acceptObjects: false,
supportedMethods: null
};
if (typeof CabrilloClient === 'undefined') {
CabrilloClient = _getIOSClient();
if (!CabrilloClient) {
CabrilloClient = _getWebClient();
}
}
(function() {
var clientConfig = CabrilloClient.getConfig();
if (!clientConfig) {
return;
}
if (typeof clientConfig === 'string') {
clientConfig = JSON.parse(clientConfig);
}
extend(cabrilloClientConfig, clientConfig);
})();
var _methods = null;
if (cabrilloClientConfig.supportedMethods) {
_methods = {};
cabrilloClientConfig.supportedMethods.forEach(function(name) {
_methods[name] = true;
});
}
function _getIOSClient() {
var webkit = window.webkit;
var _nativeMethod = webkit && webkit.messageHandlers ? webkit.messageHandlers[cabrillo.PACKAGE + '.camera.getBarcode'] : undefined;
if (typeof _nativeMethod === 'undefined') {
return;
}
var _client = {
getConfig: function() {
return {
acceptObjects: true,
supportedMethods: null
};
},
hasMethod: function(name) {
var method = webkit ? webkit.messageHandlers[name] : undefined;
return (typeof method !== 'undefined');
},
postMethod: function(name, data) {
if (!_client.hasMethod(name)) {
log('Missing method: ' + name);
return;
}
var method = webkit.messageHandlers[name];
method.postMessage(data);
}
};
return _client;
}
function _getWebClient() {
return {
getConfig: function() {
return {
isNative: false,
acceptObjects: true,
supportedMethods: []
};
},
hasMethod: function() {
return false;
},
postMethod: function() {
}
};
}
function isNative() {
return cabrilloClientConfig.isNative;
}
function getPackageUtils(packageName) {
if (!packageName) {
cabrillo.log('Invalid package name');
return;
}
var _packageName = packageName;
function _isAvailable(methodName) {
var method = _getPackageMethodName(methodName);
return isNative() && _hasMethod(method);
}
function _getPackageMethodName(methodName) {
return [
cabrillo.PACKAGE,
_packageName,
methodName
].join('.');
}
return {
isAvailable: _isAvailable,
post: function(methodName, data) {
var method = _getPackageMethodName(methodName);
cabrillo.postMethod(method, data);
},
call: function(methodName, data) {
var method = _getPackageMethodName(methodName);
return cabrillo.callMethod(method, data);
}
};
}
function _hasMethod(name) {
if (_methods) {
return _methods[name];
}
if (CabrilloClient.hasMethod) {
return CabrilloClient.hasMethod(name);
}
return false;
}
function extend(defaults, options, newObject) {
var extended = newObject ? {} : defaults;
var prop;
for (prop in defaults) {
if (Object.prototype.hasOwnProperty.call(defaults, prop)) {
extended[prop] = defaults[prop];
}
}
for (prop in options) {
if (Object.prototype.hasOwnProperty.call(options, prop)) {
extended[prop] = options[prop];
}
}
return extended;
}
function copyValues(dest, source) {
for (var prop in source) {
if (Object.prototype.hasOwnProperty.call(source, prop)) {
switch (typeof source[prop]) {
case 'function':
break;
default:
dest[prop] = source[prop];
}
}
}
return dest;
}
function log(msg) {
if (!cabrillo.DEBUG) {
return;
}
var args = Array.prototype.slice.call(arguments, 0);
args.unshift('(Cabrillo)');
console.log.apply(console, args);
}
function postMethod(name, data) {
if (!_hasMethod(name)) {
var err = 'Missing method: ' + name;
log(err);
return false;
}
var requestPayload = {
options: data
};
_postMethod(name, requestPayload);
return true;
}
function _postMethod(name, data) {
if (!cabrilloClientConfig.acceptObjects) {
data = JSON.stringify(data);
}
CabrilloClient.postMethod(name, data);
}
var _callId = 0;
var _openCalls = {};
function callMethod(name, data, context) {
var defer = _getDeferred();
if (!_hasMethod(name)) {
var err = 'Missing method: ' + name;
defer.reject(err);
return defer.promise;
}
var callId = _callId++;
var callbackContext = extend(context, {
callId: callId
}, true);
var requestPayload = {
callbackName: cabrillo.EXPORT_NAME + '.receiveMethod',
callbackContext: callbackContext,
options: data
};
_openCalls[callId] = {
defer: defer
};
_postMethod(name, requestPayload);
return defer.promise;
}
function receiveMethod(data) {
if (!cabrilloClientConfig.acceptObjects) {
data = JSON.parse(data);
}
var context = data.callbackContext;
var openCall = _openCalls[context.callId];
if (!openCall) {
log('No open call found for request', data);
return
}
delete context.callId;
openCall.defer.resolve(data);
delete _openCalls[context.callId];
}
function _getDeferred() {
return cabrillo.q.defer();
}
function QInterface() {
return {
defer: function () {
return new QDeferred();
},
reject: function () {
return false;
}
};
};
function QDeferred() {
var dones = [];
var fails = [];
var state = null;
var payload = null;
this.promise = {
then: function(done, fail) {
dones.push(done);
fails.push(fail);
notify();
return this;
}
};
this.resolve = function(data) {
if (state) {
return;
}
state = 'done';
payload = data;
notify();
};
this.reject = function(reason) {
if (state) {
return;
}
state = 'fail';
payload = reason;
notify();
};
function notify() {
switch (state) {
case 'done':
dones.forEach(function(done) {
if (done) {
payload = done.call(done, payload);
}
});
dones = [];
fails = [];
break;
case 'fail':
fails.forEach(function(fail) {
if (fail) {
payload = fail.call(fail, payload);
}
});
dones = [];
fails = [];
break;
default:
}
}
}
})(window);
;
/*! RESOURCE: /scripts/snm/cabrillo/attachments.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'attachments';
cabrillo.extend(cabrillo, {
attachments: {
addFile: addFile,
viewFile: viewFile
}
});
var ADD_ATTACHMENTS_URL = '/angular.do?sysparm_type=ngk_attachments&action=add&load_attachment_record=true';
function addFile(tableName, sysID, params, options) {
var uploadParams = cabrillo.extend({
attachments_modified: 'true',
sysparm_table: tableName,
sysparm_sys_id: sysID,
sysparm_nostack: 'yes',
sysparm_encryption_context: ''
}, params || {});
var apiPath = ADD_ATTACHMENTS_URL + '&sys_id=' + sysID + '&table=' + tableName;
options = options || {};
return callMethod('addFile', {
apiPath: apiPath,
params: uploadParams,
uploadParamName: 'attachFile',
sourceRect: options.sourceRect,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
jpgQuality: options.jpgQuality
}).then(function(response) {
return response.results;
});
}
function viewFile(attachment, sourceRect, sourceBase64) {
return callMethod('viewFile', {
attachment: {
sys_id: attachment.sys_id,
content_type: attachment.content_type,
file_name: attachment.file_name,
sys_updated_on: attachment.sys_updated_on,
path: attachment.sys_id + '.iix',
thumbnail_path: attachment.thumbSrc
},
sourceRect: sourceRect,
sourceBase64: sourceBase64
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/auth.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'auth';
var packageUtils = cabrillo.getPackageUtils(PACKAGE);
cabrillo.extend(cabrillo, {
auth: {
reauthenticate: reauthenticate,
reauthenticateComplete: reauthenticateComplete
}
});
function reauthenticate(currentUser) {
return packageUtils.call('reauthenticate', {
user: {
sysId: currentUser.userID,
userName: currentUser.userName,
firstName: currentUser.firstName,
lastName: currentUser.lastName
}
}).then(function(data) {
var results = data.results;
if (results.reauthenticated) {
return {
sysId: currentUser.userID,
userName: currentUser.userName,
firstName: currentUser.firstName,
lastName: currentUser.lastName
};
}
return cabrillo.q.reject(data.error);
}, function(err) {
cabrillo.log('reauthenticate error: ' + err);
return cabrillo.q.reject(err);
});
}
function reauthenticateComplete(result) {
var message = {
reauthenticated: false
};
var error = result.error || null;
var user = result.user && result.user.userID ? result.user : null;
if (error) {
message.error = {
status: error.status,
message: error.message
};
} else if (user) {
message.reauthenticated = true;
message.user = {
sysId: user.userID,
userName: user.userName
};
}
packageUtils.post('reauthenticateComplete', message);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/camera.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'camera';
cabrillo.extend(cabrillo, {
camera: {
getBarcode: getBarcode
}
});
function getBarcode() {
return callMethod('getBarcode').then(function(data) {
return data.results;
}, function(err) {
cabrillo.log('Failed to get barcode value:', err);
return cabrillo.q.reject(err);
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/debug.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'debug';
cabrillo.extend(cabrillo, {
debug: {
log: log
}
});
function log(message) {
cabrillo.log(message);
callMethod('log', {
message: message
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/filter.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'filter';
cabrillo.extend(cabrillo, {
filter: {
editEncodedQuery: editEncodedQuery
}
});
function editEncodedQuery(tableName, encodedQuery) {
return callMethod('editEncodedQuery', {
table: tableName,
encodedQuery: encodedQuery
}).then(function(data) {
return data.results;
}, function(err) {
cabrillo.log('Failed to edit query:', err);
return cabrillo.q.reject(err);
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/form.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'form';
var packageUtils = cabrillo.getPackageUtils(PACKAGE);
var _isPreviewRecordAvailable = packageUtils.isAvailable('previewRecord');
cabrillo.extend(cabrillo, {
form: {
didChangeRecord: didChangeRecord,
previewRecord: previewRecord,
isPreviewRecordAvailable: isPreviewRecordAvailable
}
});
function didChangeRecord(isNewRecord, tableName, sysId) {
if (isNewRecord) {
didCreateRecord(tableName, sysId);
} else {
didUpdateRecord(tableName, sysId);
}
}
function didCreateRecord(tableName, sysId) {
callMethod('didCreateRecord', {
table: tableName,
sysId: sysId
});
}
function didUpdateRecord(tableName, sysId) {
callMethod('didUpdateRecord', {
table: tableName,
sysId: sysId
});
}
function previewRecord(tableName, referenceKey, referenceValue, view, title) {
callMethod('previewRecord', {
table: tableName,
referenceKey: referenceKey,
referenceValue: referenceValue,
view: view,
title: title
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
function isPreviewRecordAvailable() {
return _isPreviewRecordAvailable;
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/geolocation.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'geolocation';
cabrillo.extend(cabrillo, {
geolocation: {
getCurrentLocation: getCurrentLocation
}
});
function getCurrentLocation() {
return callMethod('getCurrentLocation').then(function(data) {
return data.results;
}, function(err) {
cabrillo.log('Failed to get geolocation value:', err);
return cabrillo.q.reject(err);
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/list.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'list';
cabrillo.extend(cabrillo, {
list: {
selectItem: selectItem,
selectItems: selectItems
}
});
function selectItem(title, tableName, query, selectedItem, params) {
var _selectedItem;
if (selectedItem) {
_selectedItem = {
value: selectedItem.value,
displayValue: selectedItem.displayValue
};
}
return callMethod('selectItem', {
title: title,
table: tableName,
query: query,
selectedItem: _selectedItem,
params: params
}).then(function(data) {
cabrillo.log('selectItem response', arguments);
return data.results;
});
}
function selectItems(title, tableName, query, selectedItems, params) {
return callMethod('selectItems', {
title: title,
table: tableName,
query: query,
selectedItems: selectedItems,
params: params
}).then(function(data) {
cabrillo.log('selectItems response', arguments);
return data.results;
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/modal.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'modal';
cabrillo.extend(cabrillo, {
modal: {
MODAL_PRESENTATION_STYLE_FULL_SCREEN: 'fullScreen',
MODAL_PRESENTATION_STYLE_FORM_SHEET: 'formSheet',
CLOSE_BUTTON_STYLE_CANCEL: 'cancel',
CLOSE_BUTTON_STYLE_CLOSE: 'close',
CLOSE_BUTTON_STYLE_DONE: 'done',
presentModal: presentModal,
dismissModal: dismissModal
}
});
function presentModal(title, url, closeButtonStyle, modalPresentationStyle) {
return callMethod('presentModal', {
title: title,
url: url,
closeButtonStyle: closeButtonStyle ? closeButtonStyle : null,
modalPresentationStyle: modalPresentationStyle ? modalPresentationStyle : null
}).then(function(data) {
return data.results;
}, function(err) {
cabrillo.log('presentModal error: ' + err);
});
}
function dismissModal(data, redirect) {
return callMethod('dismissModal', {
results: {
results: data,
redirect: redirect
}
});
}
function callMethod(methodName, data, context) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data, context);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/navigation.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'navigation';
var packageUtils = cabrillo.getPackageUtils(PACKAGE);
cabrillo.extend(cabrillo, {
navigation: {
goto: goto,
goBack: goBack
}
});
function goto(uri, params) {
if (!packageUtils.isAvailable('goto')) {
return false;
}
params = params || {};
packageUtils.post('goto', {
uri: uri,
table: params.table,
sysId: params.sysId,
query: params.query,
view: params.view
});
return true;
}
function goBack() {
if (!packageUtils.isAvailable('goBack')) {
return false;
}
packageUtils.post('goBack');
return true;
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/viewLayout.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'viewLayout';
var packageUtils = cabrillo.getPackageUtils(PACKAGE);
cabrillo.extend(cabrillo, {
'viewLayout': {
MORE_MENU_BUTTON_STYLE: 'moreMenuButtonStyle',
REPLACE_BACK_BUTTON_STYLE: 'replaceBackButtonStyle',
SUCCESS_SPINNER_STYLE: 'successStyle',
getTitle: getTitle,
setTitle: setTitle,
setNavigationBarButtons: setNavigationBarButtons,
setBottomButtons: setBottomButtons,
showBackButton: showBackButton,
hideBackButton: hideBackButton,
showSpinner: showSpinner,
hideSpinner: hideSpinner,
addMessage: addMessage,
clearMessages: clearMessages,
executeCallback: executeCallback
}
});
var _callbackHandlers = {};
var _callbackHandlerId = 0;
function getTitle() {
return packageUtils.call('getTitle').then(function(data) {
return data.results;
}, function(err) {
cabrillo.log('Failed to get title value:', err);
return cabrillo.q.reject(err);
});
}
function setTitle(title) {
packageUtils.post('setTitle', {
title: title
});
}
function setNavigationBarButtons(buttons, execute) {
var externalHandler = _registerCallbackHandler('registerNavigationBarButtons', buttons, execute);
return packageUtils.call('setNavigationBarButtons', {
buttons: externalHandler.payloads
}).then(function() {
return externalHandler;
}, function() {
externalHandler();
});
}
function setBottomButtons(buttons, execute) {
var externalHandler = _registerCallbackHandler('registerBottomButtons', buttons, execute);
return packageUtils.call('setBottomButtons', {
buttons: externalHandler.payloads
}).then(function() {
return externalHandler;
}, function() {
externalHandler();
});
}
function showBackButton() {
packageUtils.post('showBackButton');
}
function hideBackButton() {
packageUtils.post('hideBackButton');
}
function showSpinner(options) {
options = options || {};
var mask = options.mask;
var maskColor = options.maskColor;
packageUtils.post('showSpinner', {
mask: !!mask,
maskColor: maskColor
});
}
function hideSpinner(spinnerStyle) {
packageUtils.post('hideSpinner', {
dismissStyle: spinnerStyle
});
}
function addMessage(type, message) {
if (!packageUtils.isAvailable('addMessage')) {
return false;
}
packageUtils.post('addMessage', {
type: type,
message: message
});
return true;
}
function clearMessages() {
if (!packageUtils.isAvailable('clearMessages')) {
return false;
}
packageUtils.post('clearMessages');
return true;
}
function executeCallback(handlerPayload) {
var callbackContext = handlerPayload.callbackContext;
var handler = _callbackHandlers[callbackContext.className];
if (!handler || (handler.id !== callbackContext.id)) {
cabrillo.log('Handler not found');
return;
}
var activeElement = document.activeElement;
if (activeElement) {
activeElement.blur();
}
handler.executeCallback(callbackContext.payloadId);
}
function _registerCallbackHandler(handlerClass, payloads, executeCallback) {
if (!handlerClass) {
throw 'Handler class must be specified';
}
if (!payloads) {
payloads = [];
}
_unregisterCallbackHandler(handlerClass);
var handlerPayloads = [];
var handlerId = _callbackHandlerId++;
payloads.forEach(function(payload, payloadIndex) {
var callbackName = cabrillo.EXPORT_NAME + '.' + PACKAGE + '.executeCallback';
var handlerPayload = {
callbackName: callbackName,
callbackContext: {
id: handlerId,
className: handlerClass,
payloadId: payloadIndex
}
};
handlerPayload = cabrillo.copyValues(handlerPayload, payload);
handlerPayload.callbackScript = callbackName + '(' + JSON.stringify(handlerPayload) + ')';
handlerPayloads.push(handlerPayload);
});
var handler = function() {
var handler = _callbackHandlers[handlerClass];
if (handler && handler === this) {
handler.payloads = null;
handler.executeCallback = null;
delete _callbackHandlers[handlerClass];
}
};
handler.id = handlerId;
handler.className = handlerClass;
handler.payloads = handlerPayloads;
handler.executeCallback = function() {
var handlerPayload = arguments;
var d = cabrillo.q.defer();
d.promise.then(function() {
executeCallback.apply(this, handlerPayload);
});
d.resolve();
};
_callbackHandlers[handlerClass] = handler;
return handler;
}
function _unregisterCallbackHandler(handler) {
var className = typeof handler === 'string' ? handler : handler.className;
if (_callbackHandlers[className]) {
_callbackHandlers[className]();
}
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/message.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'message';
cabrillo.extend(cabrillo, {
'message': {
SUCCESS_MESSAGE_STYLE: 'success',
WARNING_MESSAGE_STYLE: 'warning',
ERROR_MESSAGE_STYLE: 'error',
INFO_MESSAGE_STYLE: 'info',
showMessage: showMessage
}
})
function showMessage(style, title) {
callMethod('showMessage', {
style: style,
title: title
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/flowControl.js */
(function(window, cabrillo, undefined) {
'use strict';
var PACKAGE = 'flowControl';
cabrillo.extend(cabrillo, {
'flowControl': {
flowEnded: flowEnded,
flowEndedWithUpdate: flowEndedWithUpdate
}
})
function flowEnded(flowName) {
callMethod('flowEnded', {
flowName: flowName
});
}
function flowEndedWithUpdate(flowName, clientRefreshNeeded ) {
callMethod('flowEnded', {
flowName: flowName,
clientRefreshNeeded: clientRefreshNeeded
});
}
function callMethod(methodName, data) {
return cabrillo.callMethod(cabrillo.PACKAGE + '.' + PACKAGE + '.' + methodName, data);
}
})(window, window['snmCabrillo']);
;
/*! RESOURCE: /scripts/snm/cabrillo/angular/cabrillo.factory.js */
if (typeof angular !== 'undefined') {
'use strict';
angular.module('snm.cabrillo', []).factory('cabrillo', function($window, $q) {
var cabrillo = $window['snmCabrillo'];
cabrillo.q = $q;
return cabrillo;
});
}
;
;
/*! RESOURCE: /scripts/sn/common/form/js_includes_form.js */
/*! RESOURCE: /scripts/sn/common/form/_module.js */
angular.module('sn.common.form', [
'sn.common.clientScript',
'sn.common.form.data'
]);
;
/*! RESOURCE: /scripts/sn/common/form/directive.glideFormField.js */
angular.module('sn.common.form').directive('glideFormField', function(getTemplateUrl, cabrillo, glideFormFieldFactory, i18n, $log) {
'use strict';
return {
restrict: 'E',
templateUrl: getTemplateUrl('directive_glide_form_field.xml'),
scope: {
field: '=',
tableName: '=',
getGlideForm: '&glideForm'
},
controller: function($element, $scope) {
var g_form;
$scope.requiredMsg = i18n.getMessage('Required');
if (!$scope.getGlideForm) {
$log.warn('glideFormField: Field directive is missing GlideForm');
} else {
g_form = $scope.getGlideForm();
}
var field = $scope.field;
var glideField = glideFormFieldFactory.create(field);
$scope.isReadonly = glideField.isReadonly;
$scope.isMandatory = glideField.isMandatory;
$scope.isVisible = glideField.isVisible;
$scope.hasMessages = glideField.hasMessages;
var isNative = cabrillo.isNative();
$scope.showBarcodeHelper = isNative && glideField.hasBarcodeHelper();
$scope.showCurrentLocationHelper = isNative && glideField.hasCurrentLocationHelper();
$scope.getBarcode = function() {
cabrillo.camera.getBarcode().then(function(value) {
cabrillo.log('Received barcode value: ' + value);
g_form.setValue($scope.field.name, value);
});
};
$scope.getCurrentLocation = function() {
cabrillo.geolocation.getCurrentLocation().then(function(value) {
var composite = value.coordinate.latitude +','+ value.coordinate.longitude;
g_form.setValue($scope.field.name, composite);
});
};
}
};
});
;
/*! RESOURCE: /scripts/sn/common/form/directive.recursiveHelper.js */
angular.module('sn.common.form').directive('recursiveHelper', function($compile) {
return {
restrict: "EACM",
priority: 100000,
compile: function(tElement, tAttr) {
var contents = tElement.contents().remove();
var compiledContents;
return function(scope, iElement, iAttr) {
if(!compiledContents)
compiledContents = $compile(contents);
iElement.append(compiledContents(scope, function(clone) { return clone; }));
};
}
};
});
;
/*! RESOURCE: /scripts/sn/common/form/glideUIActionsFactory.js */
angular.module('sn.common.form').factory('glideUIActionsFactory', function(urlTools, $http, $q, $log) {
'use strict';
var ACTION_OPERATIONS = {
'INSERT': 'insert',
'UPDATE': 'update'
};
var ACTION_TYPES = {
'LIST': 'list',
'FORM': 'form'
};
var ACTION_DISPLAY_TYPES = {
'LIST_BUTTON': 'list_button',
'FORM_BUTTON': 'form_button',
'FORM_MORE_ITEM': 'form_more_item'
};
return {
ACTION_OPERATIONS: ACTION_OPERATIONS,
ACTION_TYPES: ACTION_TYPES,
create: function(uiActions, options) {
return new GlideUIActions(uiActions, options);
}
};
function GlideUIActions(uiActions, options) {
if (!uiActions) {
throw 'uiActions must be provided';
}
var _uiActionsById = {};
var _uiActions = [];
options = options || {};
uiActions.forEach(function(uiAction) {
var action = new GlideUIAction(
uiAction.action_name,
uiAction.sys_id,
uiAction.name,
uiAction.disabled,
uiAction.display_types,
uiAction.navigate_back === true ? 'back' : 'default',
options.uiActionExecuter
);
_uiActionsById[action.getSysId()] = action;
_uiActions.push(action);
});
this.getActions = function() {
return _uiActions;
};
this.getAction = function(sysId) {
return _uiActionsById[sysId];
};
this.getActionByName = function(name) {
var foundAction;
_uiActions.forEach(function(action) {
if (foundAction) {
return;
}
if (name === action.getName()) {
foundAction = action;
}
});
if (!foundAction) {
name = name.toLowerCase();
_uiActions.forEach(function(action) {
if (foundAction) {
return;
}
if (name === (action.getDisplayName() || '').toLowerCase()) {
foundAction = action;
}
});
}
return foundAction;
};
}
function GlideUIAction(name, sysId, displayName, disabled, displayTypes, navigateBehavior, uiActionExecuter) {
var _inProgress = false;
var _name = name;
var _sysId = sysId;
var _displayName = displayName;
var _disabled = !!disabled;
var _navigateBehavior;
var _actionExecuter = uiActionExecuter;
switch (navigateBehavior) {
case 'back':
_navigateBehavior = 'back';
break;
default:
_navigateBehavior = 'default';
break;
}
var _displayTypes = {};
if (displayTypes) {
displayTypes.forEach(function(type) {
_displayTypes[type] = true;
});
}
this.getSysId = function() {
return _sysId;
};
this.getName = function() {
return _name;
};
this.getDisplayName = function() {
return _displayName;
};
this.getNavigateBehavior = function() {
return _navigateBehavior;
};
this.isDisabled = function() {
return _disabled;
};
this.isMoreMenuItem = function() {
return !_displayTypes[ACTION_DISPLAY_TYPES.FORM_BUTTON] && _displayTypes[ACTION_DISPLAY_TYPES.FORM_MORE_ITEM];
};
this.execute = function(g_form) {
if (this.isDisabled() || _inProgress) {
return false;
}
_inProgress = true;
return _actionExecuter(
this.getSysId(),
g_form.getTableName(),
g_form.getSysId(),
g_form.serialize(true),
g_form.getEncodedRecord()
).finally(function() {
_inProgress = false;
});
};
}
});
;
/*! RESOURCE: /scripts/sn/common/form/data/js_includes_data.js */
/*! RESOURCE: /scripts/sn/common/form/data/_module.js */
angular.module('sn.common.form.data', [
]);
;
/*! RESOURCE: /scripts/sn/common/form/data/glideUIActionsApi.js */
angular.module('sn.common.form.data').factory('glideUIActionsApi', function($http) {
'use strict';
return {
execute: execute
};
function execute(actionSysId, type, tableName, recordSysId, fields, encodedRecord, requestParams) {
return $http.post('/api/now/mobile/ui_actions/' + actionSysId + '/execute', {
sysparm_type: type,
sysparm_table: tableName,
sysparm_sys_id: recordSysId,
sysparm_encoded_record: encodedRecord,
sysparm_fields: fields,
sysparm_request_params: requestParams
});
}
});
;
;
;
/*! RESOURCE: /scripts/sn/common/resources/js_includes_resources.js */
/*! RESOURCE: /scripts/sn/common/resources/_module.js */
angular.module('sn.common.resources', [
'sn.common.i18n'
]);
;
/*! RESOURCE: /scripts/sn/common/resources/appResourcesProvider.js */
angular.module('sn.common.resources').provider('appResources', function(i18nProvider) {
'use strict';
var GLOBAL_RESOURCES_KEY = 'SN_APP_RESOURCES';
if (!angular.isDefined(window[GLOBAL_RESOURCES_KEY])) {
var $log =  angular.injector(['ng']).get('$log')
$log.warn('AppResources not defined! Check plugin configurations.');
}
var _resources = window[GLOBAL_RESOURCES_KEY] || {};
var _properties = _resources['properties'] || {};
var _messages = _resources['messages'] || [];
var _templates = _resources['templates'] || {};
var _currentUser = _resources['current_user'];
var _sessionToken = _resources['current_session_token'];
window[GLOBAL_RESOURCES_KEY] = null;
_resources = null;
if (_sessionToken) {
window.g_ck = _sessionToken;
}
_loadMessages();
function getProperty(name, defaultValue) {
var value = _properties[name];
if (!angular.isDefined(value)) {
value = defaultValue;
}
return value;
}
function getBooleanProperty(name) {
var val = getProperty(name);
return val === "true";
}
function getProperties() {
return _properties;
}
function isCurrentUserLoggedIn() {
return angular.isDefined(_currentUser) && angular.isDefined(_currentUser.user_id);
}
function getCurrentUser() {
return _currentUser;
}
function _loadMessages() {
if (_messages) {
i18nProvider.preloadMessages(_messages);
}
_messages = null;
}
function _loadTemplates($templateCache) {
if (_templates) {
angular.forEach(_templates, function(template) {
var url = template.url;
if (url.charAt(0) === '/') {
url = url.substring(1);
}
$templateCache.put(url, template.content);
});
}
_templates = null;
}
this.getProperty = getProperty;
this.getBooleanProperty = getBooleanProperty;
this.isCurrentUserLoggedIn = isCurrentUserLoggedIn;
this.getCurrentUser = getCurrentUser;
this.getProperties = getProperties;
this.$get = function($templateCache) {
_loadTemplates($templateCache);
return {
getProperty: getProperty,
getBooleanProperty: getBooleanProperty,
getProperties: getProperties,
isCurrentUserLoggedIn: isCurrentUserLoggedIn,
getCurrentUser: getCurrentUser
};
};
}).run(function(appResources) {
});
;
;
/*! RESOURCE: /scripts/snm/auth/data/snm.auth.data.module.js */
angular.module('snm.auth.data', [
'sn.common.resources'
]);
;
/*! RESOURCE: /scripts/snm/auth/data/glideUserSession.js */
angular.module('snm.auth.data').provider('glideUserSession', function glideUserSessionProvider() {
'use strict';
var _initialLoginState;
var _initialUser;
this.setCurrentUser = function(user) {
if (user) {
_initialLoginState = true;
_initialUser = {
userID: user.user_id,
userName: user.user_name,
displayValue: user.display_name,
firstName: user.first_name,
lastName: user.last_name,
email: user.email,
mobilePhone: user.mobile_phone,
phone: user.phone,
title: user.title,
avatar: user.avatar_path,
preferences: null,
allRoles: user.all_roles || null,
roles: user.roles || null
};
}
};
this.$get = function glideUserSession($rootScope, $q, $http, $log, urlTools, glideUserFactory, $window, appResources, xmlUtil) {
var $currentUser;
var _currentLoginState = false;
var _currentUser;
var publicPageUrl = $window.g_public_page_url;
$rootScope.$on('@page.login', function() {
_currentLoginState = false;
_initialLoginState = false;
$currentUser = null;
});
function loadCurrentUser(options) {
var reload = options && options.reload;
if (!$currentUser || reload) {
$currentUser = $q.defer();
if (_initialLoginState && _initialUser && !reload) {
_currentUser = glideUserFactory.create(_initialUser);
$currentUser.resolve(_currentUser);
return $currentUser.promise;
}
loadUser().then(function(user) {
_currentUser = user;
$currentUser.resolve(_currentUser);
}, function() {
if ($currentUser) {
$currentUser.reject();
}
$currentUser = null;
});
}
return $currentUser.promise;
}
function loadUser(userID) {
var params = {};
var getCurrentUser = !userID;
if (!getCurrentUser) {
params['sysparm_user_id'] = userID;
}
var src = urlTools.getURL('get_user', params);
return $http.get(src).then(function(response) {
var user = glideUserFactory.create(response.data);
if (getCurrentUser) {
user.$private = {
loginMethod: response.data.loginMethod
};
}
return user;
});
}
function isLoggedIn() {
return _initialLoginState || _currentLoginState;
}
function isExternalAuthEnabled() {
return appResources.getBooleanProperty('glide.authenticate.multisso.enabled');
}
function getDefaultIdpRedirectUrl() {
if (isExternalAuthEnabled()) {
var redirectSysId = appResources.getProperty('glide.authenticate.sso.redirect.idp');
if (redirectSysId && redirectSysId.length > 0) {
return getIdpRedirectUrl(redirectSysId);
}
}
}
function getIdpRedirectUrl(ssoId) {
if (typeof ssoId === 'undefined' || ssoId === null || ssoId === '') {
$log.warn('Invalid SSO sysId provided. Redirect URL is invalid');
}
return '/login_with_sso.do?glide_sso_id=' + encodeURIComponent(ssoId);
}
function logout(viaAjax) {
if (viaAjax) {
return $http.get('/logout.do');
}
$window.location.href = '/logout.do';
var $d = $q.defer();
return $d.promise;
}
function login(username, password, rememberMe) {
_initialLoginState = false;
$currentUser = null;
var params = {
'sysparm_type': 'login',
'ni.nolog.user_password': true,
'remember_me': !!rememberMe,
'user_name': username,
'user_password': password
};
return _sendLoginRequest(params).then(function(response) {
if (!response.data) {
$log.warn('login server failure:', response);
return $q.reject('unknown_error');
}
switch (response.data.status) {
default:
case 'error':
_currentLoginState = false;
return $q.reject('invalid_username_or_password');
case 'mfa_code_required':
_currentLoginState = false;
return $q.reject(response.data.status);
case 'success':
_currentLoginState = true;
return loadCurrentUser();
}
}, function(response) {
$log.warn('login server failure:', response);
_currentLoginState = false;
return $q.reject('unknown_error');
});
}
function requestMfaCode() {
return _sendLoginRequest({send_mfa_code: true}).then(function(response) {
var status;
if (!response.data) {
status = $q.reject('unknown_error');
} else if (response.data.status === 'send_mfa_code_success') {
status = $q.resolve('success');
} else {
status = $q.reject('send_mfa_code_failure');
}
return status;
}, function(response) {
$log.warn('mfa code delivery error:', response);
return $q.reject('unknown_error');
});
}
function validateMfaCode(mfaCode) {
var params = {
'sysparm_type': 'login',
'validate_mfa_code': true,
'mfa_code': mfaCode
};
return _sendLoginRequest(params).then(function(response) {
if (!response.data) {
_currentLoginState = false;
return $q.reject('unknown_error');
}
_currentLoginState = response.data.status === 'success';
if (!_currentLoginState) {
return $q.reject('invalid_mfa_code');
}
return loadCurrentUser();
}, function(response) {
$log.warn('mfa validation server error:', response);
return $q.reject('unknown_error');
});
}
function _sendLoginRequest(params) {
return $http({
method: 'POST',
url: urlTools.getURL('view_form.login'),
data: urlTools.encodeURIParameters(params),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
}
function getSsoRedirectUrlForUsername(username) {
var $d = $q.defer();
$http({
method: 'POST',
url: '/xmlhttp.do',
data: urlTools.encodeURIParameters({
sysparm_processor: 'MultiSSO_ClientHelper',
sysparm_scope: 'global',
sysparm_name: 'ssoByUser',
sysparm_user_id: username
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
transformResponse: function(response) {
return xmlUtil.getDataFromXml(response, 'result');
}
}).then(
function(response) {
var data = response.data[0];
var url;
if (data) {
if (data.glide_sso_id) {
url = getIdpRedirectUrl(data.glide_sso_id);
} else {
url = data.discovery_service_url;
}
setStartingPageUrl().then(function(data) {
console.log("Starting page set to", data);
$d.resolve(url);
}, function (err) {
$d.reject(err);
});
} else {
$d.reject('No external identity provider found for the username: ' + username);
}
},
function(err) {
$d.reject(err);
}
);
return $d.promise;
}
function setStartingPageUrl() {
var $d = $q.defer();
$http({
method: 'POST',
url: '/xmlhttp.do',
data: urlTools.encodeURIParameters({
sysparm_processor: 'MobileLoginHelper',
sysparm_scope: 'global',
sysparm_name: 'setStartingPageUrl',
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
transformResponse: function(response) {
return xmlUtil.getDataFromXml(response, 'result');
}
}).then(
function (response) {
var data = response.data;
$d.resolve(data);
},
function (err) {
$d.reject(err);
}
);
return $d.promise;
}
function getPublicPageUrl() {
return publicPageUrl;
}
function clearPublicPageUrl() {
publicPageUrl = null;
}
function getSsoReauthenticationUrl(ssoProviderSysId) {
var postParams = {
sysparm_scope: 'global',
sysparm_processor: 'ESignatureUtils',
sysparm_name: 'createSsoReauthenticationUrl'
};
if (ssoProviderSysId) {
postParams['glide_sso_id'] = ssoProviderSysId;
}
return $http({
method: 'POST',
url: '/xmlhttp.do',
data: urlTools.encodeURIParameters(postParams),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
transformResponse: function(response) {
return xmlUtil.getDataFromXml(response, 'result');
}
}).then(
function(response) {
var data = response.data ? response.data[0] : {};
if (data.error) {
return $q.reject({
message: data.error
});
}
return data.url;
},
function(response) {
switch (response.status) {
default:
case 404:
return $q.reject({
message: 'Cannot determine external authentication provider'
});
}
}
);
}
return {
loadCurrentUser: loadCurrentUser,
isLoggedIn: isLoggedIn,
logout: logout,
login: login,
requestMfaCode: requestMfaCode,
validateMfaCode: validateMfaCode,
isExternalAuthEnabled: isExternalAuthEnabled,
getDefaultIdpRedirectUrl: getDefaultIdpRedirectUrl,
getSsoRedirectUrlForUsername: getSsoRedirectUrlForUsername,
getSsoReauthenticationUrl: getSsoReauthenticationUrl,
loadUser: loadUser,
getPublicPageUrl: getPublicPageUrl,
clearPublicPageUrl: clearPublicPageUrl
};
};
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/js_includes_clientScript.js */
/*! RESOURCE: /scripts/sn/common/clientScript/dist/clientScript_components.js */
!function(b,a){"function"==typeof define&&define.amd?define([],a):b.amdWeb=a()}(this,function(){"function"!=typeof Array.prototype.indexOf&&(Array.prototype.indexOf=function(d,a){var b,c=this.length;if(!c)return-1;if(a=Number(a),("number"!=typeof a||isNaN(a))&&(a=0),a>=c)return-1;for(0>a&&(a=c-Math.abs(a)),b=a;c>b;b++)if(this[b]===d)return b;return-1}),"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(a){var b,d,c,e;if("function"!=typeof this)throw new TypeError("Target is not callable, and unable to be bound");return b=Array.prototype.slice,d=b.call(arguments,1),c=this,"undefined"==typeof a&&(a=c),e=function(){var e=b.call(arguments,0);return c.apply(a,d.concat(e))}})});
(function() {
"use strict";
function $$utils$$objectOrFunction(x) {
return typeof x === 'function' || (typeof x === 'object' && x !== null);
}
function $$utils$$isFunction(x) {
return typeof x === 'function';
}
function $$utils$$isMaybeThenable(x) {
return typeof x === 'object' && x !== null;
}
var $$utils$$_isArray;
if (!Array.isArray) {
$$utils$$_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
$$utils$$_isArray = Array.isArray;
}
var $$utils$$isArray = $$utils$$_isArray;
var $$utils$$now = Date.now || function() { return new Date().getTime(); };
function $$utils$$F() { }
var $$utils$$o_create = (Object.create || function (o) {
if (arguments.length > 1) {
throw new Error('Second argument not supported');
}
if (typeof o !== 'object') {
throw new TypeError('Argument must be an object');
}
$$utils$$F.prototype = o;
return new $$utils$$F();
});
var $$asap$$len = 0;
var $$asap$$default = function asap(callback, arg) {
$$asap$$queue[$$asap$$len] = callback;
$$asap$$queue[$$asap$$len + 1] = arg;
$$asap$$len += 2;
if ($$asap$$len === 2) {
$$asap$$scheduleFlush();
}
};
var $$asap$$browserGlobal = (typeof window !== 'undefined') ? window : {};
var $$asap$$BrowserMutationObserver = $$asap$$browserGlobal.MutationObserver || $$asap$$browserGlobal.WebKitMutationObserver;
var $$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
typeof importScripts !== 'undefined' &&
typeof MessageChannel !== 'undefined';
function $$asap$$useNextTick() {
return function() {
process.nextTick($$asap$$flush);
};
}
function $$asap$$useMutationObserver() {
var iterations = 0;
var observer = new $$asap$$BrowserMutationObserver($$asap$$flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
function $$asap$$useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = $$asap$$flush;
return function () {
channel.port2.postMessage(0);
};
}
function $$asap$$useSetTimeout() {
return function() {
setTimeout($$asap$$flush, 1);
};
}
var $$asap$$queue = new Array(1000);
function $$asap$$flush() {
for (var i = 0; i < $$asap$$len; i+=2) {
var callback = $$asap$$queue[i];
var arg = $$asap$$queue[i+1];
callback(arg);
$$asap$$queue[i] = undefined;
$$asap$$queue[i+1] = undefined;
}
$$asap$$len = 0;
}
var $$asap$$scheduleFlush;
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
$$asap$$scheduleFlush = $$asap$$useNextTick();
} else if ($$asap$$BrowserMutationObserver) {
$$asap$$scheduleFlush = $$asap$$useMutationObserver();
} else if ($$asap$$isWorker) {
$$asap$$scheduleFlush = $$asap$$useMessageChannel();
} else {
$$asap$$scheduleFlush = $$asap$$useSetTimeout();
}
function $$$internal$$noop() {}
var $$$internal$$PENDING   = void 0;
var $$$internal$$FULFILLED = 1;
var $$$internal$$REJECTED  = 2;
var $$$internal$$GET_THEN_ERROR = new $$$internal$$ErrorObject();
function $$$internal$$selfFullfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function $$$internal$$cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.')
}
function $$$internal$$getThen(promise) {
try {
return promise.then;
} catch(error) {
$$$internal$$GET_THEN_ERROR.error = error;
return $$$internal$$GET_THEN_ERROR;
}
}
function $$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then.call(value, fulfillmentHandler, rejectionHandler);
} catch(e) {
return e;
}
}
function $$$internal$$handleForeignThenable(promise, thenable, then) {
$$asap$$default(function(promise) {
var sealed = false;
var error = $$$internal$$tryThen(then, thenable, function(value) {
if (sealed) { return; }
sealed = true;
if (thenable !== value) {
$$$internal$$resolve(promise, value);
} else {
$$$internal$$fulfill(promise, value);
}
}, function(reason) {
if (sealed) { return; }
sealed = true;
$$$internal$$reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
$$$internal$$reject(promise, error);
}
}, promise);
}
function $$$internal$$handleOwnThenable(promise, thenable) {
if (thenable._state === $$$internal$$FULFILLED) {
$$$internal$$fulfill(promise, thenable._result);
} else if (promise._state === $$$internal$$REJECTED) {
$$$internal$$reject(promise, thenable._result);
} else {
$$$internal$$subscribe(thenable, undefined, function(value) {
$$$internal$$resolve(promise, value);
}, function(reason) {
$$$internal$$reject(promise, reason);
});
}
}
function $$$internal$$handleMaybeThenable(promise, maybeThenable) {
if (maybeThenable.constructor === promise.constructor) {
$$$internal$$handleOwnThenable(promise, maybeThenable);
} else {
var then = $$$internal$$getThen(maybeThenable);
if (then === $$$internal$$GET_THEN_ERROR) {
$$$internal$$reject(promise, $$$internal$$GET_THEN_ERROR.error);
} else if (then === undefined) {
$$$internal$$fulfill(promise, maybeThenable);
} else if ($$utils$$isFunction(then)) {
$$$internal$$handleForeignThenable(promise, maybeThenable, then);
} else {
$$$internal$$fulfill(promise, maybeThenable);
}
}
}
function $$$internal$$resolve(promise, value) {
if (promise === value) {
$$$internal$$reject(promise, $$$internal$$selfFullfillment());
} else if ($$utils$$objectOrFunction(value)) {
$$$internal$$handleMaybeThenable(promise, value);
} else {
$$$internal$$fulfill(promise, value);
}
}
function $$$internal$$publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
$$$internal$$publish(promise);
}
function $$$internal$$fulfill(promise, value) {
if (promise._state !== $$$internal$$PENDING) { return; }
promise._result = value;
promise._state = $$$internal$$FULFILLED;
if (promise._subscribers.length === 0) {
} else {
$$asap$$default($$$internal$$publish, promise);
}
}
function $$$internal$$reject(promise, reason) {
if (promise._state !== $$$internal$$PENDING) { return; }
promise._state = $$$internal$$REJECTED;
promise._result = reason;
$$asap$$default($$$internal$$publishRejection, promise);
}
function $$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
parent._onerror = null;
subscribers[length] = child;
subscribers[length + $$$internal$$FULFILLED] = onFulfillment;
subscribers[length + $$$internal$$REJECTED]  = onRejection;
if (length === 0 && parent._state) {
$$asap$$default($$$internal$$publish, parent);
}
}
function $$$internal$$publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) { return; }
var child, callback, detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
$$$internal$$invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function $$$internal$$ErrorObject() {
this.error = null;
}
var $$$internal$$TRY_CATCH_ERROR = new $$$internal$$ErrorObject();
function $$$internal$$tryCatch(callback, detail) {
try {
return callback(detail);
} catch(e) {
$$$internal$$TRY_CATCH_ERROR.error = e;
return $$$internal$$TRY_CATCH_ERROR;
}
}
function $$$internal$$invokeCallback(settled, promise, callback, detail) {
var hasCallback = $$utils$$isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
value = $$$internal$$tryCatch(callback, detail);
if (value === $$$internal$$TRY_CATCH_ERROR) {
failed = true;
error = value.error;
value = null;
} else {
succeeded = true;
}
if (promise === value) {
$$$internal$$reject(promise, $$$internal$$cannotReturnOwn());
return;
}
} else {
value = detail;
succeeded = true;
}
if (promise._state !== $$$internal$$PENDING) {
} else if (hasCallback && succeeded) {
$$$internal$$resolve(promise, value);
} else if (failed) {
$$$internal$$reject(promise, error);
} else if (settled === $$$internal$$FULFILLED) {
$$$internal$$fulfill(promise, value);
} else if (settled === $$$internal$$REJECTED) {
$$$internal$$reject(promise, value);
}
}
function $$$internal$$initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value){
$$$internal$$resolve(promise, value);
}, function rejectPromise(reason) {
$$$internal$$reject(promise, reason);
});
} catch(e) {
$$$internal$$reject(promise, e);
}
}
function $$$enumerator$$makeSettledResult(state, position, value) {
if (state === $$$internal$$FULFILLED) {
return {
state: 'fulfilled',
value: value
};
} else {
return {
state: 'rejected',
reason: value
};
}
}
function $$$enumerator$$Enumerator(Constructor, input, abortOnReject, label) {
this._instanceConstructor = Constructor;
this.promise = new Constructor($$$internal$$noop, label);
this._abortOnReject = abortOnReject;
if (this._validateInput(input)) {
this._input     = input;
this.length     = input.length;
this._remaining = input.length;
this._init();
if (this.length === 0) {
$$$internal$$fulfill(this.promise, this._result);
} else {
this.length = this.length || 0;
this._enumerate();
if (this._remaining === 0) {
$$$internal$$fulfill(this.promise, this._result);
}
}
} else {
$$$internal$$reject(this.promise, this._validationError());
}
}
$$$enumerator$$Enumerator.prototype._validateInput = function(input) {
return $$utils$$isArray(input);
};
$$$enumerator$$Enumerator.prototype._validationError = function() {
return new Error('Array Methods must be provided an Array');
};
$$$enumerator$$Enumerator.prototype._init = function() {
this._result = new Array(this.length);
};
var $$$enumerator$$default = $$$enumerator$$Enumerator;
$$$enumerator$$Enumerator.prototype._enumerate = function() {
var length  = this.length;
var promise = this.promise;
var input   = this._input;
for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
this._eachEntry(input[i], i);
}
};
$$$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
var c = this._instanceConstructor;
if ($$utils$$isMaybeThenable(entry)) {
if (entry.constructor === c && entry._state !== $$$internal$$PENDING) {
entry._onerror = null;
this._settledAt(entry._state, i, entry._result);
} else {
this._willSettleAt(c.resolve(entry), i);
}
} else {
this._remaining--;
this._result[i] = this._makeResult($$$internal$$FULFILLED, i, entry);
}
};
$$$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
var promise = this.promise;
if (promise._state === $$$internal$$PENDING) {
this._remaining--;
if (this._abortOnReject && state === $$$internal$$REJECTED) {
$$$internal$$reject(promise, value);
} else {
this._result[i] = this._makeResult(state, i, value);
}
}
if (this._remaining === 0) {
$$$internal$$fulfill(promise, this._result);
}
};
$$$enumerator$$Enumerator.prototype._makeResult = function(state, i, value) {
return value;
};
$$$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
var enumerator = this;
$$$internal$$subscribe(promise, undefined, function(value) {
enumerator._settledAt($$$internal$$FULFILLED, i, value);
}, function(reason) {
enumerator._settledAt($$$internal$$REJECTED, i, reason);
});
};
var $$promise$all$$default = function all(entries, label) {
return new $$$enumerator$$default(this, entries, true , label).promise;
};
var $$promise$race$$default = function race(entries, label) {
var Constructor = this;
var promise = new Constructor($$$internal$$noop, label);
if (!$$utils$$isArray(entries)) {
$$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
return promise;
}
var length = entries.length;
function onFulfillment(value) {
$$$internal$$resolve(promise, value);
}
function onRejection(reason) {
$$$internal$$reject(promise, reason);
}
for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
$$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
}
return promise;
};
var $$promise$resolve$$default = function resolve(object, label) {
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor($$$internal$$noop, label);
$$$internal$$resolve(promise, object);
return promise;
};
var $$promise$reject$$default = function reject(reason, label) {
var Constructor = this;
var promise = new Constructor($$$internal$$noop, label);
$$$internal$$reject(promise, reason);
return promise;
};
var $$es6$promise$promise$$counter = 0;
function $$es6$promise$promise$$needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function $$es6$promise$promise$$needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
var $$es6$promise$promise$$default = $$es6$promise$promise$$Promise;
function $$es6$promise$promise$$Promise(resolver) {
this._id = $$es6$promise$promise$$counter++;
this._state = undefined;
this._result = undefined;
this._subscribers = [];
if ($$$internal$$noop !== resolver) {
if (!$$utils$$isFunction(resolver)) {
$$es6$promise$promise$$needsResolver();
}
if (!(this instanceof $$es6$promise$promise$$Promise)) {
$$es6$promise$promise$$needsNew();
}
$$$internal$$initializePromise(this, resolver);
}
}
$$es6$promise$promise$$Promise.all = $$promise$all$$default;
$$es6$promise$promise$$Promise.race = $$promise$race$$default;
$$es6$promise$promise$$Promise.resolve = $$promise$resolve$$default;
$$es6$promise$promise$$Promise.reject = $$promise$reject$$default;
$$es6$promise$promise$$Promise.prototype = {
constructor: $$es6$promise$promise$$Promise,
then: function(onFulfillment, onRejection) {
var parent = this;
var state = parent._state;
if (state === $$$internal$$FULFILLED && !onFulfillment || state === $$$internal$$REJECTED && !onRejection) {
return this;
}
var child = new this.constructor($$$internal$$noop);
var result = parent._result;
if (state) {
var callback = arguments[state - 1];
$$asap$$default(function(){
$$$internal$$invokeCallback(state, child, callback, result);
});
} else {
$$$internal$$subscribe(parent, child, onFulfillment, onRejection);
}
return child;
},
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
var $$es6$promise$polyfill$$default = function polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof window !== 'undefined' && window.document) {
local = window;
} else {
local = self;
}
var es6PromiseSupport =
"Promise" in local &&
"resolve" in local.Promise &&
"reject" in local.Promise &&
"all" in local.Promise &&
"race" in local.Promise &&
(function() {
var resolve;
new local.Promise(function(r) { resolve = r; });
return $$utils$$isFunction(resolve);
}());
if (!es6PromiseSupport) {
local.Promise = $$es6$promise$promise$$default;
}
};
var es6$promise$umd$$ES6Promise = {
'Promise': $$es6$promise$promise$$default,
'polyfill': $$es6$promise$polyfill$$default
};
if (typeof define === 'function' && define['amd']) {
define(function() { return es6$promise$umd$$ES6Promise; });
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = es6$promise$umd$$ES6Promise;
} else if (typeof this !== 'undefined') {
this['ES6Promise'] = es6$promise$umd$$ES6Promise;
}
}).call(this);
(function() {
'use strict';
if (self.fetch) {
return
}
function Headers(headers) {
this.map = {}
var self = this
if (headers instanceof Headers) {
headers.forEach(function(name, values) {
values.forEach(function(value) {
self.append(name, value)
})
})
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function(name) {
self.append(name, headers[name])
})
}
}
Headers.prototype.append = function(name, value) {
name = name.toLowerCase()
var list = this.map[name]
if (!list) {
list = []
this.map[name] = list
}
list.push(value)
}
Headers.prototype['delete'] = function(name) {
delete this.map[name.toLowerCase()]
}
Headers.prototype.get = function(name) {
var values = this.map[name.toLowerCase()]
return values ? values[0] : null
}
Headers.prototype.getAll = function(name) {
return this.map[name.toLowerCase()] || []
}
Headers.prototype.has = function(name) {
return this.map.hasOwnProperty(name.toLowerCase())
}
Headers.prototype.set = function(name, value) {
this.map[name.toLowerCase()] = [value]
}
Headers.prototype.forEach = function(callback) {
var self = this
Object.getOwnPropertyNames(this.map).forEach(function(name) {
callback(name, self.map[name])
})
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed = true
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result)
}
reader.onerror = function() {
reject(reader.error)
}
})
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader()
reader.readAsArrayBuffer(blob)
return fileReaderReady(reader)
}
function readBlobAsText(blob) {
var reader = new FileReader()
reader.readAsText(blob)
return fileReaderReady(reader)
}
var support = {
blob: 'FileReader' in self && 'Blob' in self && (function() {
try {
new Blob();
return true
} catch(e) {
return false
}
})(),
formData: 'FormData' in self
}
function Body() {
this.bodyUsed = false
if (support.blob) {
this._initBody = function(body) {
this._bodyInit = body
if (typeof body === 'string') {
this._bodyText = body
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body
} else if (!body) {
this._bodyText = ''
} else {
throw new Error('unsupported BodyInit type')
}
}
this.blob = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
return Promise.resolve(new Blob([this._bodyText]))
}
}
this.arrayBuffer = function() {
return this.blob().then(readBlobAsArrayBuffer)
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
}
} else {
this._initBody = function(body) {
this._bodyInit = body
if (typeof body === 'string') {
this._bodyText = body
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body
} else if (!body) {
this._bodyText = ''
} else {
throw new Error('unsupported BodyInit type')
}
}
this.text = function() {
var rejected = consumed(this)
return rejected ? rejected : Promise.resolve(this._bodyText)
}
}
if (support.formData) {
this.formData = function() {
return this.text().then(decode)
}
}
this.json = function() {
return this.text().then(JSON.parse)
}
return this
}
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
function normalizeMethod(method) {
var upcased = method.toUpperCase()
return (methods.indexOf(upcased) > -1) ? upcased : method
}
function Request(url, options) {
options = options || {}
this.url = url
this.credentials = options.credentials || 'omit'
this.headers = new Headers(options.headers)
this.method = normalizeMethod(options.method || 'GET')
this.mode = options.mode || null
this.referrer = null
if ((this.method === 'GET' || this.method === 'HEAD') && options.body) {
throw new TypeError('Body not allowed for GET or HEAD requests')
}
this._initBody(options.body)
}
function decode(body) {
var form = new FormData()
body.trim().split('&').forEach(function(bytes) {
if (bytes) {
var split = bytes.split('=')
var name = split.shift().replace(/\+/g, ' ')
var value = split.join('=').replace(/\+/g, ' ')
form.append(decodeURIComponent(name), decodeURIComponent(value))
}
})
return form
}
function headers(xhr) {
var head = new Headers()
var pairs = xhr.getAllResponseHeaders().trim().split('\n')
pairs.forEach(function(header) {
var split = header.trim().split(':')
var key = split.shift().trim()
var value = split.join(':').trim()
head.append(key, value)
})
return head
}
Request.prototype.fetch = function() {
var self = this
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest()
if (self.credentials === 'cors') {
xhr.withCredentials = true;
}
function responseURL() {
if ('responseURL' in xhr) {
return xhr.responseURL
}
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL')
}
return;
}
xhr.onload = function() {
var status = (xhr.status === 1223) ? 204 : xhr.status
if (status < 100 || status > 599) {
reject(new TypeError('Network request failed'))
return
}
var options = {
status: status,
statusText: xhr.statusText,
headers: headers(xhr),
url: responseURL()
}
var body = 'response' in xhr ? xhr.response : xhr.responseText;
resolve(new Response(body, options))
}
xhr.onerror = function() {
reject(new TypeError('Network request failed'))
}
xhr.open(self.method, self.url, true)
if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob'
}
self.headers.forEach(function(name, values) {
values.forEach(function(value) {
xhr.setRequestHeader(name, value)
})
})
xhr.send(typeof self._bodyInit === 'undefined' ? null : self._bodyInit)
})
}
Body.call(Request.prototype)
function Response(bodyInit, options) {
if (!options) {
options = {}
}
this._initBody(bodyInit)
this.type = 'default'
this.url = null
this.status = options.status
this.statusText = options.statusText
this.headers = options.headers
this.url = options.url || ''
}
Body.call(Response.prototype)
self.Headers = Headers;
self.Request = Request;
self.Response = Response;
self.fetch = function (url, options) {
return new Request(url, options).fetch()
}
self.fetch.polyfill = true
})();
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideFormFieldFactory.js */
(function(exports, undefined) {
'use strict';
var IS_INITIALIZED = 'isInitialized';
exports.glideFormFieldFactory = {
create: create,
hasInputHelpers: hasInputHelpers,
useDisplayValueForValue: useDisplayValueForValue,
isMandatory: isMandatory,
isReadonly: isReadonly,
hasValue: hasValue,
isInitialized: isInitialized,
setInitialized: setInitialized,
getCurrencyValue: getCurrencyValue
};
function create(field) {
var attributes = field.attributes || {};
return {
isVisible: function() {
if (typeof field.fields !== 'undefined') {
var childVisibility = false;
field.fields.forEach(function(child) {
childVisibility |= !!child.visible;
});
if (!childVisibility) {
return false;
}
}
return field.visible === true;
},
isReadonly: function() {
return isReadonly(field);
},
isMandatory: function() {
return isMandatory(field);
},
hasBarcodeHelper: function() {
return hasInputHelpers(field) && attributes.barcode === 'true';
},
hasCurrentLocationHelper: function() {
return hasInputHelpers(field) && attributes.current_location === 'true';
},
hasMessages: function() {
return field.messages && (field.messages.length > 0);
}
};
}
function isInitialized(field) {
return field[IS_INITIALIZED] === true;
}
function setInitialized(field) {
field[IS_INITIALIZED] = true;
}
function hasInputHelpers(field) {
switch (field.type) {
case 'boolean':
case 'reference':
return false;
default:
return true;
}
}
function isMandatory(field) {
if (field.type === "widget") {
return false;
} else if (field.sys_readonly === true) {
return false;
} else {
return (field.mandatory === true || field.sys_mandatory === true);
}
}
function isReadonly(field) {
return field.sys_readonly === true || field.readonly === true;
}
function hasValue(field, value) {
if (typeof value === 'undefined') {
value = useDisplayValueForValue(field) ? field.displayValue : field.value;
}
switch(field.type) {
case 'boolean_confirm':
return value === 'true';
case 'boolean':
return true;
case 'currency':
var currencyValues = value.replace(/[^0-9]/g, '');
return currencyValues !== '' ;
}
if (value == null) {
return false;
}
if (typeof value === 'undefined') {
return false;
}
var trimmed = String(value).trim();
return trimmed.length > 0;
}
function useDisplayValueForValue(field) {
if (field.isEncrypted)
return true;
switch(field.type) {
case 'user_image':
case 'glide_encrypted':
case 'translated_text':
return true;
default:
return false;
}
}
function getCurrencyValue(field) {
var fieldTypes = [
'currency',
'currency2',
'price'
];
if (typeof field === 'undefined'
|| field === null
|| fieldTypes.indexOf(field.type) === -1
|| field.value === null)
return;
if (field.value.toString().indexOf(';') >= 0) {
return field.value.split(';')[1];
} else {
return field.value;
}
}
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/catalogVariableHandler.js */
(function(exports) {
'use strict';
var scConf = {
MULTI_ROW_TYPE: "one_to_many",
CONTAINER: "container",
CHECKBOX: "boolean",
CHECKBOX_MANDATORY: "boolean_confirm",
CHECKBOX_CONTAINER: "checkbox_container",
RICH_TEXT_LABEL: "rich_text_label",
LABEL: "label",
MASKED: "masked",
STRING: "string",
MULTIPLE_CHOICE: "multiple_choice",
DEFAULT: "default",
CAT_VARIABLE: "_cat_variable"
};
function _firePropertyChangeEvent(gForm, name, property, value) {
gForm.$private.events.propertyChange(
'FIELD',
name,
property,
value
);
}
function setPrivateProperty(gForm, field, property, value) {
field['_' + property] = value;
_firePropertyChangeEvent(gForm, field.name, property, value);
}
function isContainerType(field) {
return field.type == scConf.CONTAINER;
}
function isCheckboxEmpty(value) {
return (typeof value === "undefined") || value === null || value == "false" || value == "";
}
function canHideOrDisableCheckboxContainer(context, field) {
if (!field._mandatory || _isCheckboxGroupMandatorySatisfied(context, field))
return true;
return false;
}
function canHideOrDisableContainer(context, field) {
if (field.type == scConf.CONTAINER && field.containerType == scConf.CHECKBOX_CONTAINER)
return canHideOrDisableCheckboxContainer(context, field);
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
if (!canHideOrDisable(context, context.getField(field._children[i])))
return false;
}
}
return true;
}
function canHideOrDisable(context, field) {
if (isContainerType(field))
return canHideOrDisableContainer(context, field);
if (field.type == scConf.CHECKBOX) {
return canHideOrDisableCheckbox(context, field);
} else if (glideFormFieldFactory.isMandatory(field) && !glideFormFieldFactory.hasValue(field))
return false;
return true;
}
function canHideOrDisableCheckbox(context, field) {
var parent = context.getField(field._parent);
if (!parent._mandatory || _isCheckboxGroupMandatorySatisfied(context, parent))
return true;
var visibleEditableCheckboxes = (parent._children || [])
.map(context.getField)
.filter(function(child) {
return child._visible && !child._readonly;
});
if (visibleEditableCheckboxes.length == 1)
return field !== visibleEditableCheckboxes[0];
return visibleEditableCheckboxes.length > 1;
}
function _isCheckboxGroupMandatorySatisfied(context, field) {
if (field.type !== scConf.CONTAINER || field.containerType !== scConf.CHECKBOX_CONTAINER)
return false;
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
var child = context.getField(field._children[i]);
if (!isCheckboxEmpty(child.value))
return true;
}
}
return false;
}
function walkToRootAndSetVisibility(context, field, isVisible) {
if (!isContainerType(field))
return;
if (!isVisible) {
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
if (context.g_form.isVisible(field._children[i]))
return false;
}
}
context.g_form.setVisible(field.name, isVisible);
if (typeof field._parent == "string" && context.getField(field._parent))
walkToRootAndSetVisibility(context, context.getField(field._parent), isVisible);
setPrivateProperty(context.g_form, field, 'cascade_hidden', true);
return;
} else {
if ((field._cascade_hidden || !canHideOrDisableContainer(context, field))) {
setPrivateProperty(context.g_form, field, 'cascade_hidden', false);
context.g_form.setVisible(field.name, isVisible);
if (typeof field._parent == "string" && context.getField(field._parent))
walkToRootAndSetVisibility(context, context.getField(field._parent), isVisible)
}
}
}
function setCheckboxContainerInvalidProperty(context, field) {
if (field.type !== scConf.CONTAINER || field.containerType !== scConf.CHECKBOX_CONTAINER)
return;
var isInvalid = !(!field._mandatory || _isCheckboxGroupMandatorySatisfied(context, field));
var prevInvalid = !!field.isInvalid;
if (prevInvalid === isInvalid) {
return;
}
field.isInvalid = isInvalid;
_firePropertyChangeEvent(context.g_form, field.name, 'isInvalid', isInvalid);
}
var checkboxOverloads = {
visible: function(context, field) {
Object.defineProperty(field, 'visible', {
set: function(isVisible) {
if (!isVisible && !canHideOrDisableCheckbox(context, field)) {
return;
}
field._visible = isVisible;
if (typeof field._parent != "undefined" && field._parent) {
var parent = context.getField(field._parent);
if (isVisible && !parent._visible && !parent._cascade_hidden)
return;
if (!isVisible) {
if (parent._mandatory && !_isCheckboxGroupMandatorySatisfied(context, parent)) {
var visibleCheckboxes = (parent._children || [])
.map(context.getField)
.filter(function (child) {
return child._visible;
});
if (visibleCheckboxes.length > 0)
return;
}
return walkToRootAndSetVisibility(context, parent, false);
}
setPrivateProperty(context.g_form, parent, 'visible', isVisible);
setPrivateProperty(context.g_form, parent, 'cascade_hidden', !isVisible);
if (typeof parent._parent != "undefined" && parent._parent)
walkToRootAndSetVisibility(context, context.getField(parent._parent), isVisible);
}
},
get: function(){ return field._visible; },
configurable: true
});
},
readOnly: function(context, field) {
Object.defineProperty(field, 'readonly', {
set: function(isReadonly) {
if (isReadonly && !canHideOrDisableCheckbox(context, field))
return false;
if (!field.sys_readonly) {
field._readonly = isReadonly;
}
var parent = context.getField(field._parent);
if (parent._cascade_readonly) {
setPrivateProperty(context.g_form, parent, 'cascade_readonly', false);
setPrivateProperty(context.g_form, parent, 'readonly', false);
}
},
get: function(){ return field.sys_readonly || field._readonly; },
configurable: true
});
},
mandatory: function(context, field) {
Object.defineProperty(field, 'mandatory', {
set: function(isMandatory) {
var checkboxContainer = context.getField(field._parent);
if (isMandatory && isCheckboxEmpty(field.value)) {
field._mandatory = isMandatory;
setPrivateProperty(context.g_form, checkboxContainer, 'mandatory', isMandatory);
var groupSatisfied = _isCheckboxGroupMandatorySatisfied(context, checkboxContainer);
if (!checkboxContainer._visible && groupSatisfied) {
return;
}
if (!groupSatisfied) {
if (!field._visible)
field._visible = true;
if (field._readonly)
field._readonly = false;
}
setPrivateProperty(context.g_form, checkboxContainer, 'visible', true);
setPrivateProperty(context.g_form, checkboxContainer, 'readonly', false);
if (typeof checkboxContainer._parent != "undefined" && checkboxContainer._parent)
walkToRootAndSetVisibility(context, context.getField(checkboxContainer._parent), true);
}
field._mandatory = isMandatory;
if (isMandatory) {
setPrivateProperty(context.g_form, checkboxContainer, 'mandatory', true);
return;
}
for (var i=0; i < (checkboxContainer._children || []).length; i++) {
if (context.getField(checkboxContainer._children[i])._mandatory) {
setPrivateProperty(context.g_form, checkboxContainer, 'mandatory', true);
return;
}
}
setPrivateProperty(context.g_form, checkboxContainer, 'mandatory', isMandatory);
checkboxContainer.isInvalid = false;
_firePropertyChangeEvent(context.g_form, checkboxContainer.name, 'isInvalid', false);
},
get: function(){ return field._mandatory; },
configurable: true
});
},
value: function(context, field) {
field._value = field.value;
Object.defineProperty(field, 'value', {
set: function(value) {
field._value = value;
if (typeof field._parent != "undefined" && field._parent) {
var parent = context.getField(field._parent);
setCheckboxContainerInvalidProperty(context, parent);
}
},
get: function(){ return field._value; },
configurable: true
});
}
};
var checkboxContainerOverloads = {
visible: function(context, field) {
Object.defineProperty(field, 'visible', {
set: function(isVisible) {
if (isVisible) {
if (!field._visible && field._cascade_hidden){
return;
}
} else {
if (!canHideOrDisableCheckboxContainer(context, field))
return;
}
field._visible = isVisible;
field._cascade_hidden = false;
if (typeof field._parent != "undefined" && field._parent) {
walkToRootAndSetVisibility(context, context.getField(field._parent), isVisible);
}
},
get: function(){ return field._visible; },
configurable: true
});
},
readOnly: function(context, field) {
Object.defineProperty(field, 'readonly', {
set: function(isReadonly) {
if (isReadonly && !canHideOrDisableCheckboxContainer(context, field)) {
return;
}
if (field._children) {
for (var i=0; i < field._children.length; i++) {
context.g_form.setReadOnly(field._children[i], isReadonly);
}
}
if (!field.sys_readonly) {
field._readonly = isReadonly;
field._cascade_readonly = true;
}
},
get: function(){ return field.sys_readonly || field._readonly; },
configurable: true
});
},
mandatory: function(context, field) {
if (field.render_label) {
if (field._children) {
for (var i=0; i < field._children.length; i++) {
if (context.getField(field._children[i]).mandatory) {
field._mandatory = true;
break;
}
}
}
} else {
if (field._children) {
var childCheckbox = context.getField(field._children[0]);
if (childCheckbox && childCheckbox.mandatory)
field._mandatory = true;
}
}
Object.defineProperty(field, 'mandatory', {
set: function(isMandatory) {
var forceOpenChildren = isMandatory && !_isCheckboxGroupMandatorySatisfied(context, field);
if (field._children) {
for (var i=0; i < field._children.length; i++) {
var child = context.getField(field._children[i]);
if (forceOpenChildren) {
setPrivateProperty(context.g_form, child, 'visible', true);
setPrivateProperty(context.g_form, child, 'readonly', false);
}
context.g_form.setMandatory(child.name, isMandatory);
}
}
field._mandatory = isMandatory;
},
get: function(){ return field._mandatory; },
configurable: true
});
},
label: function(context, field) {
var render_label = field.render_label || field.displayTitle;
if (render_label)
return;
Object.defineProperty(field, 'label', {
get: function(){
var child = context.getField((field._children || [])[0]) || {};
return child.label;
},
configurable: true
});
},
value: function(context, field) {
Object.defineProperty(field, 'value', {
set: function(value){ return; },
get: function(){
if (field._mandatory && _isCheckboxGroupMandatorySatisfied(context, field))
return "true";
return this._mandatory ? "" : "false";
},
configurable: true
});
}
};
var containerStartOverloads = {
visible: function(context, field) {
Object.defineProperty(field, 'visible', {
set: function(isVisible) {
if (isVisible) {
if (!field._visible && field._cascade_hidden) {
return;
}
} else {
if (!canHideOrDisableContainer(context, field)) {
return;
}
}
field._visible = isVisible;
field._cascade_hidden = false;
if (typeof field._parent != 'undefined' && field._parent)
walkToRootAndSetVisibility(context, context.getField(field._parent), isVisible);
},
get: function(){ return field._visible; },
configurable: true
});
},
invalid: function(context, field) {
Object.defineProperty(field, 'isInvalid', {
set : function (isInvalid ) {
return;
},
get : function () {
return false;
},
configurable: true
});
},
mandatory: function(context, field) {
Object.defineProperty(field, 'mandatory', {
set: function(isMandatory) {
field._mandatory = isMandatory;
var canHideContainer = true;
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
var child = context.getField(field._children[i]);
context.g_form.setMandatory(child.name, isMandatory);
canHideContainer = canHideContainer && canHideOrDisable(context, child);
}
}
if (isMandatory) {
if (!field._visible && canHideContainer) {
return;
}
if (typeof field._parent != 'undefined' && field._parent)
walkToRootAndSetVisibility(context, context.getField(field._parent), true);
}
},
get: function() {
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
var child = context.getField(field._children[i]);
if (context.g_form.isMandatory(child.name))
return true;
}
}
return field._mandatory;
},
configurable: true
});
},
readOnly: function(context, field) {
Object.defineProperty(field, 'readonly', {
set: function(isReadonly) {
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
var child = context.getField(field._children[i]);
if (isContainerType(child) || !isReadonly || (isReadonly && canHideOrDisable(context, child))) {
if (child.sys_readonly)
continue;
child.readonly = isReadonly;
_firePropertyChangeEvent(context.g_form, child.name, 'readonly', isReadonly);
}
}
}
if (!field.sys_readonly) {
field._readonly = isReadonly;
}
},
get: function(){ return field.sys_readonly || field._readonly; },
configurable: true
});
},
value: function(context, field) {
Object.defineProperty(field, 'value', {
set: function(value){ return; },
get: function() {
if (field._children) {
for (var i = 0; i < field._children.length; i++) {
var child = context.getField(field._children[i]);
if (glideFormFieldFactory.hasValue(child))
return "true";
}
}
return this.mandatory ? "true": "";
},
configurable: true
});
}
};
var labelOverloads = {
mandatory: function(context, field) {
Object.defineProperty(field, 'mandatory', {
set : function (isMandatory) {
console.log("setMandatory not applicable for 'Label' variable type");
return;
},
configurable: true
});
},
value: function(context, field) {
Object.defineProperty(field, 'value', {
set : function (value) {
console.log("setValue not applicable for 'Label' variable type");
return;
},
get : function () {return '';},
configurable: true
});
}
};
var maskedOverloads = {
value: function(context, field) {
field._value = field.value;
Object.defineProperty(field, 'value', {
set: function(value) {
field._value = value;
if (!!field.useConfirmation) {
field.isInvalid = false;
field.confirmPassword = value;
field._confirmationValue = value;
}
},
get: function(){ return field._value; },
configurable: true
});
},
confirmationValue: function(context, field) {
if (typeof field.confirmationValue === 'undefined')
field._confirmationValue = field.value;
else
field._confirmationValue = field.confirmationValue;
Object.defineProperty(field, 'confirmationValue', {
set: function(confirmationValue) {
field._confirmationValue = confirmationValue;
if (field.value === confirmationValue)
field.isInvalid = false;
else
field.isInvalid = true;
},
get: function() {
return field._confirmationValue;
},
configurable: true
})
}
};
var multipleChoiceOverloads = {
displayValue: function(context, field) {
field._displayValue = field.displayValue;
Object.defineProperty(field, 'displayValue', {
set: function(displayValue) {
if (typeof displayValue === 'undefined')
displayValue = field.value;
if (field.choices && displayValue === field.value) {
var items = field.choices.items || field.choices;
var valueStr = String(field.value);
for(var i=0; i<items.length; i++) {
var choice = items[i];
if (String(choice.value) === valueStr) {
displayValue = choice.displayValue || choice.label;
break;
}
}
}
field._displayValue = displayValue;
},
get: function() {
return field._displayValue;
}
})
}
};
var multiRowValueOverloads = {
value: function(context, field) {
field._value = (field.value && typeof field.value === 'string') ? JSON.parse(field.value) : field.value;
Object.defineProperty(field, 'value', {
set: function (value) {
handleMultiRowFieldProperty(field, "_value", value);
},
get : function () {
if (field._value && (field._value.length > 0))
return (typeof field._value === 'string') ? field._value: JSON.stringify(field._value);
else
return '';
},
configurable: true
})
},
displayValue: function(context, field) {
field._displayValue = (field.displayValue && typeof field.displayValue === 'string') ? JSON.parse(field.displayValue) : field.displayValue;
Object.defineProperty(field, 'displayValue', {
set: function (displayValue) {
if (field.updateDisplayValue) {
field._displayValue = (displayValue && typeof displayValue === 'string') ? JSON.parse(displayValue) : displayValue;
field.updateDisplayValue = false;
} else {
field._displayValue = field._value;
}
},
get : function () {
if (field._displayValue && (field._displayValue.length > 0))
return (typeof field._displayValue === 'string') ? field._displayValue: JSON.stringify(field._displayValue);
else
return '';
},
configurable: true
})
}
};
function handleMultiRowFieldProperty(field, property, val) {
if (val == '') {
field[property] = [];
return;
}
if (!field.validated) {
var data = [];
if (Array.isArray(val)) {
try {
data = JSON.stringify(val);
} catch (e) {
_logWarn('JSON parse error', 'Invalid value for table variable');
return;
}
} else if (typeof val != 'string') {
_logWarn('Invalid Input', 'Invalid value for table variable');
return;
}
var uniqueColumnData = {};
var fieldsMeta = field.fields;
for (var index in fieldsMeta) {
if (fieldsMeta[index].unique)
uniqueColumnData[fieldsMeta[index].name] = fieldsMeta[index].label;
}
var parsedValue = JSON.parse(val);
if (!isMaxRowExceeded(field.maxRows, parsedValue, field.label) && !hasDuplicateColumnData(uniqueColumnData, parsedValue)) {
field[property] = parsedValue;
}
} else {
field[property] = JSON.parse(val);
field.validated = false;
}
}
function hasDuplicateColumnData(uniqueColumnNames, value) {
if (uniqueColumnNames && value) {
var duplicateUniqueFields = _getDuplicateFields(uniqueColumnNames, value);
if (duplicateUniqueFields.length > 0) {
_logWarn('Duplicate Data', 'Some fields are not unique: ' + duplicateUniqueFields.join(', '));
return true;
}
}
return false;
}
function _getDuplicateFields(uniqueColumnNames, value) {
var uniqueColumnData = new Map();
var duplicateUniqueFields = new Set();
var duplicateUniqueFieldsArray = [];
for (var name in uniqueColumnNames) {
uniqueColumnData.set(name, new Map());
}
if (Object.keys(uniqueColumnNames).length > 0) {
if (Array.isArray(value) && value.length > 0) {
for (var i = 0; i < value.length; i++) {
var row = value[i];
if (row !== null && typeof row === 'object') {
for (var uniqueColumnName in uniqueColumnNames) {
var columnValue = row[uniqueColumnName];
if (columnValue) {
columnValue = columnValue.toString().toLowerCase();
if (!uniqueColumnData.get(uniqueColumnName).has(columnValue))
uniqueColumnData.get(uniqueColumnName).set(columnValue, true);
else
duplicateUniqueFields.add(uniqueColumnNames[uniqueColumnName]);
}
}
}
}
}
}
if (duplicateUniqueFields) {
duplicateUniqueFields.forEach(function(element) {
duplicateUniqueFieldsArray.push(element)
});
}
return duplicateUniqueFieldsArray;
}
function _logWarn(code, msg) {
if (console && console.warn) {
console.warn('(g_form) [' + code + '] ' + msg);
}
}
function isMaxRowExceeded(rowLimit, value, varName) {
if (value && value.length > rowLimit) {
_logWarn('Maximum Row Limit Exceeded', 'The number of rows specified in the multi-row variable set ' + varName +' exceeds the maximum limit of: '+ rowLimit);
return true;
}
return false;
}
var defaultOverloads = {
visible: function(context, field) {
Object.defineProperty(field, 'visible', {
set: function(isVisible) {
field._visible = isVisible;
if (typeof field._parent != 'undefined' && field._parent) {
walkToRootAndSetVisibility(context, context.getField(field._parent), isVisible);
}
},
get: function(){ return field._visible; },
configurable: true
});
},
mandatory: function(context, field) {
Object.defineProperty(field, 'mandatory', {
set: function(isMandatory) {
if (field.sys_readonly)
return;
field._mandatory = isMandatory;
if (typeof field._parent != "undefined" && field._parent) {
walkToRootAndSetVisibility(context, context.getField(field._parent), true);
}
},
get: function(){ return field._mandatory; },
configurable: true
});
}
};
function _isFieldHandler(field) {
return field.is_handler === true;
}
function _isVariable(field) {
return field[scConf.CAT_VARIABLE] === true;
}
function _createFieldHandler(field) {
if (_isFieldHandler(field)) {
return field;
}
field.is_handler = true;
field._visible = field.visible;
field._readonly = field.readonly;
field._mandatory = field.mandatory;
return field;
}
function create(context, field) {
if (!_isVariable(field)) {
return null;
}
if (_isFieldHandler(field)) {
return field;
}
field = _createFieldHandler(field);
var type = field.type;
if (type === scConf.CONTAINER) {
if (field.containerType === scConf.CHECKBOX_CONTAINER) {
type = field.containerType;
} else if (field.containerType === scConf.MULTI_ROW_TYPE) {
type = scConf.MULTI_ROW_TYPE;
}
}
switch(type) {
case scConf.CONTAINER:
containerStartOverloads.mandatory(context, field);
containerStartOverloads.visible(context, field);
containerStartOverloads.value(context, field);
containerStartOverloads.readOnly(context, field);
containerStartOverloads.invalid(context, field);
break;
case scConf.CHECKBOX_CONTAINER:
checkboxContainerOverloads.value(context, field);
checkboxContainerOverloads.readOnly(context, field);
checkboxContainerOverloads.visible(context, field);
checkboxContainerOverloads.mandatory(context, field);
checkboxContainerOverloads.label(context, field);
break;
case scConf.CHECKBOX:
checkboxOverloads.value(context, field);
checkboxOverloads.visible(context, field);
checkboxOverloads.mandatory(context, field);
checkboxOverloads.readOnly(context, field);
break;
case scConf.MULTI_ROW_TYPE:
multiRowValueOverloads.value(context, field);
multiRowValueOverloads.displayValue(context, field);
defaultOverloads.visible(context, field);
defaultOverloads.mandatory(context, field);
break;
case scConf.RICH_TEXT_LABEL:
case scConf.LABEL:
labelOverloads.mandatory(context, field);
defaultOverloads.visible(context, field);
labelOverloads.value(context, field);
break;
case scConf.MASKED:
defaultOverloads.mandatory(context, field);
defaultOverloads.visible(context, field);
maskedOverloads.value(context, field);
if (field.useConfirmation) {
maskedOverloads.confirmationValue(context, field);
};
case scConf.MULTIPLE_CHOICE:
defaultOverloads.visible(context, field);
defaultOverloads.mandatory(context, field);
multipleChoiceOverloads.displayValue(context, field);
default:
defaultOverloads.visible(context, field);
defaultOverloads.mandatory(context, field);
break;
}
return field;
}
exports.catalogVariableHandler = {
create: create
};
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideFormFactory.js */
(function(exports, document, glideFormFieldFactory, catalogVariableHandler, undefined) {
'use strict';
exports.glideFormFactory = {
create: createGlideForm,
glideRequest: exports.glideRequest
};
var EMPTY_FIELD_VALUE = '';
var DEFAULT_ACTION_NAME = 'none';
var SUBMIT_ACTION_NAME = 'submit';
var SAVE_ACTION_NAME = 'save';
var FORM_STATE_UNMODIFIED = 'unmodified';
var FORM_STATE_MODIFIED = 'modified';
var FORM_STATE_SAVED = 'saved';
var EVENT_ON_CHANGE = 'onChange';
var EVENT_CHANGE = 'change';
var EVENT_ON_SUBMIT = 'onSubmit';
var EVENT_SUBMIT = 'submit';
var EVENT_ON_SUBMITTED = 'onSubmitted';
var EVENT_SUBMITTED = 'submitted';
var EVENT_ON_CHANGED = 'onChanged';
var EVENT_CHANGED = 'changed';
var EVENT_PROPERTY_CHANGE = 'propertyChange';
var EVENT_ON_PROPERTY_CHANGE = 'onPropertyChange';
var EVENT_STATE_CHANGE = 'stateChange';
var EVENT_ON_STATE_CHANGE = 'onStateChange';
var EVENT_LIVE_UPDATED = 'liveUpdated';
var EVENT_ON_LIVE_UPDATED = 'onLiveUpdated';
var EVENT_USER_CHANGE_VALUE = 'userChangeValue';
var EVENT_ON_USER_CHANGE_VALUE = 'onUserChangeValue';
var PROPERTY_CHANGE_FORM = 'FORM';
var PROPERTY_CHANGE_FIELD = 'FIELD';
var PROPERTY_CHANGE_SECTION = 'SECTION';
var PROPERTY_CHANGE_RELATED_LIST = 'RELATED_LIST';
var PROPERTY_CHANGE_ATTACHMENTS = 'ATTACHMENTS';
var CAT_VARIABLE = '_cat_variable';
var STRICTLY_DEPENDENT_FIELD_TYPES = ['field_list', 'conditions', 'document_id', 'field_name', 'template'];
function createGlideForm(tableName, sysId, fields, uiActions, options) {
if (!fields) {
fields = [];
}
var _sysId = sysId ? sysId.toString() : '-1';
var _fields = fields;
var _annotations;
var _dirtyFields = _getDirtyQueryFields(fields);
var _formState = FORM_STATE_UNMODIFIED;
var _userModifiedFields = {};
var _submitAction = {name: DEFAULT_ACTION_NAME};
var _onSubmitHandlers = [];
var _onSubmittedHandlers = [];
var _onChangeHandlers = [];
var _onChangedHandlers = [];
var _onPropertyChangeHandlers = [];
var _onStateChangeHandlers = [];
var _onLiveUpdatedHandlers = [];
var _onUserChangedHandlers = [];
var _attachmentUploadDisabled = false;
var _options = {
isInitialized: false,
fieldIterator: function(f) {
_fields.forEach(f);
},
getMappedField: null,
getMappedFieldName: null,
uiMessageHandler: null,
formMessageHandler: null,
encodedRecord: null,
relatedLists: null,
sections: null,
cleanDecimals: false,
viewName: '',
useCatalogVariableFieldHandler: false,
document: null,
submitPromises: false,
reloadForm: null,
serializedExclusionList: []
};
var _fieldStates = {
templateLoading: {}
};
var _isLiveUpdating = false;
_options.fieldIterator(function(field) {
field.originalValue = field.value;
});
function _equals(value1, value2) {
if (typeof(value1) !== "string" || typeof(value2) !== "string") {
return value1 === value2;
}
return value1.replace(/\r/g, "") === value2.replace(/\r/g, "");
}
function GlideForm() {
this.hasField = function(fieldName) {
var field = _getField(fieldName);
return field !== null;
};
this.getFieldNames = function() {
var fieldNames = [];
_options.fieldIterator(function(field) {
fieldNames.push(field.name);
});
return fieldNames;
};
this.setLabel = function(fieldName, label) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (field.label === label) {
return;
}
field.label = label;
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'label',
field.label
);
};
this.setLabelOf = this.setLabel;
this.getLabel = function(fieldName) {
var field = _getField(fieldName);
if (!field)
return;
return field.label;
};
this.getLabelOf = this.getLabel;
this.addDecoration = function(fieldName, icon, text) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (!field.decorations || !_isArray(field.decorations)) {
field.decorations = [];
}
var deco = {
icon: icon,
text: text
};
for (var i = 0; i < field.decorations.length; i++) {
var dec = field.decorations[i];
if ((dec.icon === icon) && (dec.text === text)) {
return;
}
}
field.decorations.push(deco);
var fieldDecorations = field.decorations.slice();
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'decorations',
fieldDecorations
);
};
this.removeDecoration = function(fieldName, icon, text) {
var field = _getField(fieldName);
if (!field)
return;
if (!field.decorations || !_isArray(field.decorations)) {
return;
}
var foundValue = false;
for (var i = 0; i < field.decorations.length && !foundValue; i++) {
var dec = field.decorations[i];
if ((dec.icon === icon) && (dec.text === text)) {
field.decorations.splice(i, 1);
foundValue = true;
}
}
if (foundValue) {
var fieldDecorations = field.decorations.slice();
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'decorations',
fieldDecorations
);
}
};
this.setFieldPlaceholder = function(fieldName, value) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (field.placeholder === value) {
return;
}
field.placeholder = value;
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'placeholder',
value
);
};
this.getEncodedRecord = function() {
return _options.encodedRecord || '';
};
this.isMandatory = function(fieldName) {
var field = _getField(fieldName);
if (!field)
return false;
return _isMandatory(this, field);
};
this.setMandatory = function(fieldName, isMandatory) {
var field = _getField(fieldName);
if (!field)
return;
if (field.sys_mandatory) {
return;
}
if (field.type === 'widget')
return;
isMandatory = _getBoolean(isMandatory);
if (!glideFormFieldFactory.hasValue(field) && isMandatory) {
this.setReadonly(fieldName, false);
this.setVisible(fieldName, true);
} else if (_isMandatory(this, field) == isMandatory) {
return;
} else if (!isMandatory) {
_setInvalid(this, field, false);
}
field.mandatory = isMandatory;
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'mandatory',
field.mandatory
);
};
this.isReadOnly = function(fieldName) {
var field = _getField(fieldName);
if (!field)
return false;
return _isReadOnly(this, field);
};
this.setReadOnly = function(fieldName, readonly) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (field.sys_readonly) {
return;
}
var readOnly = _getBoolean(readonly);
if (readOnly && glideFormFieldFactory.isMandatory(field) && !glideFormFieldFactory.hasValue(field)) {
return;
}
if (_isReadOnly(this, field) === readOnly) {
return;
}
field.readonly = readOnly;
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'readonly',
field.readonly
);
};
this.setReadonly = this.setReadOnly;
this.setDisabled = this.setReadOnly;
this.isVisible = function(fieldName) {
var field = _getField(fieldName);
if (!field)
return false;
if (field.visible === undefined)
return true;
return !!field.visible;
};
this.setVisible = function(fieldName, isVisible) {
var field = _getField(fieldName);
if (!field) {
return;
}
var isVisible = _getBoolean(isVisible);
if (field.visible === isVisible) {
return;
}
if (field.visible && glideFormFieldFactory.isMandatory(field) && !glideFormFieldFactory.hasValue(field))
return;
field.visible = isVisible;
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'visible',
field.visible
);
};
this.setDisplay = this.setVisible;
this.getValue = function(fieldName) {
var field = _getField(fieldName);
if (!field)
return '';
if (glideFormFieldFactory.useDisplayValueForValue(field)) return field.displayValue;
return (typeof field.value !== 'undefined' && field.value !== null) ? field.value.toString() : '';
};
this.getDisplayValue = function(fieldName) {
var field = _getField(fieldName);
if (!field) {
return '';
}
return field.displayValue;
};
this.clearValue = function(fieldName) {
this.setValue(fieldName, '');
};
this.setValue = function(fieldName, value, displayValue) {
var field = _getField(fieldName);
_setValue(this, field, value, displayValue);
};
this.getTableName = function() {
return tableName;
};
this.getViewName = function() {
return _options.viewName;
};
this.getControl = function(name) {
var field = _getField(name);
if (field === null) {
return null;
}
return new GlideFormControl(this, name, field.type);
};
this.isNewRecord = function() {
return _sysId === "-1";
};
this.getSysId = function() {
return _options.uniqueValue || _sysId;
};
this.getUniqueValue = this.getSysId;
this.getBooleanValue = function(fieldName) {
var val = this.getValue(fieldName);
val = val ? val + '' : val;
if (!val || val.length === 0 || val == "false") {
return false;
}
return true;
};
this.getDecimalValue = function(fieldName) {
var value = _getCurrencyValue(fieldName);
if (!value)
value = this.getValue(fieldName);
if (!value || (value.length === 0))
return 0;
if (!_options.cleanDecimals)
return parseFloat(value);
var sVal = '';
var nVal = value.length;
var sChar = '';
var nChar = '';
var decimalSeparator = typeof g_user_decimal_separator != "undefined" ? g_user_decimal_separator : ".";
try {
for (var i = 0; i < nVal; i++) {
sChar = value.charAt(i);
nChar = sChar.charCodeAt(0);
if (sChar == '-' || sChar == decimalSeparator || ((nChar >= 48) && (nChar <= 57)))
sVal += value.charAt(i);
}
} catch (exception) {
console.error("Error formatting decimal value: " + value);
}
var cleanValue = sVal.replace(/,/g, '.');
return parseFloat(cleanValue);
};
this.getIntValue = function(fieldName) {
var value = this.getValue(fieldName);
if (typeof value === 'string') {
value = value.trim();
}
if (!value || (value.length === 0)) {
return 0;
}
return parseInt(value, 10);
};
this.addOption = function(fieldName, choiceValue, choiceLabel, choiceIndex) {
var field = _getField(fieldName);
if (!field) {
return;
}
var added = _addToOptionStack(field, 'add', choiceValue, choiceLabel, choiceIndex);
if (added) {
var optionStack = field.optionStack.slice();
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'optionStack',
optionStack
);
}
};
this.clearOptions = function(fieldName) {
var field = _getField(fieldName);
if (!field) {
return;
}
_addToOptionStack(field, 'clear');
var optionStack = field.optionStack.slice();
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'optionStack',
optionStack
);
};
this.removeOption = function(fieldName, choiceValue) {
var field = _getField(fieldName);
if (!field) {
return;
}
_addToOptionStack(field, 'remove', choiceValue);
var optionStack = field.optionStack.slice();
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'optionStack',
optionStack
);
};
this.hideRelatedList = function (listTableName) {
var list = _getRelatedList(listTableName);
if (!list) {
return;
}
if (list.visible === false) {
return;
}
list.visible = false;
this.$private.events.propertyChange(
PROPERTY_CHANGE_RELATED_LIST,
listTableName,
'visible',
false
);
};
this.hideRelatedLists = function() {
if (!_options.relatedLists) {
return;
}
_options.relatedLists.forEach(function(list) {
this.hideRelatedList(_getRelatedListName(list));
}, this);
};
this.showRelatedList = function(listTableName) {
var list = _getRelatedList(listTableName);
if (!list) {
return;
}
if (list.visible === true) {
return;
}
list.visible = true;
this.$private.events.propertyChange(
PROPERTY_CHANGE_RELATED_LIST,
listTableName,
'visible',
true
);
};
this.showRelatedLists = function() {
if (!_options.relatedLists) {
return;
}
_options.relatedLists.forEach(function(list) {
this.showRelatedList(_getRelatedListName(list));
}, this);
};
this.getRelatedListNames = function() {
var listNames = [];
if (_options.relatedLists) {
_options.relatedLists.forEach(function(list) {
listNames.push(_getRelatedListName(list));
});
}
return listNames;
};
this.getSectionNames = function() {
var sectionNames = [];
if (_options.sections) {
_options.sections.forEach(function(section) {
var sectionName = _getSectionName(section);
if (sectionName !== null) {
sectionNames.push(sectionName);
}
});
}
return sectionNames;
};
this.setSectionDisplay = function(sectionName, display) {
var section = _getSection(sectionName);
if (!section) {
return;
}
var display = _getBoolean(display);
if (section.visible === display) {
return;
}
section.visible = display;
this.$private.events.propertyChange(
PROPERTY_CHANGE_SECTION,
sectionName,
'visible',
display
);
};
this.getReference = function(fieldName, callback) {
if (!callback) {
_logWarn('GETREF:NOCB', 'Mobile scripts must specify a callback function');
return;
}
var field = _getField(fieldName);
if (!field) {
_logWarn('GETREF:FNF', 'Field not found: ' + fieldName);
return;
}
var table = _getReferenceTable(field);
var referenceKey = field.reference_key ? field.reference_key : 'sys_id';
var gr = new exports.GlideRecord(table);
gr.get(referenceKey, field.value, callback);
};
this.addErrorMessage = function(message) {
_fireUiMessage(this, 'errorMessage', message);
};
this.addWarningMessage = function(message) {
_fireUiMessage(this, 'warningMessage', message);
};
this.addInfoMessage = function(message) {
_fireUiMessage(this, 'infoMessage', message);
};
this.clearMessages = function() {
_fireUiMessage(this, 'clearMessages');
};
this.showFieldMsg = function(fieldName, message, type, scrollForm) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (!field.messages) {
field.messages = [];
}
if (message == null)
message = "";
switch (type) {
default:
type = "info";
break;
case 'info':
break;
case 'warning':
break;
case 'error':
case 'warning':
break;
}
field.messages.push({
message: message,
type: type
});
var fieldMessages = field.messages.slice();
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'messages',
fieldMessages
);
};
this.hideFieldMsg = function(fieldName, clearAll) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (!field.messages || !_isArray(field.messages)) {
return;
}
if (clearAll) {
field.messages = [];
} else {
field.messages.shift();
}
var fieldMessages = field.messages.slice();
var hasError = false;
for (var j = field.messages.length - 1; j >= 0; j--) {
if (field.messages[j].type === 'error') {
hasError = true;
}
}
if (!hasError)
_setInvalid(this, field, false);
this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'messages',
fieldMessages
);
};
this.hideAllFieldMsgs = function(type) {
switch (type) {
default:
return;
case 'info':
case 'error':
case 'warning':
break;
}
for (var i = 0; i < _fields.length; i++) {
var msgs = _fields[i].messages;
if (!msgs || !_isArray(msgs)) {
continue;
}
for (var j = msgs.length-1; j >= 0 ; j--) {
if (msgs[j].type === type) {
msgs.splice(j, 1);
}
}
}
this.$private.events.propertyChange(
PROPERTY_CHANGE_FORM,
null,
'messages'
);
};
this.showErrorBox = function(fieldName, message, scrollForm) {
this.showFieldMsg(fieldName, message, 'error', scrollForm);
};
this.hideErrorBox = function(fieldName) {
this.hideFieldMsg(fieldName, false);
};
this.addFormMessage = function(message, type) {
if (!message) return;
if (type !== 'error' && type !== 'warning') type = 'info';
_fireFormMessage(this, 'addFormMessage', type, message);
};
this.clearFormMessages = function(type) {
_fireFormMessage(this, 'clearFormMessages', type);
};
this.clearAllFormMessages = function() {
_fireFormMessage(this, 'clearAllFormMessages');
};
this.getActionName = function() {
if (uiActions && uiActions.getActiveActionName) {
var activeUiAction = uiActions.getActiveActionName();
if (activeUiAction !== DEFAULT_ACTION_NAME)
return activeUiAction;
}
return _submitAction.name || DEFAULT_ACTION_NAME;
};
this.reload = function() {
if (_options.reloadForm)
_options.reloadForm();
else
_logWarn('UNSUPPORTED', 'g_form.reload is not supported on mobile or service portal.');
};
this.save = function() {
var saveActionName = SAVE_ACTION_NAME;
if (uiActions && uiActions.getSaveActionName) {
saveActionName = uiActions.getSaveActionName();
}
return this.submit(saveActionName);
};
this.submit = function(submitActionName) {
var formDocument = _options.document ? _options.document : document;
var activeElement = formDocument.activeElement;
if (activeElement) {
activeElement.blur();
}
if (!_submitAction.sysId || _submitAction.name !== submitActionName) {
this.$private.userState.setRunningAction(submitActionName || SUBMIT_ACTION_NAME);
}
if (submitActionName !== "sysverb_ws_delete" && !this.$private.validateForm(_submitAction.name)) {
this.$private.userState.resetRunningAction();
return _options.submitPromises ? Promise.reject(false) : false;
}
var uiAction =_getUIAction(_submitAction.sysId || _submitAction.name);
if (!uiAction) {
this.$private.userState.resetRunningAction();
return _options.submitPromises ? Promise.reject(false) : false;
}
var g_form = this;
var promise = null;
if (uiActions.submit) {
promise = uiActions.submit(uiAction.sysId, {skipValidation: true, g_form: g_form});
} else {
promise = uiAction.execute(this);
}
return promise.then(function() {
g_form.$private.userState.clearModifiedFields();
g_form.$private.events.stateChange(FORM_STATE_SAVED);
g_form.$private.userState.resetRunningAction();
}).catch(function() {
g_form.$private.userState.resetRunningAction();
return Promise.reject(false);
});
};
this.serialize = function(onlyDirtyFields) {
var serializeField = function(field, fields) {
var fieldCopy = _copy(field, _options.serializedExclusionList);
if (fieldCopy.value == null || typeof fieldCopy.value === 'undefined') {
fieldCopy.value = '';
}
fields.push(fieldCopy);
};
var serializedFields = [];
if (onlyDirtyFields === true) {
Object.keys(_dirtyFields).forEach(function(fieldName) {
serializeField(_getField(fieldName), serializedFields);
});
} else {
_fields.forEach(function(field) {
serializeField(field, serializedFields);
});
}
return serializedFields;
};
this.setUserValue = function(fieldName, value, displayValue) {
var field = _getField(fieldName);
_setValue(this, field, value, displayValue, {isUserModified: true});
this.$private.events.userChangeValue(field, value);
};
this.isUserModified = function() {
return Object.keys(_userModifiedFields).length !== 0;
};
this.isLiveUpdating = function() {
return _isLiveUpdating;
};
this.enableAttachments = function() {
if (!_options.attachments) {
return;
}
_options.attachments.canCreate = true;
_attachmentUploadDisabled = false;
this.$private.events.propertyChange(
PROPERTY_CHANGE_ATTACHMENTS,
'attachments',
'canCreate',
true
);
};
this.disableAttachments = function() {
if (!_options.attachments) {
return;
}
_options.attachments.canCreate = false;
_attachmentUploadDisabled = true;
this.$private.events.propertyChange(
PROPERTY_CHANGE_ATTACHMENTS,
'attachments',
'canCreate',
false
);
};
this.isAttachmentUploadDisabled = function() {
return _attachmentUploadDisabled;
};
this.getEditableFields = function () {
var editableFields = [];
_fields.forEach(function(field) {
if (_isEditableField(field)) {
editableFields.push(field.name);
}
});
return editableFields;
};
this.isEditableField = function(fieldName) {
var field = _getField(fieldName);
return _isEditableField(field);
};
var _this = this;
this.insertContentAtCursor = function(fieldName, content) {
var field = _getField(fieldName);
if (!field)
return;
var element = document.querySelectorAll("input[name='" + field.ed.name + "']")[0];
var cursorLocation = element ? element.selectionStart : 0;
if (!cursorLocation)
cursorLocation = 0;
var originalContent = this.getValue(fieldName);
var newContent = originalContent.substr(0, cursorLocation) + content + originalContent.substr(cursorLocation);
this.setValue(fieldName, newContent);
};
this.onUserChangeValue = function(handler) {
this.$private.events.on(EVENT_ON_USER_CHANGE_VALUE, handler);
return function() {
var index = _onUserChangedHandlers.indexOf(handler);
if (index > -1)
_onUserChangedHandlers.splice(index, 1);
};
};
this.setVariablesReadOnly = function(readOnly){
if (_options.useCatalogVariableFieldHandler) {
_options.fieldIterator(function(field) {
if (field[CAT_VARIABLE] === true)
_this.setReadOnly(field.name, readOnly);
});
}
};
this.validateFormAsync = function() {
var __private = this.$private;
__private.isValidating = true;
var promise = new Promise(function(resolve, reject) {
if (_hasMandatoryFields(_this) && !_hasFieldErrors(_this)) {
var collection = [];
_onSubmitHandlers.forEach(function(handler) {
collection.push(
new Promise(function(res, rej) {
try {
handler.call(null) === false ? rej() : res();
} catch(e) {
rej(e);
}
}));
});
_onSubmittedHandlers.forEach(function(handler) {
collection.push(
new Promise(function(res, rej) {
try {
handler.call(handler, null);
res();
} catch(e) {
rej(e);
}
})
)
});
Promise.all(collection)
.then(function() {
resolve();
__private.isValidating = false;
})
.catch(function(e) {
reject(e);
__private.isValidating = false;
})
} else {
reject();
__private.isValidating = false;
}
});
return promise;
};
this.hideAllAnnotations = function() {
_setAnnotationsVisible(this,false);
};
this.showAllAnnotations = function() {
_setAnnotationsVisible(this,true);
};
this.toggleAnnotations = function() {
if (!_annotations)
_annotations = _getAllAnnotations();
var isShown = false;
for (var i = 0, iM = _annotations.length; i < iM; i++) {
if (_annotations[i].visible !== false) {
isShown = true;
break;
}
}
_setAnnotationsVisible(this, !isShown);
};
this.$private = {
isDirty: function(){ return Object.keys(_dirtyFields).length > 0; },
getField: _getField,
options: function(options) {
if (!options) {
return;
}
if (typeof options === 'string') {
return _options[options];
}
if (_options.isInitialized) {
throw 'Cannot override options';
}
Object.keys(options).forEach(function(optionName) {
_options[optionName] = options[optionName];
});
if (options.fieldIterator) {
_options.fieldIterator(function(field) {
field.originalValue = field.value;
});
}
if (_options.useCatalogVariableFieldHandler) {
var context = {
fields: _fields,
getField: _getField,
g_form: _this
};
_options.fieldIterator(function(field) {
if (field[CAT_VARIABLE] === true) {
catalogVariableHandler.create.call(null, context, field);
}
});
}
},
events: {
on: function(eventName, fn) {
switch (eventName) {
case EVENT_CHANGE:
case EVENT_ON_CHANGE:
_onChangeHandlers.push(fn);
break;
case EVENT_SUBMIT:
case EVENT_ON_SUBMIT:
_onSubmitHandlers.push(fn);
break;
case EVENT_SUBMITTED:
case EVENT_ON_SUBMITTED:
_onSubmittedHandlers.push(fn);
break;
case EVENT_CHANGED:
case EVENT_ON_CHANGED:
_onChangedHandlers.push(fn);
break;
case EVENT_PROPERTY_CHANGE:
case EVENT_ON_PROPERTY_CHANGE:
_onPropertyChangeHandlers.push(fn);
break;
case EVENT_STATE_CHANGE:
case EVENT_ON_STATE_CHANGE:
_onStateChangeHandlers.push(fn);
break;
case EVENT_LIVE_UPDATED:
case EVENT_ON_LIVE_UPDATED:
_onLiveUpdatedHandlers.push(fn);
break;
case EVENT_USER_CHANGE_VALUE:
case EVENT_ON_USER_CHANGE_VALUE:
_onUserChangedHandlers.push(fn);
break;
default:
throw 'Unsupported GlideForm event: ' + eventName;
}
},
propertyChange: function(type, name, propertyName, propertyValue) {
if (_onPropertyChangeHandlers.length == 0) {
return;
}
switch (type) {
default:
type = PROPERTY_CHANGE_FIELD;
case PROPERTY_CHANGE_FIELD:
case PROPERTY_CHANGE_SECTION:
case PROPERTY_CHANGE_RELATED_LIST:
case PROPERTY_CHANGE_FORM:
case PROPERTY_CHANGE_ATTACHMENTS:
break;
}
_onPropertyChangeHandlers.forEach(function(fn) {
fn.call(
fn,
type,
name,
propertyName,
propertyValue
);
});
},
userChangeValue: function(field, value) {
if (_onUserChangedHandlers.length == 0 || _equals(field.originalValue, value)) {
return;
}
_onUserChangedHandlers.forEach(function(fn) {
fn.call(fn, field.name, field.originalValue, value);
});
},
liveUpdated: function() {
if (_onLiveUpdatedHandlers.length > 0) {
var liveUpdatedFields = [];
for (var i = 0, iM = _fields.length; i < iM; i++) {
var field = _fields[i];
if (field.liveUpdate) {
liveUpdatedFields.push(field.name || field.variable_name);
}
}
_onLiveUpdatedHandlers.forEach(function(fn) {
fn.call(fn, liveUpdatedFields);
});
}
},
stateChange: function(state) {
if (state === _formState) {
return;
}
var previousState = _formState;
_formState = state;
if (_onStateChangeHandlers.length == 0) {
return;
}
_onStateChangeHandlers.forEach(function(fn) {
fn.call(
fn,
previousState,
_formState
);
});
},
off: function(eventName) {
switch (eventName) {
case EVENT_CHANGE:
case EVENT_ON_CHANGE:
_onChangeHandlers = [];
break;
case EVENT_SUBMIT:
case EVENT_ON_SUBMIT:
_onSubmitHandlers = [];
break;
case EVENT_SUBMITTED:
case EVENT_ON_SUBMITTED:
_onSubmittedHandlers = [];
break;
case EVENT_CHANGED:
case EVENT_ON_CHANGED:
_onChangedHandlers = [];
break;
case EVENT_PROPERTY_CHANGE:
case EVENT_ON_PROPERTY_CHANGE:
_onPropertyChangeHandlers = [];
break;
case EVENT_STATE_CHANGE:
case EVENT_ON_STATE_CHANGE:
_onStateChangeHandlers = [];
break;
case EVENT_LIVE_UPDATED:
case EVENT_ON_LIVE_UPDATED:
_onLiveUpdatedHandlers = [];
break;
case EVENT_USER_CHANGE_VALUE:
case EVENT_ON_USER_CHANGE_VALUE:
_onUserChangedHandlers = [];
break;
default:
throw 'Unsupported GlideForm event: ' + eventName;
}
},
cleanup: function() {
_onChangeHandlers = [];
_onSubmitHandlers = [];
_onSubmittedHandlers = [];
_onChangedHandlers = [];
_onPropertyChangeHandlers = [];
_onStateChangeHandlers = [];
_onLiveUpdatedHandlers = [];
_onUserChangedHandlers = [];
}
},
userState: {
setRunningAction: function(name, sysId) {
if (sysId && !name) {
name = sysId;
}
_submitAction = {name: name, sysId: sysId};
},
resetRunningAction: function() {
_submitAction = {name: DEFAULT_ACTION_NAME};
},
clearModifiedFields: function() {
_userModifiedFields = {};
},
getCurrentState: function() {
return _formState;
}
},
fieldState: {
isTemplateLoading: function(fieldName) {
return _fieldStates.templateLoading[fieldName] || false;
},
setTemplateLoading: function(fieldName, bool) {
_fieldStates.templateLoading[fieldName] = bool;
},
applyTemplateValue: function(fieldName, value, displayValue) {
_fieldStates.templateLoading[fieldName] = true;
var newValue = value;
var field = _getField(fieldName);
if (field.type === 'phone_number_e164' && value.indexOf(';') >= 0) {
var vals = value.split(";", 2);
newValue = vals[1];
if (field.value !== newValue) {
field.country = vals[0];
}
}
_this.setUserValue(fieldName, newValue, displayValue);
delete _fieldStates.templateLoading[fieldName];
}
},
validateForm: function(submitActionName) {
if (_hasMandatoryFields(_this) && !_hasFieldErrors(_this)) {
if (_runSubmitScripts(submitActionName)) {
return true;
}
}
return false;
},
applyLiveUpdate: function(updatedRecord, updatedBy) {
_isLiveUpdating = true;
Object.keys(updatedRecord).forEach(function(fieldName) {
var displayValue = updatedRecord[fieldName].display_value;
var value = updatedRecord[fieldName].value;
var displayString = updatedRecord[fieldName].display_string;
var field = _getField(fieldName);
if (!field) {
return;
}
var isUserModified = !!_userModifiedFields[fieldName];
if (isUserModified && _equals(value, _userModifiedFields[fieldName].newValue) && field.liveUpdate) {
field.liveUpdate = undefined;
} else if (!_equals(field.value, value)) {
var liveUpdate = {
isUserModified: isUserModified,
updatedBy: updatedBy,
value: value,
displayValue: displayValue
};
if (displayString)
liveUpdate.displayString = displayString;
field.originalValue = value;
field.liveUpdate = liveUpdate;
}
if (!isUserModified && field.value !== value) {
_setValue(_this, field, value, displayValue, {fromLiveUpdate: true});
}
_this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'liveUpdate',
liveUpdate
);
});
_isLiveUpdating = false;
_this.$private.events.liveUpdated();
},
clearOptionStack: function(fieldName) {
var field = _getField(fieldName);
if (!field) {
return;
}
_clearOptionStack(fieldName);
_this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'optionStack',
[]
);
},
setFieldInvalid: function(fieldName, isInvalid) {
var field = _getField(fieldName);
if (!field)
return;
return _setInvalid(_this, field, isInvalid);
},
showFieldInvalidMsg: function() {
_hasFieldErrors(_this);
},
setAdditionalFieldState: function(fieldName, propName, value) {
var field = _getField(fieldName);
if (!field) return;
if (_equals(field[propName], value)) return;
var allowToSet = false;
switch (field.type) {
case 'masked': {
allowToSet = field.useConfirmation && propName === 'confirmationValue';
break;
}
case 'container': {
allowToSet = field.containerType === 'one_to_many' && (propName === 'validated' || propName === 'updateDisplayValue');
break;
}
}
if (allowToSet) {
field[propName] = value;
_this.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
fieldName,
propName,
value
);
}
}
};
function _clearOptionStack(fieldName) {
var field = _getField(fieldName);
if (!field) {
return;
}
if (!field.optionStack) {
field.optionStack = [];
return;
}
field.optionStack.splice(0);
}
function _getField(fieldName) {
if (!fieldName) return null;
var field = null;
var variableField = null;
for (var i = 0, iM = _fields.length; i < iM; i++) {
var current = _fields[i];
if (current.name === fieldName || (current.isGlideVar && current.name.split('.').slice(-1)[0] === fieldName)) {
field = current;
break;
}
if (!variableField && current.variable_name === fieldName) {
variableField = current;
}
}
if (field)
return field;
if (variableField)
return variableField;
if (_options.getMappedField) {
var mapped = _options.getMappedField(fieldName);
if (mapped) {
return mapped;
}
}
return null;
}
function _getCurrencyValue(fieldName) {
return glideFormFieldFactory.getCurrencyValue(_getField(fieldName));
}
}
var _valueCalls = 0;
function _setValueGlideList(field, oldValue, g_form, displayValue, options) {
if (field.value.indexOf("/") > -1 && !displayValue) {
displayValue = field.value;
}
var opts = {};
Object.assign(opts, options, {skipDerivedFieldUpdate: true, skipDisplayValueUpdate: true});
if (Array.isArray(displayValue)) {
field.display_value_list = displayValue;
var newValue = field.value;
field.value = oldValue;
_setValue(g_form, field, newValue, displayValue.join(', '), opts);
return;
} else if (displayValue && field.value.split(',').length == displayValue.split(',').length) {
field.display_value_list = displayValue.split(',');
var newValue = field.value;
field.value = oldValue;
_setValue(g_form, field, newValue, displayValue, opts);
return;
}
field.displayValue = '';
field.display_value_list = [];
var table = _getReferenceTable(field);
var glideRequest = glideFormFactory.glideRequest;
var requestUri = '/api/now/ui/glide/list/element/display/' + table;
glideRequest.post(requestUri, {
dataType: 'json',
data: field.value.toString()
}).then(function(response) {
var result = response && response.data ? response.data.result : null;
var values = [];
var displayValues = [];
if (result) {
for (var i in result) {
values.push(result[i].sys_id);
displayValues.push(result[i].display);
}
}
field.value = oldValue;
field.display_value_list = displayValues;
if (typeof g_glide_list_separator == 'undefined')
var g_glide_list_separator = ', ';
_setValue(g_form, field, values.join(','), displayValues.join(g_glide_list_separator), opts);
});
}
function _setValue(g_form, field, value, displayValue, options) {
var noDisplayValue = displayValue === null || displayValue === undefined;
if (!field || (_equals(field.value, value) && (noDisplayValue || _equals(field.displayValue, displayValue)))) {
return;
}
if (value === null || value === undefined) value = '';
if (_isLiveUpdating && (!options || !options.fromLiveUpdate))
return;
var skipDerivedFieldUpdate = false;
var skipDisplayValueUpdate = false;
var isUserModified = false;
if (options) {
skipDerivedFieldUpdate = !!options.skipDerivedFieldUpdate;
skipDisplayValueUpdate = !!options.skipDisplayValueUpdate;
isUserModified = !!options.isUserModified;
}
var oldValue = field.value;
if (!_equals(oldValue, value)) {
if (field.originalValue === value) {
delete(_dirtyFields[field.name]);
} else {
_dirtyFields[field.name] = true;
}
if (isUserModified) {
var userSetValue = _userModifiedFields[field.name];
if (typeof userSetValue === 'undefined') {
_userModifiedFields[field.name] = {
initialValue: oldValue,
newValue: value
};
} else if (!_equals(userSetValue.initialValue, value)) {
userSetValue.newValue = value;
} else {
delete _userModifiedFields[field.name];
}
}
g_form.hideFieldMsg(field.name, true);
}
if (field.mandatory) {
if (glideFormFieldFactory.hasValue(field, value)) {
_setInvalid(g_form, field, false);
} else {
_setInvalid(g_form, field, true);
}
}
field.value = value;
if (field.type === 'reference') {
if (!skipDerivedFieldUpdate) {
_updateDerivedFields(g_form, field);
}
if (!skipDisplayValueUpdate && glideFormFieldFactory.hasValue(field) && !displayValue) {
field.displayValue = '';
g_form.getReference(field.name, function(gr) {
var displayValue = gr.getDisplayValue();
field.value = oldValue;
_setValue(g_form, field, value, displayValue, {
skipDerivedFieldUpdate: true,
skipDisplayValueUpdate: true
});
});
return;
}
} else if (field.type == 'glide_list') {
if (!glideFormFieldFactory.hasValue(field)) {
field.display_value_list = [];
displayValue = "";
}
else if (!skipDisplayValueUpdate) {
if (displayValue && !Array.isArray(displayValue))
_logWarn('g_form.setValue(field, value, displayValue)', 'When using setValue with a glide_list element: displayValue should be an array of display values.');
_setValueGlideList(field, oldValue, g_form, displayValue, options);
return;
}
} else if (field.type === 'choice') {
if (field.choices && displayValue === undefined) {
var items = field.choices.items || field.choices;
var valueStr = String(value);
items.forEach(function(choice) {
if (String(choice.value) === valueStr) {
displayValue = choice.displayValue || choice.label;
}
});
}
} else if (field.type === 'price'
&& window.NOW.currency && typeof window.NOW.currency === 'object'
&& window.NOW.locale && typeof window.NOW.locale === 'object') {
if (typeof displayValue === 'string' && displayValue.indexOf(";") > -1) {
value = displayValue;
} else if (typeof value !== 'string' || value === '') {
return;
} else if (value.indexOf(";") === -1) {
value = window.NOW.currency.code + ';' + value;
}
displayValue = value;
var currencyParts = value.split(';');
var currencyCode = currencyParts[0];
if (parseFloat(currencyParts[1], currencyParts[1].length).toString() !== currencyParts[1]) {
currencyParts[1] = g_form.getDecimalValue(field.name);
}
value = currencyParts[1].toString().replace(/[^\d-^.]/g,'');
var negPrefix = value.startsWith('-') ? '-' : '';
value = negPrefix + value.replace(/[^\d\.]/g, '');
var formatted = Number(value).toLocaleString(window.NOW.locale.code.replace(/_/g, '-'), {
style: 'currency',
currency: currencyCode,
minimumFractionDigits: 2,
maximumFractionDigits: 4,
currencyDisplay: 'code',
useGrouping: false
});
var reCurrency = new RegExp('(' + currencyCode + '|\u00A0|\u200F)+', 'g');
formatted = formatted.replace(reCurrency, '');
value = currencyCode + ';' + formatted;
}
var oldDisplayValue = field.displayValue;
field.displayValue = typeof displayValue !== 'undefined' && displayValue != null ? displayValue : value;
var fields = _getDependentFields(field.name);
fields.forEach(function(field) {
var changed = false;
if (!_equals(field.dependentValue, value)) {
field.dependentValue = value;
if (_requiresResetAfterDependentChanged(field.type))
_setValue(g_form, field, '', '', options);
changed = true;
}
if (field.ed && !_equals(field.ed.dependent_value, value)) {
field.ed.dependent_value = value;
changed = true;
}
if (changed) {
g_form.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'dependentValue',
value
);
}
});
if (!_equals(oldValue, value) || !_equals(oldDisplayValue, displayValue)) {
_fireValueChange(g_form, field, value);
}
}
function _getRelatedList(listTableName) {
if (!_options.relatedLists) {
return null;
}
var foundList = null;
_options.relatedLists.forEach(function(list) {
if (foundList) {
return;
}
if (listTableName === _getRelatedListName(list)) {
foundList = list;
return;
}
if (list.relationship_id && list.relationship_id === listTableName) {
foundList = list;
return;
}
if (listTableName === list.table || listTableName === list.field) {
foundList = list;
return;
}
});
return foundList;
}
function _getRelatedListName(list) {
if (list.related_field) {
return list.value;
}
return list.table + '.' + list.field;
}
function _getSection(sectionName) {
if (!_options.sections) {
return null;
}
var foundSection = null;
_options.sections.forEach(function(section) {
if (foundSection) {
return;
}
var name = _getSectionName(section);
if (name === sectionName) {
foundSection = section;
return;
}
});
return foundSection;
}
function _getSectionName(section) {
var sectionName = section.caption;
if (!sectionName) {
return null;
}
return sectionName.toLowerCase().replace(" ", "_").replace(/[^0-9a-z_]/gi, "");
}
function _fireValueChange(g_form, field, value) {
if (_onChangeHandlers.length > 0) {
_valueCalls++;
_onChangeHandlers.forEach(function(fn) {
fn.call(fn, field.name, field.originalValue, value);
});
_valueCalls--;
}
if (_options.getMappedFieldName) {
var mappedName = _options.getMappedFieldName(field.name);
_valueCalls++;
_onChangeHandlers.forEach(function(fn) {
fn.call(fn, mappedName, field.originalValue, value);
});
_valueCalls--;
}
if (_valueCalls === 0) {
g_form.$private.events.stateChange(g_form.isUserModified() ? FORM_STATE_MODIFIED : FORM_STATE_UNMODIFIED);
if (_onChangedHandlers.length > 0) {
_onChangedHandlers.forEach(function(fn) {
fn.call(fn);
});
}
}
}
function _updateDerivedFields(g_form, originatingField) {
var derivedFields = _getDerivedFields(originatingField.name);
if (!glideFormFieldFactory.hasValue(originatingField)) {
derivedFields.forEach(function(field) {
_setValue(g_form, field, '', null, {skipDerivedFieldUpdate: true});
});
return;
}
var relativeFieldNames = [];
var fieldsByRelativeFieldName = {};
derivedFields.forEach(function(field) {
var relativeField = _relativeDerivedFieldName(field.name, originatingField.name);
fieldsByRelativeFieldName[relativeField] = field;
relativeFieldNames.push(relativeField);
if (_hasDependentField(field))
relativeFieldNames.push(
_relativeDerivedFieldName(field.dependentField, originatingField.name)
);
});
if (relativeFieldNames.length == 0) {
return;
}
var glideRequest = glideFormFactory.glideRequest;
var referenceTable = _getReferenceTable(originatingField);
var referenceKey = originatingField.reference_key ? originatingField.reference_key : 'sys_id';
var requestUri = '/api/now/v1/table/' + referenceTable;
var requestParams = {
sysparm_display_value: 'all',
sysparm_fields: relativeFieldNames.join(','),
sysparm_query: referenceKey + '=' + originatingField.value,
sysparm_limit: 1
};
glideRequest.get(requestUri, {
params: requestParams
}).then(function(response) {
var result = response && response.data ? response.data.result : null;
if (result.length > 0) {
result = result[0];
var keys = Object.keys(result);
keys.forEach(function(fieldName) {
var field = fieldsByRelativeFieldName[fieldName];
if (field) {
var newFieldValues = result[fieldName];
if (_hasDependentField(field)) {
field = _updateDependentValues(
field,
result[_relativeDerivedFieldName(field.dependentField, originatingField.name)]
);
}
_setValue(g_form, field, newFieldValues.value, newFieldValues.display_value, {skipDerivedFieldUpdate: true, skipDisplayValueUpdate: true});
}
});
}
});
}
function _updateDependentValues(field, dependent) {
if (!field || !dependent)
return field;
field.dependentTable = dependent.value;
field.dependentValue = dependent.display_value
? dependent.display_value
: dependent.value;
return field;
}
function _hasDependentField(field) {
return !!field.dependentField;
}
function _isReadOnly(g_form, field) {
return glideFormFieldFactory.isReadonly(field);
}
function _isMandatory(g_form, field) {
return glideFormFieldFactory.isMandatory(field);
}
function _getAllAnnotations() {
var annotations = [];
for (var i = 0, iM = _fields.length; i < iM; i++) {
if (_fields[i].type === 'annotation') {
annotations.push(_fields[i])
}
}
return annotations;
}
function _setAnnotationsVisible(g_form, visible) {
if (!_annotations)
_annotations = _getAllAnnotations();
for (var i = 0, iM = _annotations.length; i < iM; i++) {
g_form.setVisible(_annotations[i].name, visible);
}
}
function _getDependentFields(fieldName) {
var fields = [];
for (var i = 0, iM = _fields.length; i < iM; i++) {
var field = _fields[i];
if (field.dependentField === fieldName) {
fields.push(field);
}
}
return fields;
}
function _getDerivedFields(fieldName) {
var fields = [];
var derivedFieldPrefix = fieldName + '.';
for (var i = 0, iM = _fields.length; i < iM; i++) {
var field = _fields[i];
if (field.name.startsWith(derivedFieldPrefix)) {
fields.push(field);
}
}
return fields;
}
function _relativeDerivedFieldName(derivedFieldName, rootFieldName) {
var prefix = rootFieldName + '.';
return derivedFieldName.replace(prefix , '');
}
function _addToOptionStack(field, operation, value, label, index) {
if (!field.optionStack) {
field.optionStack = [];
}
if (operation === 'add') {
if (typeof value == 'undefined')
value = label;
for (var i = field.optionStack.length - 1; i >= 0; i--) {
if (field.optionStack[i].value === value) {
if (field.optionStack[i].operation === 'add') {
return false;
}
break;
}
}
}
var optionOper = {
operation: operation,
label: label,
value: value,
index: index
};
if (operation === 'clear') {
field.optionStack.splice(0, field.optionStack.length, optionOper);
} else {
field.optionStack.push(optionOper);
}
return true;
}
function _hasMandatoryFields(g_form) {
var emptyMandatoryFields = [];
_options.fieldIterator(function(f) {
if (!glideFormFieldFactory.isMandatory(f)) {
return;
}
if (!glideFormFieldFactory.hasValue(f)) {
emptyMandatoryFields.push(f.label);
_setInvalid(g_form, f,  true);
} else {
!f.isInvalid && _setInvalid(g_form, f, false);
}
});
if (emptyMandatoryFields.length === 0) {
return true;
}
var mandatoryFieldMsg = _getMessage('MANDATORY_MESSAGE', 'The following mandatory fields are not filled in') + ':';
if (typeof g_mandatory_field_msg !== "undefined") {
mandatoryFieldMsg = g_mandatory_field_msg;
}
var message = mandatoryFieldMsg + "\n\n" + emptyMandatoryFields.join("\n");
_fireUiMessage(g_form, 'mandatoryMessage', message);
return false;
}
function _getMessage(key, defaultText) {
if (_options.messages) {
return _options.messages[key];
}
return defaultText;
}
function _hasFieldErrors(g_form) {
var errorFields = [];
_options.fieldIterator(function(f) {
if (f.isInvalid === true) {
errorFields.push(f.label);
}
});
if (errorFields.length === 0) {
return false;
}
var errorFieldMsg = _getMessage('FIELD_ERROR_MESSAGE', 'The following fields contain errors') + ':';
if (typeof g_field_error_msg !== "undefined") {
errorFieldMsg = g_field_error_msg;
}
var message = errorFieldMsg + "\n\n" + errorFields.join("\n");
_fireUiMessage(g_form, 'errorMessage', message);
return true;
}
function _runSubmitScripts(submitActionName) {
if (_onSubmitHandlers.length > 0) {
var result;
for (var i = 0, iM = _onSubmitHandlers.length; i < iM; i++) {
result = _onSubmitHandlers[i].call(null);
if (result === false) {
return false;
}
}
}
if (_onSubmittedHandlers.length > 0) {
_onSubmittedHandlers.forEach(function(fn) {
fn.call(fn, submitActionName);
});
}
return true;
}
function _getUIAction(name) {
if (!uiActions) {
return false;
}
var action = uiActions.getActionByName(name);
if (!action) {
_logWarn('NOACTION', 'Could not find UI Action: ' + name);
}
return action;
}
function _getDirtyQueryFields(fields) {
var dirtyFields = {};
if (fields) {
fields.forEach(function(field) {
if (typeof field.dirtyQueryField !== 'undefined' && field.dirtyQueryField === true) {
dirtyFields[field.name] = true;
}
});
}
return dirtyFields;
}
function _getReferenceTable(field) {
var referenceTable = field.ed ? field.ed.reference : undefined;
if (typeof referenceTable === 'undefined') {
referenceTable = field.refTable;
}
if (typeof referenceTable === 'undefined') {
referenceTable = field.ref_table;
}
if (typeof referenceTable === 'undefined') {
referenceTable = field.reference;
}
return referenceTable;
}
function _fireUiMessage(g_form, type, message) {
var handledMessage = false;
if (_options.uiMessageHandler) {
var response = _options.uiMessageHandler(g_form, type, message);
handledMessage = response !== false;
}
if (!handledMessage && typeof message !== 'undefined') {
alert(message);
}
g_form.$private.events.propertyChange(
PROPERTY_CHANGE_FORM,
null,
type
);
}
function _fireFormMessage(g_form, action, messageType , message) {
var handledMessage = false;
if (_options.formMessageHandler) {
var response = _options.formMessageHandler(g_form, action, messageType, message);
handledMessage = response !== false;
}
if (!handledMessage && action === 'addFormMessage' && typeof message !== 'undefined') {
alert(message);
}
g_form.$private.events.propertyChange(
PROPERTY_CHANGE_FORM,
action,
messageType,
message
);
}
function _setInvalid(g_form, field, invalid) {
var prevInvalid = !!field.isInvalid;
if (prevInvalid === invalid) {
return;
}
field.isInvalid = invalid;
g_form.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'isInvalid',
field.isInvalid
);
}
var instance = new GlideForm();
if (options) {
instance.$private.options(options);
}
_deprecate(instance, [
'flash',
'getElement',
'getFormElement',
'getSections'
]);
return instance;
}
function GlideFormControl(g_form, name, type) {
this.g_form = g_form;
this.name = name;
this.options = [];
this.type = type;
this.focus = function() {
_logWarn('NO:FOC', 'Focus not implemented for ' + this.name);
};
Object.defineProperty(this, 'value', {
get: function() {
return this.g_form.getValue(this.name);
},
set: function(val) {
this.g_form.setValue(this.name, val);
}
});
}
function _getBoolean(value) {
if (value === 'true') {
value = true;
} else if (value === 'false') {
value = false;
}
return value ? true : false;
}
function _notImplemented(instance, methods) {
methods.forEach(function(method) {
if (!instance[method]) {
instance[method] = function() {
_logWarn('UNSUPPORTED', 'Method ' + method + ' is not supported on mobile');
};
}
});
}
function _deprecate(instance, methods) {
methods.forEach(function(method) {
if (!instance[method]) {
instance[method] = function() {
_logWarn('DEPRECATED', 'Method ' + method + ' is deprecated and unsupported on mobile');
};
}
});
}
function _logWarn(code, msg) {
if (console && console.warn) {
console.warn('(g_form) [' + code + '] ' + msg);
}
}
function _isArray(o) {
if (!Array.isArray) {
return Object.prototype.toString.call(arg) === '[object Array]';
}
return Array.isArray(o);
}
function _copy(source, serializedExclusionList) {
var dest = {};
for (var prop in source) {
if (serializedExclusionList && serializedExclusionList.indexOf && serializedExclusionList.indexOf(prop) >= 0)
continue;
if (Object.prototype.hasOwnProperty.call(source, prop)) {
switch (typeof source[prop]) {
case 'function':
break;
default:
dest[prop] = source[prop];
}
}
}
return dest;
}
function _isEditableField(field) {
if (!field) {
return false;
}
if (!field.visible) {
return false;
}
if (glideFormFieldFactory.isReadonly(field)) {
return false;
}
return true;
}
function _requiresResetAfterDependentChanged(fieldType) {
return STRICTLY_DEPENDENT_FIELD_TYPES.indexOf(fieldType) >= 0;
}
})(window, window.document || {}, window.glideFormFieldFactory, window.catalogVariableHandler);
;
/*! RESOURCE: /scripts/sn/common/clientScript/uiPolicyTypes.js */
(function(exports, undefined) {
'use strict';
var UI_POLICY_TYPES = {
dateTypes: {
glide_date_time: "datetime",
glide_date: "date",
date: "date",
datetime: "datetime",
due_date: "datetime"
},
numberTypes: {
decimal: "decimal",
numeric: "numeric",
integer: "integer",
float: "float"
},
currencyTypes: {
currency: "currency",
price: "price"
}
};
exports.UI_POLICY_TYPES = UI_POLICY_TYPES;
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/uiPolicyFactory.js */
(function(exports, undefined) {
'use strict';
exports.uiPolicyFactory = {
create: createUiPolicy
};
var uiPolicyTypes = exports.UI_POLICY_TYPES;
var userFormat, standardFormat;
function getConditionFields(conditions) {
var fields = conditions.reduce(function(collect, condition) {
var fieldName = condition.field;
if (fieldName != null && typeof fieldName !== 'undefined') {
collect[fieldName] = true;
}
return collect;
}, {});
return Object.keys(fields);
}
function createUiPolicy(g_form, uiPolicyMap, scripts) {
var _tableName = uiPolicyMap.table || g_form.getTableName();
var _description = uiPolicyMap.short_description;
var _onLoad = uiPolicyMap.onload;
var _conditions = uiPolicyMap.conditions;
var _fields = uiPolicyMap.condition_fields || getConditionFields(_conditions);
var _preEvaluated = uiPolicyMap.pre_evaluated;
var _watchFields = {};
var _lastResult = null;
var _isDebug = false;
initializePolicy();
function initializePolicy() {
_fields.forEach(function(field, i){
var condition = _conditions[i];
_watchFields[field] = true;
if (_isField2FieldComparisonlOper(condition.oper)) {
var field2 = condition.value.split('@')[0];
_watchFields[field2] = true;
}
});
g_form.$private.events.on('change', onChangeForm);
if (_onLoad && (!_preEvaluated || g_form.$private.isDirty())) {
runPolicy();
}
}
function onChangeForm(fieldName, oldValue, newValue) {
if (_watchFields[fieldName]) {
runPolicy();
}
}
function runPolicy() {
_debug("Running policy on table: " + _tableName + " " + _description);
runActions(!!evaluateCondition());
}
function evaluateCondition() {
_debug("--->>> Evaluating condition:");
var result = "?";
var conditionResult = true;
var terms = _conditions;
for (var i = 0; i < terms.length; i++) {
var t = terms[i];
if (t.newquery) {
if  (result == "t") {
_debug("---<<< condition exited with: TRUE");
return true;
} else {
_debug(" OR (next condition)");
conditionResult = true;
}
}
if (!conditionResult)
continue;
if (t.or) {
if (result != "t")
result = _evaluateTermTF(t);
} else {
if ((result == "f") && (!t.newquery)) {
conditionResult = false;
} else {
result = _evaluateTermTF(t);
}
}
}
var response = result != "f";
_debug("---<<< End evaluating condition with result: " + response);
return response;
}
function _evaluateTermTF(term) {
var result = evaluateTerm(term);
_debugTerm(term, result);
if (result)
return "t";
else
return "f";
}
function evaluateTerm(term) {
var type = term.type;
if (!g_form.hasField(term.field)) {
if (term.pre_evaluated_term) {
return term.pre_evaluated_term_result;
}
return false;
}
if (uiPolicyTypes.dateTypes[type])
return evaluateTermDate(term);
if (uiPolicyTypes.numberTypes[type] || uiPolicyTypes.currencyTypes[type])
return evaluateTermNumber(term);
var field = term.field;
if (!field)
return false;
var oper = term.oper;
var value = term.value;
var userValue = g_form.getValue(field) + '';
switch (oper) {
case '=':
return userValue === value;
case '!=':
return userValue != value;
case '<':
return userValue < value;
case '<=':
return userValue <= value;
case '>':
return userValue > value;
case '>=':
return userValue >= value;
case 'ANYTHING':
return userValue ? true : false;
case 'IN':
var values = value.split(',');
return userValue && (_inArray(userValue, values) !== -1);
case 'NOT IN':
var values2 = value.split(',');
return _inArray(userValue, values2) === -1;
case 'STARTSWITH':
if (type == 'reference')
userValue = g_form.getDisplayValue(field);
return userValue ? (userValue.indexOf(value) === 0): false;
case 'ENDSWITH':
if (type == 'reference')
userValue = g_form.getDisplayValue(field);
return userValue ? (userValue.lastIndexOf(value) == userValue.length - value.length) : false;
case 'LIKE':
if (type == 'reference')
userValue = g_form.getDisplayValue(field);
return userValue ? (userValue.indexOf(value) != -1) : false;
case 'NOT LIKE':
if (type == 'reference')
userValue = g_form.getDisplayValue(field);
return userValue ? (userValue.indexOf(value) == -1) : true;
case 'ISEMPTY':
return userValue === '';
case 'ISNOTEMPTY':
return userValue !== '';
case 'BETWEEN':
var values3 = value.split('@');
return userValue && userValue >= values3[0] && userValue <= values3[1];
case 'SAMEAS':
userValue = (type == 'reference') ? g_form.getDisplayValue(term.field) : g_form.getValue(term.field);
value = (type == 'reference') ? g_form.getDisplayValue(term.value) : g_form.getValue(term.value);
return userValue == value;
case 'NSAMEAS':
userValue = (type == 'reference') ? g_form.getDisplayValue(term.field) : g_form.getValue(term.field);
value = (type == 'reference') ? g_form.getDisplayValue(term.value) : g_form.getValue(term.value);
return userValue != value;
default:
return false;
}
}
function evaluateTermNumber(term) {
var field = term.field;
if (!field)
return false;
var oper = term.oper;
var value = term.value;
if (value !== '' && value.indexOf(',') === -1)
value = parseFloat(value);
var userValue = getUserValue(term);
switch (oper) {
case '=':
return userValue === value;
case '!=':
return userValue != value;
case '<':
return userValue < value;
case '<=':
return userValue <= value;
case '>':
return userValue > value;
case '>=':
return userValue >= value;
case 'IN':
var values = (value + "").split(',');
return userValue.toString() && (_inArray(userValue.toString(), values) !== -1);
case 'NOT IN':
var values2 = (value + "").split(',');
return _inArray(userValue.toString(), values2) === -1;
case 'ISEMPTY':
return userValue.toString() === '';
case 'ISNOTEMPTY':
return userValue.toString() !== '';
case "GT_FIELD":
userValue = parseInt(g_form.getValue(term.field));
value = parseInt(g_form.getValue(term.value));
return userValue > value;
case "LT_FIELD":
userValue = parseInt(g_form.getValue(term.field));
value = parseInt(g_form.getValue(term.value));
return userValue < value;
case "GT_OR_EQUALS_FIELD":
userValue = parseInt(g_form.getValue(term.field));
value = parseInt(g_form.getValue(term.value));
return userValue >= value;
case "LT_OR_EQUALS_FIELD":
userValue = parseInt(g_form.getValue(term.field));
value = parseInt(g_form.getValue(term.value));
return userValue <= value;
default:
return false;
}
}
function evaluateTermDate(term) {
var value = term.value;
var userValue = g_form.getValue(term.field) + '';
var values = value.split('@');
var isDateTime = uiPolicyTypes.dateTypes[term.type] == "datetime";
if (userValue) {
if (typeof g_user_date_time_format != "undefined" && typeof g_user_date_format != "undefined") {
userFormat = isDateTime ? g_user_date_time_format : g_user_date_format;
standardFormat = g_user_date_time_format;
} else if (!isDateTime)
userValue += " 00:00:00";
}
if (term.oper == 'ISEMPTY')
return userValue === '';
var userDate = _getDate(userValue, userFormat);
if (isNaN(userDate)) {
_debug("evaluateTermDate - invalid date, returning false");
return false;
}
if (term.oper == "RELATIVE")
return _evaluateTermDateRelative(userDate, value, isDateTime);
if (term.oper == "DATEPART")
return _evaluateTermDateTrend(userDate, value);
var valueDate, valueDate1, valueDate2;
switch (term.oper) {
case '=':
return g_form.getValue(term.field) === value;
case '!=':
return g_form.getValue(term.field) != value;
case 'ISNOTEMPTY':
return userValue !== '';
case '<=':
case '<':
valueDate = _getDate(value, standardFormat);
return (valueDate !== 0) && (userDate < valueDate);
case '>=':
case '>':
valueDate = _getDate(value, standardFormat);
return (valueDate !== 0) && (userDate > valueDate);
case 'ON':
valueDate1 = _getDate(values[1], standardFormat);
valueDate2 = _getDate(values[2], standardFormat);
return (valueDate1 !== 0) && (valueDate2 !== 0) && (userDate >= valueDate1) && (userDate <= valueDate2);
case 'NOTON':
valueDate1 = _getDate(values[1], standardFormat);
valueDate2 = _getDate(values[2], standardFormat);
return (valueDate1 !== 0) && (valueDate2 !== 0) && ((userDate < valueDate1) || (userDate > valueDate2));
case 'BETWEEN':
valueDate1 = _getDate(values[0], standardFormat);
valueDate2 = _getDate(values[1], standardFormat);
return (valueDate1 !== 0) && (valueDate2 !== 0) && (userDate >= valueDate1) && (userDate <= valueDate2);
case 'LESSTHAN':
return _dateComparisonHelper(term.field, term.value, 'LT');
case 'MORETHAN':
return _dateComparisonHelper(term.field, term.value, 'GT');
default:
_debug("evaluateTermDate - unsupported operator '" + term.oper + "'. Returning FALSE.");
return false;
}
}
function _dateComparisonHelper(left, right, comparison) {
var parsed = _parseField2FieldValue(right);
var userValue =  g_form.getValue(left);
var value =  g_form.getValue(parsed.fieldName);
if(_isNullField(value) || _isNullField(userValue)){
_debug("ui policy could not find a valid field to compare against. Returning FALSE.");
return false;
}
var userDate = _getDate(userValue, userFormat);
var theDate = _getDate(value, userFormat);
if(parsed.interval == 'quarter') {
userDate = _roundDateToQuarter(userDate);
theDate = _roundDateToQuarter(theDate);
}
var diff = userDate - theDate;
if(parsed.beforeAfter == 'before' && diff > 0)
return false;
if(parsed.beforeAfter == 'after' && diff < 0)
return false;
var xDiff;
if(parsed.interval == 'quarter') {
var Qdiff = Math.abs(_getAbsQuarter(theDate) - _getAbsQuarter(userDate));
xDiff = Qdiff - parsed.intervalValue;
} else {
var timeSpan = _getIntervalInMilliSeconds(parsed.interval, parsed.intervalValue);
xDiff = Math.abs(diff) - Math.abs(timeSpan);
}
if(comparison === 'GT')
return xDiff > 0;
if(comparison === 'LT')
return xDiff < 0;
}
function _getAbsQuarter(theDate) {
var quarters = [1,1,1,2,2,2,3,3,3,4,4,4];
var Q = quarters[theDate.getMonth()];
var Y = theDate.getFullYear() * 4;
return Y+Q;
}
function _roundDateToQuarter(theDate) {
var quarters = [0,0,0,3,3,3,6,6,6,9,9,9];
var Q = quarters[theDate.getMonth()];
var d = new Date();
d.setFullYear(theDate.getFullYear(), Q, 0);
d.setHours(0,0,0);
return d;
}
function _isNullField(fieldValue) {
return typeof fieldValue == 'undefined' || fieldValue == null || fieldValue == '';
}
function _parseField2FieldValue(daString) {
var daArray = daString.split('@');
return {
fieldName: daArray[0],
interval: daArray[1],
intervalValue: parseInt(daArray[3], 10),
beforeAfter: daArray[2]
};
}
function _getIntervalInMilliSeconds(interval, value) {
var ms = {};
ms.hour    = 1000 * 60 * 60;
ms.day     = ms.hour * 24;
ms.week    = ms.day * 7;
ms.month   = ms.day * 30;
ms.year    = ms.day * 365;
return ms[interval]* value;
}
function _getDate(dateValue, dateFormat) {
if (dateValue) {
if (dateFormat)
return getDateFromFormat(dateValue, dateFormat) || undefined;
dateValue = dateValue.replace(/\s/, 'T');
return new Date(dateValue);
}
}
function _evaluateTermDateTrend(userDateMilliseconds, trendValueString) {
var userDate = new Date(userDateMilliseconds);
var trendParams = trendValueString.split("@");
if (trendParams.length != 2 || !trendParams[1])
return;
var trendParamParts = trendParams[1].split(",");
if (trendParamParts.length != 3)
return;
var trendType = trendParamParts[0];
var trendValue = trendParamParts[1];
var trendOper = trendParamParts[2];
var checkVals;
switch (trendType) {
case 'dayofweek':
checkVals = _trendDayOfWeek(userDate, trendValue, trendOper);
break;
case 'month':
checkVals =  _trendMonth(userDate, trendValue, trendOper);
break;
case 'year':
checkVals =  _trendYear(userDate, trendValue, trendOper);
break;
case 'week':
checkVals =  _trendWeek(userDate, trendValue, trendOper);
break;
case 'hour':
checkVals =  _trendHour(userDate, trendValue, trendOper);
break;
case 'quarter':
checkVals =  _trendQuarter(userDate, trendValue, trendOper);
break;
default:
_debug("_evaluateTermDateTrend - unsupported trend type '" + trendType + "'. Returning FALSE.");
return false;
}
return _evaluateDateValues(checkVals, trendOper);
}
function _evaluateTermDateRelative(userDateMilliseconds, relativeValueString, isDateTime) {
var relativeValues = relativeValueString.split('@');
if (!relativeValues || relativeValues.length != 4 || isNaN(relativeValues[3]))
return false;
var oper = relativeValues[0];
var termType = relativeValues[1];
var termWhen = relativeValues[2];
var termValue = parseInt(relativeValues[3], 10);
var modifier = 1;
if (termWhen == "ahead")
modifier = -1;
var relativeValueMilliseconds;
switch (termType) {
case 'hour':
relativeValueMilliseconds = hoursAgoInMilliseconds(modifier * termValue);
break;
case 'minute':
relativeValueMilliseconds = minutesAgoInMilliseconds(modifier * termValue);
break;
case 'dayofweek':
relativeValueMilliseconds = daysAgoInMilliseconds(modifier * termValue);
break;
case 'month':
relativeValueMilliseconds = monthsAgoInMilliseconds(modifier * termValue);
break;
case 'quarter':
relativeValueMilliseconds = quartersAgoInMilliseconds(modifier * termValue);
break;
case 'year':
relativeValueMilliseconds = yearsAgoInMilliseconds(modifier * termValue);
break;
default:
_debug("_evaluateTermDateRelative - unsupported type '" + termType + "'. Returning FALSE.");
return false;
}
var checkVals;
if (isDateTime) {
checkVals = {
checkValue : relativeValueMilliseconds,
userValue  : userDateMilliseconds
};
} else {
checkVals = {
checkValue : _removeTime(relativeValueMilliseconds),
userValue  : _removeTime(userDateMilliseconds)
};
}
return _evaluateDateValues(checkVals, oper) ;
}
function _evaluateDateValues(checkVals, oper) {
if (!checkVals)
return;
switch (oper) {
case 'EE':
return checkVals.userValue === checkVals.checkValue;
case 'LT':
return checkVals.userValue < checkVals.checkValue;
case 'LE':
return checkVals.userValue <= checkVals.checkValue;
case 'GT':
return checkVals.userValue > checkVals.checkValue;
case 'GE':
return checkVals.userValue >= checkVals.checkValue;
default:
_debug("_evaluateDateValues - unsupported operator '" + oper + "'. Returning FALSE.");
return false;
}
}
function _removeTime(dateInMilliseconds) {
var newDate = new Date(dateInMilliseconds);
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
newDate.setMilliseconds(0);
return newDate.getTime();
}
function _trendDayOfWeek(userDate, trendValue) {
var trendDays = ['monday', 'tuesday', 'wednesday', 'thurday', 'friday', 'saturday', 'sunday'];
var foundIn = -1;
for (var i = 0; i < 7; i++)
if (trendDays[i] == trendValue) {
foundIn = i;
break;
}
if (foundIn < 0)
return;
var userDOW = userDate.getDay();
userDOW = userDOW - 1;
if (userDOW < 0)
userDOW = 6;
return {
checkValue : foundIn,
userValue : userDOW
};
}
function _trendMonth(userDate, trendValue) {
var trendMonths = [ 'jan', 'feb', 'mar', 'apr', 'may', 'june', 'july', 'aug', 'sep', 'oct', 'nov', 'dec' ];
var foundIn = -1;
for (var i = 0; i < 12; i++)
if (trendMonths[i] == trendValue) {
foundIn = i;
break;
}
if (foundIn < 0)
return;
return {
checkValue : foundIn,
userValue : userDate.getMonth()
};
}
function _trendYear(userDate, trendValue) {
return {
checkValue : trendValue,
userValue : userDate.getFullYear()
};
}
function _trendHour(userDate, trendValue) {
return {
checkValue : trendValue,
userValue : userDate.getHour()
};
}
function _trendQuarter(userDate, trendValue) {
var quarters = [ 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4 ];
return {
checkValue : trendValue,
userValue  : quarters[userDate.getMonth()]
};
}
function _trendWeek(userDate, trendValue) {
var checkDate = new Date(userDate.getFullYear(), 0, 1);
var userWeek = (Math.ceil((((userDate.getTime() - checkDate) / 86400000) + checkDate.getDay()+1)/7))-1;
return {
checkValue : trendValue,
userValue : userWeek
};
}
function quartersAgoInMilliseconds(quarters) {
var now = new Date();
var quartersModifier = [ 0, 1, 1, 1, 4, 4, 4, 7, 7, 7, 10, 10, 10 ];
var month = now.getMonth() + 1;
var quarterBegin = quartersModifier[month];
var monthsBack = month - quarterBegin + (quarters * 3);
return monthsAgoInMilliseconds(monthsBack);
}
function yearsAgoInMilliseconds(years) {
var now = new Date();
var yearsAgo = now.getFullYear() - years;
now.setFullYear(yearsAgo);
return now.getTime(now);
}
function monthsAgoInMilliseconds(months) {
var now = new Date();
var monthsAgo = now.getMonth() - months;
now.setMonth(monthsAgo);
return now.getTime(now);
}
function daysAgoInMilliseconds(days) {
return hoursAgoInMilliseconds(days * 24);
}
function hoursAgoInMilliseconds(hours){
return minutesAgoInMilliseconds(hours * 60);
}
function minutesAgoInMilliseconds(minutes){
return secondsAgoInMilliseconds (minutes * 60);
}
function secondsAgoInMilliseconds(seconds){
return new Date().getTime() - (seconds * 1000);
}
function getUserValue(term) {
if (typeof g_form == "undefined")
return '';
var userValue = g_form.getValue(term.field + ".storage") + '';
if (userValue)
return g_form.getDecimalValue(term.field + ".storage");
var uv = g_form.getValue(term.field);
if (!uv || uv.length === 0)
return '';
return g_form.getDecimalValue(term.field);
}
function runActions(result) {
if (result === _lastResult) {
_debug("No change - not running any actions");
return;
}
_lastResult = result;
if (result) {
for (var i = 0; i < uiPolicyMap.actions.length; i++) {
var action = uiPolicyMap.actions[i];
if (action.relatedList)
_runListAction(action, result);
else
_runAction(action, result);
}
if (uiPolicyMap.script_true) {
_runScript(uiPolicyMap.script_true.name);
}
if (uiPolicyMap.hasOwnProperty("list_actions")) {
for (var k = 0; k < uiPolicyMap.list_actions.length; k++) {
var list_action = uiPolicyMap.list_actions[k];
_runListAction(list_action, result);
}
}
} else if (uiPolicyMap.reverse) {
for (var j = 0; j < uiPolicyMap.actions.length; j++) {
var action2 = uiPolicyMap.actions[j];
if (action2.relatedList)
_runListAction(action2, result);
else
_runAction(action2, result);
}
if (uiPolicyMap.script_false) {
_runScript(uiPolicyMap.script_false.name);
}
if (uiPolicyMap.hasOwnProperty("list_actions")) {
for (var l = 0; l < uiPolicyMap.list_actions.length; l++) {
var list_action = uiPolicyMap.list_actions[l];
_runListAction(list_action, result);
}
}
}
}
function _runScript(name) {
if (typeof name !== "string" || !name.length)
return;
try {
scripts[name].execute();
} catch (e) {
console.log("UI policy script error: " + e);
}
}
function _runAction(action, result) {
if (typeof g_form == "undefined")
return;
var field = action.name,
mandatory = action.mandatory,
visible = action.visible,
disabled = action.disabled,
cleared = action.cleared || action.clearValue;
if (mandatory == 'true') {
g_form.setMandatory(field, result);
_debugAction(field, "mandatory", result);
} else if (mandatory == 'false') {
g_form.setMandatory(field, !result);
_debugAction(field, "mandatory", !result);
}
if (visible == 'true') {
g_form.setDisplay(field, result);
_debugAction(field, "visible", result);
} else if (visible == 'false') {
g_form.setDisplay(field, !result);
_debugAction(field, "visible", !result);
}
if (disabled == 'true') {
g_form.setReadOnly(field, result);
_debugAction(field, "disabled", result);
} else if (disabled == 'false') {
g_form.setReadOnly(field, !result);
_debugAction(field, "disabled", !result);
}
if (cleared == 'true' && result) {
g_form.setValue(field, "");
_debugAction(field, "clear", true);
}
if (mandatory == 'true') {
g_form.setMandatory(field, result);
_debugAction(field, "mandatory", result);
}
}
function _runListAction(action, result) {
var list = action.name || action.relatedList;
var visible = action.visible;
if (result) {
if (visible == 'true')
g_form.showRelatedList(list);
else if (visible == 'false')
g_form.hideRelatedList(list);
} else {
if (visible == 'true')
g_form.hideRelatedList(list);
else if (visible == 'false')
g_form.showRelatedList(list);
}
}
function _isField2FieldComparisonlOper(oper) {
var special = [
"MORETHAN",
"LESSTHAN",
"GT_FIELD",
"LT_FIELD",
"GT_OR_EQUALS_FIELD",
"LT_OR_EQUALS_FIELD",
"SAMEAS",
"NSAMEAS"
];
return special.indexOf(oper) > -1;
}
function _inArray(val, array) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(array, val);
}
for (var i = 0, iM = array.length; i < iM; i++) {
if (array[i] === val) {
return i;
}
}
return -1;
}
function _debugAction(field, action, flag) {
if (!_isDebug) {
return;
}
_debug('Setting ' + action + ' on field:' + field + ' to ' + flag);
}
function _debug() {
if (!_isDebug) {
return;
}
var args = Array.prototype.slice.call(arguments);
args.unshift('(uiPolicyFactory)');
console.log.apply(console.log, args);
}
function _debugTerm(term, result) {
if (!_isDebug) {
return;
}
var or = "";
if (term.or)
or = "  or ";
var userValue;
if (term.field)
userValue = g_form.getValue(term.field) + '';
else
userValue = "(null)";
if (!userValue)
userValue = "<blank>";
var dspValue = "";
if (dspValue)
dspValue = " [" + dspValue + "] ";
if (result)
result = "true";
else
result = "false";
_debug(or + term.field + " " + "(" + userValue + dspValue + ") " + term.oper + " " + term.value + " -> " + result);
}
}
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/uiScriptFactory.js */
(function(exports, undefined) {
'use strict';
exports.uiScriptFactory = {
create: create
};
function create(scripts, $q) {
var uiScripts = {
getUIScript: function(name) {
var script = uiScripts[name];
if (!script) {
console.error('No script registered with name: ' + name);
return;
}
return ($q ? $q : function(fn) {
return new Promise(fn);
})(function(resolve) {
return resolve(script);
});
}
};
if (scripts && scripts.length > 0) {
scripts.forEach(function(script) {
var name = script.name;
var wrapped = createSandboxUIScript(script.name, script.script);
if (wrapped) {
uiScripts[name] = wrapped;
}
})
}
return uiScripts;
}
function createSandboxUIScript(name, script) {
var uiScript = null;
try {
script = sandboxAnonymousFunction(script);
var functionArgs = ['window', 'document'].concat(
'return (function() { return ' + script + '; }).call(this);'
);
var fn = Function.apply({}, functionArgs);
uiScript = fn.call(fn, [null, null])
} catch(e) {
}
if (uiScript !== null && (typeof uiScript !== 'object' && typeof uiScript !== 'function')) {
uiScript = null;
console.warn('UI Script does not return an object or function: ' + name);
}
return uiScript;
}
function sandboxAnonymousFunction(script) {
script = script.trim();
var scriptLength = script.length;
var modified = false;
if (script.substr(-3) === '();') {
script = script.substr(0, scriptLength - 3);
modified = true;
} else if (script.substr(-2) === '()') {
script = script.substr(0, scriptLength -2);
modified = true;
}
if (modified) {
script += '.call(this);';
}
return script;
}
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideFormEnvironmentFactory.js */
(function(exports, $log, undefined) {
'use strict';
var factory = exports.glideFormEnvironmentFactory = {
create: createGlideFormEnvironment,
createWithConfiguration: createWithConfiguration,
defaultExtensionPoints: {
'window': null,
'document': null,
'$': null,
'jQuery': null,
'$$': null,
'$j': null,
'angular': null,
'snmCabrillo': null,
'cabrillo': null,
'NOW': window.NOW || {}
}
};
function createWithConfiguration(g_form, g_user, g_scratchpad, clientScripts, uiPolicies, g_modal, validationScripts, g_ui_scripts) {
if (typeof g_modal === 'undefined') {
}
var g_env = factory.create(g_form, g_scratchpad, g_user, g_modal, g_ui_scripts);
if (clientScripts && clientScripts.messages) {
for (var key in clientScripts.messages) {
}
}
return {
g_env: g_env,
getUserGlideForm: g_env.getUserGlideForm,
initialize: function() {
g_env.initScripts(clientScripts, validationScripts);
if (uiPolicies && (uiPolicies.length > 0)) {
g_env.initUIPolicyScripts(uiPolicies);
}
}
};
};
function createGlideFormEnvironment(g_form, g_scratchpad, g_user, g_modal, g_ui_scripts) {
if (typeof g_user === 'undefined' || !g_user) {
throw 'g_user is required!';
}
if (typeof g_scratchpad === 'undefined' || !g_scratchpad) {
g_scratchpad = {};
}
var _extensionPoints = {
g_scratchpad: extend(g_scratchpad, {}, true),
g_user: typeof g_user.clone === 'function' ? g_user.clone() : g_user
};
if (typeof g_modal !== 'undefined') {
_extensionPoints['g_modal'] = g_modal;
}
if (typeof g_ui_scripts !== 'undefined') {
_extensionPoints['g_ui_scripts'] = g_ui_scripts;
}
var defaults = factory.defaultExtensionPoints;
Object.keys(defaults).forEach(function(name) {
registerExtensionPoint(name, defaults[name]);
});
var _isFormLoading = true;
var _isTemplateLoading = false;
var _onChangeScripts = {};
var _validationScripts = {};
var _onSubmitScripts = [];
return {
initScripts: initScripts,
initUIPolicyScripts: initUIPolicyScripts,
getExtensionPoints: getExtensionPoints,
registerExtensionPoint: registerExtensionPoint,
getUserGlideForm: getUserGlideForm
};
function getUserGlideForm() {
var facade = {};
Object.keys(g_form).forEach(function(key) {
facade[key] = g_form[key];
});
facade.setValue = facade.setUserValue;
return facade;
}
function getOnSubmitGlideForm(g_form) {
var facade = {};
Object.keys(g_form).forEach(function(key) {
facade[key] = g_form[key];
});
facade.save = function() { _logInfo('g_form', 'save', 'is not available'); return false; }
facade.submit = function() { _logInfo('g_form', 'submit', 'is not available'); return false; }
return facade;
}
function initScripts(scriptMap, validationScripts) {
var cs, script;
var onLoadScripts = [];
if (scriptMap.onLoad) {
for (var i = 0; i < scriptMap.onLoad.length; i++) {
try {
cs = scriptMap.onLoad[i];
script = _wrapScript(cs.script, null, 'onLoad');
onLoadScripts.push(_wrapExecuteClientScript(script, g_form, cs.name));
} catch (e) {
_logError('CS:ONLOAD', 'Could not load onLoad Client Script "' + cs.name + '": ' + e);
}
}
}
if (scriptMap.onChange) {
for (var j = 0; j < scriptMap.onChange.length; j++) {
try {
cs = scriptMap.onChange[j];
script = _wrapScript(cs.script, ['control', 'oldValue', 'newValue', 'isLoading', 'isTemplate'], 'onChange');
if (!_onChangeScripts[cs.fieldName]) {
_onChangeScripts[cs.fieldName] = [];
}
_onChangeScripts[cs.fieldName].push(
_wrapExecuteClientScript(script, g_form, cs.name)
);
} catch (e) {
_logError('CS:ONCHANGE', 'Could not load onChange Client Script "' + cs.name + '": ' + e);
}
}
}
if (validationScripts) {
registerExtensionPoint('g_validation_script_field_count', 0);
for (var k = 0; k < validationScripts.length; k++) {
try {
cs = validationScripts[k];
script = _wrapScript(cs.script, ['value', 'fieldName'], 'validate');
var fieldNames = cs.fields;
var wrappedScript = _wrapExecuteClientScript(script, g_form, cs.name);
fieldNames.forEach(function(fieldName) {
if (!_validationScripts[fieldName]) {
_validationScripts[fieldName] = [];
}
_validationScripts[fieldName].push(
wrappedScript
);
});
} catch (e) {
_logError('CS:VALIDATE', 'Could not load Validation Client Script "' + cs.name + '": ' + e);
}
}
}
if (scriptMap.onSubmit) {
for (var k = 0; k < scriptMap.onSubmit.length; k++) {
try {
cs = scriptMap.onSubmit[k];
script = _wrapScript(cs.script, null, 'onSubmit');
_onSubmitScripts.push(
_wrapExecuteClientScript(script, g_form, cs.name, 'onSubmit')
);
} catch (e) {
_logError('CS:ONSUBMIT', 'Could not load onSubmit Client Script "' + cs.name + '": ' + e);
}
}
}
_onLoadForm(onLoadScripts);
}
function initUIPolicyScripts(uiPolicies) {
uiPolicies.forEach(function(uiPolicyMap) {
var scripts = _initUIPolicyMap(uiPolicyMap);
var uiPolicy = uiPolicyFactory.create(g_form, uiPolicyMap, scripts);
});
}
function getExtensionPoints() {
return extend(_extensionPoints, {}, true);
}
function registerExtensionPoint(name, value) {
if (name === 'g_form' || _extensionPoints.hasOwnProperty(name)) {
$log.warn('Overwriting extension point: ' + name);
}
_extensionPoints[name] = value;
}
function _initUIPolicyMap(uiPolicyMap) {
var resultScriptMap = {};
['script_true', 'script_false'].forEach(function(type) {
var policyScript = uiPolicyMap[type];
if (!policyScript) {
return;
}
try {
var wrappedScript = _wrapScript(policyScript.script);
resultScriptMap[policyScript.name] = {
execute: _wrapExecuteClientScript(wrappedScript, g_form, uiPolicyMap.short_description)
};
} catch (e) {
var errType = type.toUpperCase();
_logError('UI:' + errType, 'Could not load UIPolicy script for policy "' + uiPolicyMap.short_description + '"');
}
});
return resultScriptMap;
}
function _onLoadForm(onLoadScripts) {
g_form.$private.options({isInitialized: true});
for (var i = 0, iM = onLoadScripts.length; i < iM; i++) {
onLoadScripts[i].call(null);
}
g_form.$private.events.on('change', _onChangeForm);
g_form.$private.events.on('submit', _onSubmitForm);
var value;
Object.keys(_onChangeScripts).forEach(function(fieldName) {
value = g_form.getValue(fieldName);
_onChangeForm(fieldName, value, value);
});
_isFormLoading = false;
}
function _onChangeForm(fieldName, oldValue, newValue) {
var scripts = _onChangeScripts[fieldName];
if (scripts) {
var scriptVariables = {
control: null,
oldValue: oldValue,
newValue: newValue,
isLoading: !!_isFormLoading,
isTemplate: g_form.$private.fieldState.isTemplateLoading(fieldName)
};
scripts.forEach(function(script) {
script.call(null, scriptVariables);
});
g_form.$private.fieldState.setTemplateLoading(fieldName, false);
}
}
function _onSubmitForm() {
if (!_runValidationScripts()) {
return false;
}
var result;
for (var i = 0, iM = _onSubmitScripts.length; i < iM; i++) {
result = _onSubmitScripts[i].call(null);
if (result === false) {
return result;
}
}
}
function _runValidationScripts() {
var passedValidation = true;
var invalidFieldExists = false;
var fieldNames = Object.keys(_validationScripts);
var totalFieldValidationsRequired = 0;
for (var list = 0, iM = fieldNames.length; list < iM; list++) {
var fieldName = fieldNames[list];
if (!g_form.isReadOnly(fieldName) && g_form.isVisible(fieldName))
totalFieldValidationsRequired++;
}
registerExtensionPoint('g_validation_script_field_count', totalFieldValidationsRequired);
for (var i = 0, iM = fieldNames.length; i < iM; i++) {
var fieldName = fieldNames[i];
if (g_form.isReadOnly(fieldName) || !g_form.isVisible(fieldName)) {
continue;
}
var scripts = _validationScripts[fieldName];
if (scripts.length > 0) {
var scriptVariables = {
value: g_form.getValue(fieldName),
fieldName: fieldName
};
for (var j = 0, jM = scripts.length; j < jM; j++) {
var result = scripts[j].call(null, scriptVariables);
var isString = typeof result === 'string';
if (result === false || isString) {
if (isString) {
g_form.showFieldMsg(fieldName, result, 'error');
g_form.$private.setFieldInvalid(fieldName, true);
if (!invalidFieldExists)
invalidFieldExists = true;
}
passedValidation = false;
}
}
}
}
if (invalidFieldExists)
g_form.$private.showFieldInvalidMsg(g_form);
return passedValidation;
}
function _wrapScript(script, parameters, mainFuncName) {
var scriptParams = parameters || [];
var allParams = scriptParams.slice(0);
allParams = allParams.concat('g_form', Object.keys(getExtensionPoints()));
var fn;
try {
fn = new Function(allParams, 'return (' + script + ')(' + scriptParams.join(',') + ')');
} catch(e) {
if (mainFuncName) {
script = new Function([], script + ' return ' + mainFuncName + '.apply(this, arguments);');
fn = new Function(allParams, 'return (' + script + ')(' + scriptParams.join(',') + ')');
} else
throw e;
}
fn.$inject = allParams;
return fn;
}
function _wrapExecuteClientScript(script, g_form, name, event) {
return function (apiParams) {
return _executeClientScript(script, g_form, name, apiParams, event);
};
}
function _executeClientScript(script, g_form, name, apiParams, event) {
var injectedParams = apiParams || {};
if (typeof injectedParams === 'string') {
_logError('SCRIPT:EXEC', 'Invalid params passed into Client Script "' + name + '"');
return;
}
var baseParams = {
g_form: g_form
};
extend(injectedParams, baseParams);
extend(injectedParams, getExtensionPoints());
if (event === 'onSubmit' && g_form.$private.isValidating === true) {
extend(injectedParams, {
g_form: getOnSubmitGlideForm(injectedParams['g_form'])
})
}
try {
var result = _invoke(script, this, injectedParams);
return result;
} catch (e) {
_logError('SCRIPT:EXEC', 'Error while running Client Script "' + name + '": ' + e);
}
}
function _invoke(fn, self, locals) {
var $inject = fn.$inject;
if (typeof $inject === 'undefined') {
throw 'Missing $inject. Did you try calling externally?';
}
var key;
var args = [];
for (var i = 0, iM = $inject.length; i < iM; i++) {
key = $inject[i];
if (typeof key !== 'string') {
throw 'Invalid injection key provided: ' + key;
}
var arg = locals[key];
if (typeof arg === 'undefined') {
throw 'Injection argument not found (' + key + ')';
}
args.push(arg);
}
return fn.apply(self, args);
}
function extend(defaults, options, newObject) {
var extended = newObject === true ? {} : defaults;
var prop;
for (prop in defaults) {
if (Object.prototype.hasOwnProperty.call(defaults, prop)) {
extended[prop] = defaults[prop];
}
}
for (prop in options) {
if (Object.prototype.hasOwnProperty.call(options, prop)) {
extended[prop] = options[prop];
}
}
return extended;
}
function _logError(code, msg) {
if ($log && $log.error) {
$log.error('(g_env) [' + code + '] ' + msg);
}
}
function _logInfo(obj, prop, msg) {
if($log && $log.info) {
$log.info('(' + obj + ')[' + prop + '] ' + msg);
}
}
}
})(window, console);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideModalFactory.js */
(function(exports, undefined) {
'use strict';
var CONFIRM_BUTTON_TITLE = 'OK';
var CANCEL_BUTTON_TITLE = 'Cancel';
var DEFAULT_BUTTON_TYPE = 'default';
var CONFIRM_BUTTON_TYPE = 'confirm';
var DESTRUCTIVE_BUTTON_TYPE = 'destructive';
exports.glideModalFactory = {
create: create
};
exports.addEventListener('unhandledrejection', function (event) {
event.preventDefault();
});
function create(options, extras) {
options = options || {};
extras = extras || {};
var alertHandler = options.alert || _browserAlertHandler;
var confirmHandler = options.confirm || _browserConfirmHandler;
var confirmDestroyHandler = options.confirmDestroy || _browserConfirmHandler;
var frameHandler = options.showFrame;
var fieldModalHandler = options.showFields;
var customModals = Object.keys(options).filter(function(name){return (['alert','confirm','confirmDestroy','showFields','showFrame'].indexOf(name) == -1); });
var modals = {
alert: function() {
var args = _getArgs(arguments);
var callback = args.callback;
var alertOptions = {
title: args.title || 'Alert',
message: args.message,
buttonTitle: args.style.buttonTitle || _getMessage(CONFIRM_BUTTON_TITLE, extras.messages),
buttonType: args.style.buttonType || DEFAULT_BUTTON_TYPE
};
return alertHandler(alertOptions).then(function() {
if (callback) {
callback();
}
}).catch(function() {
});
},
confirm: function() {
var args = _getArgs(arguments);
var callback = args.callback;
var alertOptions = {
title: args.title || 'Confirm',
message: args.message,
cancelTitle: args.style.cancelTitle || _getMessage(CANCEL_BUTTON_TITLE, extras.messages),
confirmTitle: args.style.confirmTitle || _getMessage(CONFIRM_BUTTON_TITLE, extras.messages),
cancelType: args.style.cancelType || DEFAULT_BUTTON_TYPE,
confirmType: args.style.confirmType || CONFIRM_BUTTON_TYPE
};
return confirmHandler(alertOptions).then(function() {
if (callback) {
callback(true);
}
return Promise.resolve(true);
}).catch(function() {
if (callback) {
callback(false);
}
return Promise.reject(false);
});
},
confirmDestroy: function() {
var args = _getArgs(arguments);
var callback = args.callback;
var alertOptions = {
title: args.title || 'Confirm',
message: args.message,
cancelTitle: args.style.cancelTitle || _getMessage(CANCEL_BUTTON_TITLE, extras.messages),
confirmTitle: args.style.confirmTitle || _getMessage(CONFIRM_BUTTON_TITLE, extras.messages),
cancelType: args.style.cancelType || DEFAULT_BUTTON_TYPE,
confirmType: args.style.confirmType || DESTRUCTIVE_BUTTON_TYPE
};
return confirmDestroyHandler(alertOptions).then(function() {
if (callback) {
callback(true);
}
return Promise.resolve(true);
}).catch(function() {
if (callback) {
callback(false);
}
return Promise.reject(false);
});
},
showFields: function( options ) {
if (!fieldModalHandler) {
return alertHandler({message: 'g_modal.showFields is not supported'});
}
if (!options || typeof(options) !== 'object') {
return Promise.reject(false);
}
var callback = options.callback;
var modalOptions = {
title: options.title || ' ',
fields: options.fields,
size: options.size,
cancelTitle: options.cancelTitle || _getMessage(CANCEL_BUTTON_TITLE, extras.messages),
confirmTitle: options.confirmTitle || _getMessage(CONFIRM_BUTTON_TITLE, extras.messages),
cancelType: options.cancelType || DEFAULT_BUTTON_TYPE,
confirmType: options.confirmType || CONFIRM_BUTTON_TYPE
};
if (options.instruction)
modalOptions.instruction = options.instruction;
return fieldModalHandler(modalOptions).then(function(result) {
if (callback) {
callback(true, result);
}
return Promise.resolve(result);
}).catch(function() {
if (callback) {
callback(false);
}
return Promise.reject(false);
});
},
showFrame: function( options ) {
if (!frameHandler) {
return alertHandler({message: 'g_modal.showFrame is not supported'});
}
if (!options || typeof(options) !== 'object') {
return Promise.reject(false);
}
var callback = options.callback;
var modalOptions = {
title: options.title || ' ',
url: options.url,
size: options.size,
height: options.height,
autoCloseOn: options.autoCloseOn
};
return frameHandler(modalOptions).then(function(result) {
if (callback) {
callback(true, result);
}
return Promise.resolve(result);
}).catch(function(result) {
if (callback) {
callback(false, result);
}
return Promise.reject(result);
});
}
};
customModals.forEach(function(name) {
var customModal = {};
Object.keys(options[name] || {}).forEach(function(fnName){
customModal[fnName] = function(params){
var callback = params.callback;
return options[name][fnName](params).then(function(result) {
if (callback) {
callback(true, result);
}
return Promise.resolve(result);
}).catch(function() {
if (callback) {
callback(false);
}
return Promise.reject(false);
});
}
});
modals[name] = customModal;
});
return modals;
}
function _getArgs(args) {
var title = args[0];
var param = args[1];
var callback = args[2];
var style = args[3];
if (typeof callback === 'object'){
style = callback;
}
switch (typeof param) {
case 'function':
callback = param;
param = title;
title = null;
break;
case 'object':
style = param;
param = title;
title = null;
break;
case 'undefined':
param = title;
title = null;
break;
default:
break;
}
return {
title: title,
message: param,
callback: callback,
style: style || {}
};
}
function _browserAlertHandler(options) {
var message = options.message;
return new Promise(function(resolve) {
alert(message);
if (resolve) {
resolve();
}
});
}
function _browserConfirmHandler(options) {
var message = options.message;
return new Promise(function(resolve, reject) {
if (confirm(message)) {
if (resolve) {
resolve();
}
} else {
if (reject) {
reject();
}
}
});
}
function _getMessage(message, messages) {
if (messages && messages[message])
return messages[message];
return message;
}
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideRequest.js */
(function(exports, undefined) {
'use strict';
var glideRequest = {
getAngularURL: function(path, parameters) {
return 'angular.do?sysparm_type=' + path + (parameters ? encodeURIParameters(parameters) : '');
},
get: function(url, options) {
if (!url) {
throw 'Must specify a URL';
}
var fetchOptions = _applyOptions('get', url, options);
return exports.fetch(fetchOptions.url, fetchOptions);
},
post: function(url, options) {
if (!url) {
throw 'Must specify a URL';
}
var fetchOptions = _applyOptions('post', url, options);
return exports.fetch(fetchOptions.url, fetchOptions);
}
};
function _applyOptions(method, url, options) {
var fetchOptions = {
method: method,
url: url
};
switch (method) {
case 'get':
var url = fetchOptions.url;
if (options && options.data) {
var params = encodeURIParameters(options.data);
if (url.indexOf('?') !== -1) {
url += '&' + params;
} else {
url += '?' + params;
}
}
fetchOptions.url = url;
break;
case 'post':
fetchOptions.body = encodeURIParameters(options.data || {});
break;
}
var dataType = (options || {}).dataType;
switch (dataType) {
default:
case 'json':
fetchOptions.headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-UserToken': window.g_ck
};
break;
case 'xml':
fetchOptions.headers = {
'Accept': 'application/xml',
'Content-Type': 'application/x-www-form-urlencoded',
'X-UserToken': window.g_ck
};
break;
}
return fetchOptions;
}
function encodeURIParameters(parameters) {
var s = [];
for (var parameter in parameters) {
if (parameters.hasOwnProperty(parameter)) {
var key = encodeURIComponent(parameter);
var value = parameters[parameter] ? encodeURIComponent(parameters[parameter]) : '';
s.push(key + "=" + value);
}
}
return s.join('&');
}
exports.glideRequest = glideRequest;
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideAjax.js */
(function(exports, undefined) {
'use strict';
var url = '/xmlhttp.do';
var logError = function() {
if (console && console.error)
console.error.apply(console, arguments);
};
function GlideAjax() {
this.initialize.apply(this, arguments);
}
GlideAjax.glideRequest = exports.glideRequest;
GlideAjax.logError = logError;
GlideAjax.prototype = {
initialize: function(targetProcessor, targetURL) {
this.processor = null;
this.params = {};
this.callbackFn = function() {};
this.errorCallbackFn = function(e) {
GlideAjax.logError('Unhandled exception in GlideAjax.', e.responseText);
};
this.wantAnswer = false;
this.requestObject = null;
this.setProcessor(targetProcessor);
url = targetURL || url;
},
addParam: function(name, value) {
this.params[name] = value;
},
getXML: function(callback) {
this.wantAnswer = false;
this.callbackFn = callback;
this.execute();
},
getXMLWait: function() {
GlideAjax.logError('GlideAjax.getXMLWait is no longer supported');
},
getXMLAnswer: function(callback) {
this.wantAnswer = true;
this.callbackFn = callback;
this.execute();
},
getAnswer: function() {
return this.responseXML ? this.responseXML.documentElement.getAttribute('answer') : null;
},
setErrorCallback: function(errorCallback) {
this.errorCallbackFn = errorCallback;
},
getURL: function() {
return url;
},
getParams: function() {
return this.params;
},
setProcessor: function(p) {
this.addParam('sysparm_processor', p);
if (!p) {
GlideAjax.logError('GlideAjax.initalize: must specify a processor');
}
this.processor = p;
},
execute: function() {
var that = this;
var executeCallBack = function(that, ajaxResponse) {
var args = [
that.wantAnswer ? that.getAnswer() : ajaxResponse
];
try {
that.callbackFn.apply(null, args);
} catch(e) {
if (that.errorCallbackFn) {
that.errorCallbackFn({type: 'unhandled exception', responseText: e.message});
} else
GlideAjax.logError('Unhandled exception in GlideAjax callback.', e);
}
};
GlideAjax.glideRequest.post(url, {
data: this.params,
dataType: 'xml'
})
.then(function(response) {
if (response.responseXML) {
that.responseXML = response.responseXML;
that.responseText = response.responseText;
var ajaxResponse = {
type: response.type,
responseText: response.responseText,
responseXML: response.responseXML
};
executeCallBack(that, ajaxResponse);
}
else {
return response.text().then(
function(data){
try {
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(data,"text/xml");
that.responseXML = xmlDoc;
that.responseText = data;
var ajaxResponse = {
type: 'xml',
responseText: data,
responseXML: xmlDoc
};
executeCallBack(that, ajaxResponse);
} catch(e) {
log("Error while parsing the response " + e.getMessage());
}
}
)
}
})
.catch(function(error) {
var errorResponse = {
type: error.type,
status: error.status,
responseText: error.responseText,
responseXML: error.responseXML
};
if (that.errorCallbackFn) {
that.errorCallbackFn(errorResponse);
}
});
},
setScope: function(scope) {
if (scope) {
this.addParam('sysparm_scope', scope);
}
return this;
}
};
exports.GlideAjax = GlideAjax;
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideRecord.js */
(function(exports, undefined) {
'use strict';
function GlideRecord(table) {
if (!(this instanceof GlideRecord)) {
return new GlideRecord(table);
}
this.initialize.apply(this, arguments);
}
GlideRecord.glideRequest = exports.glideRequest;
var changeValues = [];
GlideRecord.prototype = {
initialized: false,
initialize: function(table) {
this.tableName = table;
this.encodedQuery = '';
this.conditions = [];
this.orderByFields = [];
this.orderByDescFields = [];
this.limit = 0;
this._callback = null;
this.currentRow = -1;
this.recordSet = [];
if (!this.initialized) {
this.ignoreNames = {};
for (var xname in this) {
this.ignoreNames[xname] = true;
}
} else {
for (var xname in this) {
if (this.ignoreNames[xname])
continue;
delete this[xname];
}
}
this.initialized = true;
},
addQuery: function() {
var args = [];
Array.prototype.push.apply(args, arguments);
var name = args.shift(),
oper, value;
oper = args.length == 1 ? "=" : args.shift();
value = args.shift();
this.conditions.push({
'name': name,
'oper': oper,
'value': value
});
},
setEncodedQuery: function(queryString) {
this.encodedQuery = queryString;
},
getEncodedQuery: function() {
var qc = [];
var ec = this.encodedQuery;
if (ec) {
qc.push(ec);
}
for (var i = 0; i < this.conditions.length; i++) {
var q = this.conditions[i];
qc.push(q['name'] + q['oper'] + q['value']);
}
return '^' + qc.join('^');
},
addOrderBy: function(field) {
this.orderByFields.push(field);
},
orderBy: function(field) {
this.addOrderBy(field);
},
orderByDesc: function(field) {
this.orderByDescFields.push(field);
},
setLimit: function(maxRows) {
this.limit = maxRows;
},
getLimit: function() {
return this.limit;
},
get: function() {
if (arguments.length == 1) {
_logWarn('GET:NOCB', 'Get must be called with a callback function');
}
this.initialize(this.tableName);
this.setLimit(1);
var callback;
if (arguments.length == 2) {
this.addQuery('sys_id', arguments[0]);
callback = arguments[1];
} else if (arguments.length == 3) {
this.addQuery(arguments[0], arguments[1]);
callback = arguments[2];
}
if (!callback) {
_logWarn('GET:NOCB', 'Get must be called with a callback function');
return;
}
this.query(this._getResponse.bind(this, callback));
},
_getResponse: function(callback) {
this.next();
callback(this);
},
query: function(callback) {
if (typeof callback !== 'function') {
_logWarn('Q:NOCB', 'Query must be called with a callback function');
return;
}
var glideRequest = GlideRecord.glideRequest;
var src = glideRequest.getAngularURL('gliderecord', {
operation: 'query'
});
glideRequest.post(src, {
dataType: 'json',
data: {
table: this.tableName,
query: this.getEncodedQuery(),
orderBy: this.orderByFields.join(','),
orderByDesc: this.orderByDescFields.join(','),
limit: this.getLimit()
}
}).then(this._queryResponse.bind(this, callback));
},
_queryResponse: function(callback, response) {
this._loadRecordSet(response.data.records);
callback(this);
},
deleteRecord: function(callback) {
if (typeof callback !== 'function') {
_logError('Q:NOCB', 'DeleteRecord must be called with a callback function');
return;
}
var glideRequest = GlideRecord.glideRequest;
var src = glideRequest.getAngularURL('gliderecord', {
operation: 'delete'
});
glideRequest.post(src, {
dataType: 'json',
data: {
table: this.tableName,
query: this.getEncodedQuery(),
sys_id: this.getValue('sys_id')
}
}).then(callback(this));
},
updateRecord: function(callback) {
if (typeof callback !== 'function') {
_logError('Q:NOCB', 'UpdateRecord must be called with a callback function');
return;
}
var glideRequest = GlideRecord.glideRequest;
var src = glideRequest.getAngularURL('gliderecord', {
operation: 'update'
});
glideRequest.post(src, {
dataType: 'json',
data: {
table: this.tableName,
sysid: this.getValue('sysid'),
serializedRecord: changedFields(this)
}
}).then(callback(this));
},
hasNext: function() {
return this.currentRow + 1 < this.recordSet.length;
},
next: function() {
return this._next();
},
_next: function() {
if (!this.hasNext())
return false;
this.loadRow(this.currentRow + 1);
return true;
},
loadRow: function(index) {
var row = this.recordSet[index];
this.currentRow = index;
var currentRow = this.getCurrentRow();
for (var i in currentRow) {
if (!currentRow.hasOwnProperty(i)) {
continue;
}
this[i] = currentRow[i].value;
}
},
_loadRecordSet: function(records) {
this.recordSet = records || [];
},
setValue: function(fieldName, value) {
getChangeValues(fieldName, value);
},
getValue: function(fieldName) {
var current = this.getCurrentRow();
return current ? current[fieldName].value : '';
},
getDisplayValue: function(fieldName) {
var current = this.getCurrentRow();
if (!fieldName) {
return current ? current['$$displayValue'] : '';
}
return current ? current[fieldName].displayvalue : '';
},
getCurrentRow: function() {
return this.recordSet[this.currentRow];
},
getRowCount: function() {
return this.recordSet.length;
},
getTableName: function() {
return this.tableName;
},
toString: function() {
return 'GlideRecord';
}
};
function getChangeValues(fieldName, fieldValue) {
changeValues.push({'fieldName': fieldName, 'value': fieldValue});
}
function changedFields(object) {
for(var fieldName in object) {
if (object.ignoreNames[fieldName])
continue;
if(object.getValue(fieldName) === object[fieldName])
continue;
changeValues.push({'fieldName': fieldName, 'value': object[fieldName]});
}
return changeValues;
}
function _logError(code, msg) {
if (console && console.error) {
console.error('(GlideRecord) [' + code + '] ' + msg);
}
}
function _logWarn(code, msg) {
if (console && console.warn) {
console.warn('(GlideRecord) [' + code + '] ' + msg);
}
}
exports.GlideRecord = GlideRecord;
})(window);
;
/*! RESOURCE: /scripts/sn/common/clientScript/glideUser.js */
(function(exports, undefined) {
'use strict';
var ROLE_MAINT = 'maint';
var ROLE_ADMIN = 'admin';
function GlideUser(fields) {
if (!(this instanceof GlideUser)) {
return new GlideUser(fields);
}
var _firstName = fields.firstName || null;
var _lastName = fields.lastName || null;
var _userName = fields.userName || null;
var _userId = fields.userID || fields.userId || null;
var _roles = fields.roles || null;
var _allRoles = fields.allRoles || null;
var _email = fields.email || null;
var _title = fields.title || null;
var _avatar = fields.avatar || null;
var _clientData = fields.clientData || {};
Object.defineProperties(this, {
firstName: {
get: function() {
return _firstName;
}
},
lastName: {
get: function() {
return _lastName;
}
},
userName: {
get: function() {
return _userName;
}
},
userID: {
get: function() {
return _userId;
}
},
title: {
get: function() {
return _title;
}
},
email: {
get: function() {
return _email;
}
},
avatar: {
get: function() {
return _avatar;
}
}
});
this.getFullName = function() {
return ((_firstName || "") + " " + (_lastName || "")).trim();
};
this.getClientData = function(key) {
return _clientData[key];
};
this.hasRoles = function(includeDefaults) {
if (includeDefaults)
return _allRoles && (_allRoles.length > 0);
else
return _roles && (_roles.length > 0);
};
this.hasRoleExactly = function(role, includeDefaults) {
if (!this.hasRoles(includeDefaults) || !role || (typeof role !== 'string')) {
return false;
}
var normalizedRole = role.toLowerCase();
var rolesToCheck = _roles;
if (includeDefaults)
rolesToCheck = _allRoles;
for (var i = 0, iM = rolesToCheck.length; i < iM; i++) {
if (normalizedRole === rolesToCheck[i].toLowerCase()) {
return true;
}
}
return false;
};
this.hasRole = function(role, includeDefaults) {
if (!this.hasRoles(includeDefaults)) {
return false;
}
if (this.hasRoleExactly(ROLE_MAINT, includeDefaults)) {
return true;
} else if (role === ROLE_MAINT) {
return false;
}
if (this.hasRoleExactly(role, includeDefaults)) {
return true;
}
if (this.hasRoleExactly(ROLE_ADMIN, includeDefaults)) {
return true;
}
return false;
};
this.hasRoleFromList = function(roles, includeDefaults) {
if (!this.hasRoles(includeDefaults)) {
return false;
}
var checkRoles = roles;
if (typeof roles === 'string') {
checkRoles = roles.split(/\s*,\s*/);
}
if (checkRoles.length === 0) {
return true;
}
for (var i = 0, iM = checkRoles.length; i < iM; i++) {
var role = checkRoles[i];
if (role && this.hasRole(role, includeDefaults)) {
return true;
}
}
return false;
};
this.clone = function() {
return new GlideUser(fields);
};
}
exports.GlideUser = GlideUser;
})(window);
;
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/js_includes_angular.js */
/*! RESOURCE: /scripts/sn/common/clientScript/angular/_module.js */
angular.module('sn.common.clientScript', [
'sn.common.i18n',
'sn.common.util'
]);
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideAjaxFactory.js */
angular.module('sn.common.clientScript').factory('glideAjaxFactory', function($window, glideRequest) {
$window.GlideAjax.glideRequest = glideRequest;
return {
create: function(processor) {
return new $window.GlideAjax(processor);
},
getClass: function() {
return $window.GlideAjax;
}
};
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideFormEnvironmentFactory.js */
angular.module('sn.common.clientScript').factory('glideFormEnvironmentFactory', function(
$q,
$window,
$timeout,
glideFormFieldFactory,
glideAjaxFactory,
glideRecordFactory,
i18n,
glideModalFactory,
jQueryRequestShim
) {
'use strict';
var factory = $window.glideFormEnvironmentFactory;
angular.extend(factory.defaultExtensionPoints, {
GlideAjax: glideAjaxFactory.getClass(),
GlideRecord: glideRecordFactory.getClass(),
getMessage: i18n.getMessage,
getMessages: i18n.getMessages,
$: jQueryRequestShim
});
factory.createWithConfiguration = function(g_form, g_user, g_scratchpad, clientScripts, uiPolicies, g_modal, validationScripts, g_ui_scripts) {
if (typeof g_modal === 'undefined') {
g_modal = glideModalFactory.create();
}
var g_env = glideFormEnvironmentFactory.create(g_form, g_scratchpad, g_user, g_modal, g_ui_scripts);
if (clientScripts && clientScripts.messages) {
for (var key in clientScripts.messages) {
i18n.loadMessage(key, clientScripts.messages[key]);
}
}
return {
g_env: g_env,
getUserGlideForm: g_env.getUserGlideForm,
initialize: function() {
g_env.initScripts(clientScripts, validationScripts);
if (uiPolicies && (uiPolicies.length > 0)) {
g_env.initUIPolicyScripts(uiPolicies);
}
}
};
};
var FIELDS_INITIALIZED_INTERVAL = 195;
factory.onFieldsInitialized = function(fields) {
var $fieldsReady = $q.defer();
var $readyTimeout = $timeout(checkFormFields, FIELDS_INITIALIZED_INTERVAL);
function checkFormFields() {
var ready = fields.reduce(function(previous, field) {
return previous && glideFormFieldFactory.isInitialized(field);
}, true);
if (!ready) {
$readyTimeout = $timeout(checkFormFields, FIELDS_INITIALIZED_INTERVAL);
return;
}
$fieldsReady.resolve();
}
return $fieldsReady.promise;
};
return factory;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideFormFactory.js */
angular.module('sn.common.clientScript').factory('glideFormFactory', function($window, glideRecordFactory, glideRequest, glideFormMessageHandler) {
'use strict';
var factory = $window.glideFormFactory;
factory.glideRequest = glideRequest;
var EVENT_CHANGED = 'changed';
var EVENT_PROPERTY_CHANGE = 'propertyChange';
function createAngularGlideForm($scope, tableName, sysId, fields, uiActions, options, relatedLists, sections) {
options = angular.extend({
GlideRecord: glideRecordFactory.getClass(),
uiMessageHandler: glideFormMessageHandler
}, options);
var g_form = factory.create(tableName, sysId, fields, uiActions, options, relatedLists, sections);
g_form.$private.events.on(EVENT_CHANGED, function() {
if (!$scope.$root.$$phase) {
$scope.$apply();
}
});
g_form.$private.events.on(EVENT_PROPERTY_CHANGE, function() {
if (!$scope.$root.$$phase) {
$scope.$applyAsync();
}
});
$scope.$on('$destroy', function() {
g_form.$private.events.cleanup();
});
return g_form;
}
return {
create: createAngularGlideForm
}
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideFormFieldFactory.js */
angular.module('sn.common.clientScript').factory('glideFormFieldFactory', function($window) {
'use strict';
return $window.glideFormFieldFactory;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/catalogVariableHandler.js */
angular.module('sn.common.clientScript').factory('catalogVariableHandler', function($window) {
'use strict';
return $window.catalogVariableHandler;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideFormMessageHandler.js */
angular.module('sn.common.clientScript').factory('glideFormMessageHandler', function($rootScope) {
'use strict';
return function(g_form, type, message) {
switch (type) {
case 'infoMessage':
$rootScope.$emit('snm.ui.sessionNotification', {
type: 'info',
message: message
});
break;
case 'errorMessage':
$rootScope.$emit('snm.ui.sessionNotification', {
type: 'error',
message: message
});
break;
case 'clearMessages':
$rootScope.$emit('snm.ui.sessionNotification', {
type: 'clear'
});
break;
default:
return false;
}
};
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideListFactory.js */
angular.module('sn.common.clientScript').factory('glideListFactory', function() {
'use strict';
if (typeof g_glide_list_separator == "undefined")
var g_glide_list_separator = ", ";
return {
init: init
};
function init(g_form, fields) {
return {
get: function(fieldName) {
return _glideListUtil(fieldName, g_form, fields);
}
};
}
function getField(fieldName, g_form, fields) {
for (var i = 0, iM = fields.length; i < iM; i++) {
var field = fields[i];
if (field.variable_name === fieldName || field.name === fieldName) {
return field;
}
}
if (g_form.$private.options('getMappedField')) {
var mapped = g_form.$private.options('getMappedField')(fieldName);
if (mapped) {
return mapped;
}
}
}
function _glideListUtil(fieldName, g_form, fields) {
var field = getField(fieldName, g_form, fields);
if (!field)
return;
function getItems() {
var items = [];
var values = field.value.split(',');
var displayValues = field.display_value_list;
for (var i=0;i<values.length;i++) {
items.push({value: values[i], display_value: displayValues[i]});
}
return items;
}
function addItem(item, itemDV) {
var v = field.value;
if (v.indexOf(item) > -1)
return;
var dv = field.display_value_list;
v = v == '' ? [] : v.split(',');
if (v.indexOf(item) == -1) {
v.push(item);
dv.push(itemDV);
}
g_form.setValue(fieldName, v.join(','), dv.join(g_glide_list_separator));
}
function removeItem(item) {
var v = field.value;
if (v.indexOf(item) == -1)
return;
var values = field.value.split(',');
var displayValues = field.display_value_list;
for(var i = values.length-1; i>=0; i--) {
if (item == values[i]) {
values.splice(i, 1);
displayValues.splice(i, 1);
break;
}
}
g_form.setValue(field.name, values.join(','), displayValues.join(g_glide_list_separator));
}
function reset() {
field.ed.queryString = '';
}
function setQuery(queryString) {
field.ed.queryString = queryString;
field.ed.queryString.replace("^EQ", "");
}
function setDefaultOperator(operator) {
field.ed.defaultOperator = operator;
}
function getDefaultOperator() {
return field.ed.defaultOperator;
}
return {
addItem: addItem,
removeItem: removeItem,
getItems: getItems,
setQuery: setQuery,
getDefaultOperator: getDefaultOperator,
setDefaultOperator: setDefaultOperator,
queryString: field.ed.queryString,
reset: reset
};
}
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideModalFactory.js */
angular.module('sn.common.clientScript').factory('glideModalFactory', function($q) {
'use strict';
return {
create: create
};
function create(options) {
options = options || {};
var alertHandler = options.alert || _browserAlertHandler;
var confirmHandler = options.confirm || _browserConfirmHandler;
return {
alert: function() {
var args = _getArgs(arguments);
var $d = $q.defer();
if (args.callback) {
$d.promise.then(function() {
args.callback();
});
}
if (alertHandler) {
alertHandler(args.title, args.message, function() {
$d.resolve();
});
} else {
$d.reject();
}
return $d.promise;
},
confirm: function() {
var args = _getArgs(arguments);
var $d = $q.defer();
if (args.callback) {
$d.promise.then(function(result) {
args.callback(result);
});
}
if (confirmHandler) {
confirmHandler(args.title, args.message, function(result) {
$d.resolve(result === true ? true : false);
});
} else {
$d.reject();
}
return $d.promise;
}
};
}
function _getArgs(args) {
var title = args[0];
var message = args[1];
var callback = args[2];
switch (typeof message) {
case 'function':
callback = message;
case 'undefined':
message = title;
title = null;
break;
default:
break;
}
return {
title: title,
message: message,
callback: callback
};
}
function _browserAlertHandler(title, message, done) {
alert(message);
done();
}
function _browserConfirmHandler(title, message, done) {
done(confirm(message));
}
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideRecordFactory.js */
angular.module('sn.common.clientScript').factory('glideRecordFactory', function($window, glideRequest) {
$window.GlideRecord.glideRequest = glideRequest;
return {
create: function(table) {
return new $window.GlideRecord(table);
},
getClass: function() {
return $window.GlideRecord;
}
};
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideRequest.js */
angular.module('sn.common.clientScript').factory('glideRequest', function($q, $log, $http, $window, urlTools, xmlUtil) {
'use strict';
function _sendRequestByType(method, url, options) {
options = options || {};
options.url = url;
options.method = method;
if (!options.headers) {
options.headers = {};
}
var getXml = false;
switch (options.dataType) {
case 'json':
break;
case 'xml':
options.headers['Content-Type'] = 'application/x-www-form-urlencoded';
var data = options.data || {};
options.data = urlTools.encodeURIParameters(data);
getXml = true;
options.responseType = 'text';
if (!options.data) {
options.data = '';
}
options.headers['Accept'] = 'application/xml, text/xml';
break;
default:
}
return $http(options).then(function(response) {
response.type = getXml ? 'xml' : 'json';
response.responseText = response.data;
response.responseXML = getXml ? xmlUtil.xmlToElement(response.data) : null;
return response;
}, function(error) {
error.type = getXml ? 'xml' : 'json';
error.responseText = error.data;
error.responseXML = getXml ? xmlUtil.xmlToElement(error.data) : null;
return $q.reject(error);
});
}
$window.glideRequest = {
getAngularURL: urlTools.getURL,
get: $http.get,
post: function(url, options) {
return _sendRequestByType("post", url, options);
},
put: function(url, options) {
return _sendRequestByType("put", url, options);
}
};
return $window.glideRequest;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/glideUserFactory.js */
angular.module('sn.common.clientScript').factory('glideUserFactory', function($window) {
function getClass() {
return $window.GlideUser;
}
return {
create: function(fields) {
var u = getClass();
return new u(fields);
},
getClass: getClass
};
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/jQueryRequestShim.js */
angular.module('sn.common.clientScript').factory('jQueryRequestShim', function(glideRequest) {
if (angular.isDefined(window.jQuery)) {
return {
get: window.jQuery.get,
post: window.jQuery.post
};
}
var jQueryRequestShim = {
get: function() {
var args = Array.prototype.slice.call(arguments);
return _createJQueryRequest('get', args);
},
post: function() {
var args = Array.prototype.slice.call(arguments);
return _createJQueryRequest('post', args);
}
};
function _createJQueryRequest(type, args) {
var url = args.shift() || '';
var data = args.shift();
var success;
if (typeof data === 'function') {
success = data;
data = null;
} else {
success = args.shift();
}
var dataType = args.shift();
if (!angular.isDefined(dataType)) {
dataType = 'json';
}
var $request;
switch (type) {
case 'get':
$request = glideRequest.get(url);
break;
case 'post':
$request = glideRequest.post(url, {
data: data,
dataType: dataType
});
break;
}
if (success) {
$request = $request.then(function(response) {
success(response.data, response.statusText, response);
});
}
return $request;
}
return jQueryRequestShim;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/uiScriptFactory.js */
angular.module('sn.common.clientScript').factory('uiScriptFactory', function($window) {
return $window.uiScriptFactory;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/uiPolicyFactory.js */
angular.module('sn.common.clientScript').factory('uiPolicyFactory', function($window) {
var factory = $window.uiPolicyFactory;
return factory;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/uiPolicyTypes.js */
angular.module('sn.common.clientScript').factory('uiPolicyTypes', function($window) {
var factory = $window.UI_POLICY_TYPES;
return factory;
});
;
/*! RESOURCE: /scripts/sn/common/clientScript/angular/xmlUtil.js */
angular.module('sn.common.clientScript').factory('xmlUtil', function($log) {
function xmlToElement(xmlText) {
if (typeof DOMParser !== 'undefined') {
try {
var parser = new DOMParser();
return parser.parseFromString(xmlText, 'application/xml');
} catch (e) {
$log.error(e);
return null;
}
} else {
var xml = angular.element(xmlText);
$log.warn('DOMParser is not supported on this browser');
return angular.element(xml[1]);
}
}
function getDataFromXml(text, nodeName) {
var dataSet = [];
var el = angular.element(xmlToElement(text));
if (el && el.length) {
var nodes = angular.isString(nodeName) ? el.find(nodeName) : el.find('xml');
angular.forEach(nodes, function(n) {
if (n.attributes && n.attributes.length) {
var data = {};
angular.forEach(n.attributes, function(attr) {
data[attr.nodeName] = attr.nodeValue;
});
dataSet.push(data);
}
});
}
return dataSet;
}
return {
xmlToElement: xmlToElement,
getDataFromXml: getDataFromXml
};
});
;
;
/*! RESOURCE: /scripts/snm/serviceCatalog/form/snm.serviceCatalog.form.module.js */
angular.module('snm.serviceCatalog.form', [
'sn.common.clientScript',
'sn.common.util'
]);
;
/*! RESOURCE: /scripts/snm/serviceCatalog/form/catalogDataLookup.js */
angular.module('snm.serviceCatalog.form').factory('catalogDataLookup', function($q, $log, $http, urlTools) {
'use strict';
var DEBUG_LOG = false;
return {
initItem: initItem,
initRecord: initRecord
};
function initItem(itemSysId, g_form) {
var url = urlTools.getURL('catalog_data_lookup', {
item: itemSysId
});
return _loadDataLookup(url, itemSysId, g_form);
}
function initRecord(itemSysId, g_form, tableName, recordSysId) {
var url = urlTools.getURL('catalog_form_data_lookup', {
table: tableName,
sys_id: recordSysId
});
return _loadDataLookup(url, itemSysId, g_form);
}
function _loadDataLookup(url, itemSysId, g_form) {
return $http.get(url).then(function(response) {
var data = response.data;
if (!data.catalog_data_lookup) {
return null;
}
if (DEBUG_LOG) {
$log.log('(catalogDataLookup) Loaded:', data);
}
return _createDataLookupEnv(itemSysId, g_form, data.catalog_data_lookup);
});
}
function _createDataLookupEnv(itemSysId, g_form, dataLookups) {
var fieldDataLookups = {};
for (var i = 0, iM = dataLookups.length; i < iM; i++) {
var dld = dataLookups[i];
var fields = dld.fields;
for (var j = 0, jM = fields.length; j < jM; j++) {
var fieldName = fields[j];
if (g_form.hasField(fieldName)) {
var fieldDataLookup = fieldDataLookups[fieldName];
if (!fieldDataLookup) {
fieldDataLookup = fieldDataLookups[fieldName] = {
dlds: []
};
}
fieldDataLookup.dlds.push(dld);
}
}
}
g_form.serviceCatalog = {
activeDataLookupRequests: [],
lastDataLookup: null,
dataLookupDisabled: false,
lastDataLookupField: null
};
var onChange = _wrapChangeHandler(itemSysId, g_form, fieldDataLookups);
g_form.$private.events.on('change', onChange);
return {
created: true
};
}
function _wrapChangeHandler(_itemSysId, _g_form, _fieldDataLookups) {
var itemSysId = _itemSysId;
var g_form = _g_form;
var fieldDataLookups = _fieldDataLookups;
return function _onChangeForm(control, oldValue, newValue, isLoading, isTemplate) {
var dataLookup = fieldDataLookups[control];
if (!dataLookup || !dataLookup.dlds) {
return;
}
if (DEBUG_LOG) {
$log.log('(catalogDataLookup) Found field lookup:', control, dataLookup);
}
var $activeLookups = [];
for (var i = 0, iM = dataLookup.dlds.length; i < iM; i++) {
var $lookup = _runDataLookup(itemSysId, dataLookup.dlds[i], g_form, control);
if ($lookup) {
$activeLookups.push($lookup);
}
}
if ($activeLookups.length == 0) {
return;
}
var $requests = $q.all($activeLookups).finally(function() {
g_form.serviceCatalog.activeDataLookupRequests.pop();
});
g_form.serviceCatalog.activeDataLookupRequests.push($requests)
};
}
function _runDataLookup(itemSysId, dld, g_form, control) {
if (g_form.serviceCatalog.dataLookupDisabled) {
return;
}
var getFieldParams = g_form.$private.options('getFieldParams');
var fieldParams = getFieldParams();
var serialized = urlTools.encodeURIParameters(fieldParams);
if (g_form.serviceCatalog.lastDataLookup === serialized && g_form.serviceCatalog.lastDataLookupField === control) {
return;
}
g_form.serviceCatalog.lastDataLookup = serialized;
g_form.serviceCatalog.lastDataLookupField = control;
var tableName = g_form.getTableName();
if (!tableName) {
tableName = "ni";
}
var sysId = g_form.getSysId();
if (typeof sysId === 'undefined') {
sysId = '';
}
var url = urlTools.getURL('run_catalog_data_lookup');
var getFieldSequence = g_form.$private.options('getFieldSequence');
var requestFields = angular.extend({}, fieldParams, {
sys_target: tableName,
sysparm_id: itemSysId,
data_lookup_sys_id: dld.data_lookup_sys_id,
variable_sequence1: getFieldSequence()
});
return $http({
method: 'POST',
url: url,
data: urlTools.encodeURIParameters(requestFields),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(function(response) {
var data = response.data;
if (!data.fields) {
return;
}
g_form.serviceCatalog.dataLookupDisabled = true;
for (var i = 0; i < data.fields.length; i++) {
var field = data.fields[i];
if (field.label === '' || field.value === '') {
continue;
}
g_form.setValue(field.name, field.value, field.label);
}
g_form.serviceCatalog.dataLookupDisabled = false;
});
}
});
;
/*! RESOURCE: /scripts/snm/serviceCatalog/form/catalogGlideFormFactory.js */
angular.module('snm.serviceCatalog.form').factory('catalogGlideFormFactory', function($q, $log, $http, urlTools, glideFormFactory, catalogDataLookup) {
'use strict';
return {
addVariableEditor: addVariableEditor,
addItemEditor: addItemEditor
};
function addItemEditor(g_form, itemSysId, tableName, sysId, fields) {
var options = _getGlideFormOptions(itemSysId, fields);
g_form.$private.options(options);
catalogDataLookup.initItem(itemSysId, g_form, tableName, sysId);
}
function addVariableEditor(g_form, itemSysId, tableName, sysId, fields) {
var options = _getGlideFormOptions(itemSysId, fields);
g_form.$private.options(options);
catalogDataLookup.initRecord(itemSysId, g_form, tableName, sysId);
}
function _getGlideFormOptions(itemSysId, fields) {
var catalogFields = getCatalogFields(fields);
var options = {
fieldIterator: function(func) {
return catalogFields.forEach(func);
},
getMappedField: function(fieldName) {
return getCatalogField(catalogFields, fieldName);
},
getMappedFieldName: function(fieldName) {
var field = getCatalogField(catalogFields, fieldName);
return field.variable_name || field.catalogFieldName;
},
getFieldParams: function() {
return getFieldParams(catalogFields);
},
getFieldSequence: function() {
return getFieldSequence(catalogFields);
},
itemSysId: itemSysId
};
return options;
}
function getCatalogFields(fields, arr) {
if (!arr) {
arr = [];
}
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
field.catalogFieldName = getCatalogFieldName(field.name, field.sys_id);
arr.push(field);
if (field.fields && field.fields.length > 0) {
getCatalogFields(field.fields, arr);
}
}
return arr;
}
function getCatalogField(fields, fieldName) {
for (var i = 0, iM = fields.length; i < iM; i++) {
if (fields[i].name === fieldName || fields[i].catalogFieldName == fieldName || fields[i].variable_name == fieldName) {
return fields[i];
}
}
return null;
}
function getCatalogFieldName(name, sysId) {
var prefix = 'IO:';
if (name.indexOf('ni.QS') === 0) {
prefix = 'ni.QS';
}
return prefix + sysId;
}
function getFieldParams(fieldList) {
var params = {};
for (var i = 0; i < fieldList.length; i++) {
var field = fieldList[i];
var sysId = field.sys_id;
if (!sysId || sysId.indexOf("gen_") == 0) {
continue;
}
switch (field.catalogType) {
default:
var prefix = field.name.indexOf('ni.QS') === 0 ? 'ni.QS' : 'IO';
params[prefix + ':' + sysId] = field.value;
params['sys_original.' + prefix + ':' + sysId] = field.initial_value;
switch (field.type) {
case 'masked':
if (prefix === 'IO') {
params['ni.nolog.IO:' + sysId] = true
} else {
params['ni.nolog.QS:' + sysId] = true
}
break;
case 'checkbox':
params[prefix + ':' + sysId] = field.value == 'true' ? 'on' : '';
break;
}
break;
case 'quantity':
params[sysId] = field.value;
break;
case 'label':
case 'break':
break;
}
}
return params;
}
function getFieldSequence(fieldList) {
var sequence = [];
for (var i = 0; i < fieldList.length; i++) {
var field = fieldList[i];
if (field.catalogType !== 'quantity') {
if (!field.sys_id || field.sys_id.indexOf("gen_") == 0) {
continue;
}
var result = field.sys_id;
if (result != "") {
sequence.push(result);
}
}
}
return sequence.join(',');
}
});
;
/*! RESOURCE: /scripts/snm/serviceCatalog/data/snm.serviceCatalog.data.shim.js */
angular.module('snm.data', []);
angular.module('snm.serviceCatalog.data', ['snm.data']);
;
/*! RESOURCE: /scripts/snm/data/glideRecordData.js */
angular.module('snm.data').factory('glideRecordData', function(
$log,
$q,
$http
) {
'use strict';
function loadRecord(tableName, sysId, viewName, queryValues) {
var record = new GlideRecordData(tableName, 'sys_id', sysId, viewName, queryValues);
return record.load();
}
function loadRecordByKey(tableName, referenceKey, referenceValue, viewName, queryValues) {
if (typeof referenceKey === 'undefined' || referenceKey == null) {
referenceKey = 'sys_id';
}
var record = new GlideRecordData(tableName, referenceKey, referenceValue, viewName, queryValues);
return record.load();
}
function GlideRecordData(tableName, referenceKey, referenceValue, viewName, queryValues) {
this.tableName = tableName;
this.referenceKey = referenceKey;
this.referenceValue = referenceValue;
this.viewName = viewName;
this.queryValues = typeof queryValues === 'string' ? queryValues : null;
}
var NEW_SYS_ID = '-1';
angular.extend(GlideRecordData.prototype, {
getDisplayTitle: function() {
return this.displayTitle;
},
isNewRecord: function() {
return this.referenceValue === NEW_SYS_ID;
},
getField: function(fieldName, sectionId) {
for (var i = 0, iM = this.fields.length; i < iM; i++) {
if (this.fields[i].name === fieldName) {
if (sectionId) {
if (!this.fields[i].section_id) {
this.fields[i].section_id = sectionId;
return this.fields[i];
}
if (this.fields[i].section_id === sectionId)
return this.fields[i];
} else {
return this.fields[i];
}
}
}
},
showAttachmentButton: function() {
if (!this.tableAttributes) {
return true;
}
return this.tableAttributes['no_attachment'] !== 'true';
},
canViewActivityStream: function() {
return this.showStreamButton === true && !this.isNewRecord();
},
load: function() {
var url = '/api/now/mobile/record/' + this.tableName + '/' + this.referenceValue;
var queryParams = {
sysparm_sys_id: this.referenceValue,
sysparm_reference_key: this.referenceKey,
sysparm_query: this.queryValues,
sysparm_view: this.viewName
};
var record = this;
return $http.get(url, {
params: queryParams
}).then(function(response) {
var result = response.data.result;
record.relatedLists = transformRelatedLists(result.related_lists);
var data = result.record_data;
record.sysId = data.sys_id;
record.displayTitle = data.$$title;
record.tableAttributes = data.table_attributes;
record.viewName = data.view;
record.showStreamButton = data.show_stream_button;
var formFields = [];
data.fields.forEach(function(field) {
switch (field.name) {
case '.end_split':
case '.start_split':
break;
default:
formFields.push(field);
break;
}
});
record.fields = formFields;
record.layout = transformLayout(record, result.layout);
record.variables = null;
if (data.variables && data.variables.length > 0) {
var variables = mapCatalogFieldTypes(data.variables);
variables.forEach(function(variable) {
record.fields.push(variable);
});
record.variables = variables;
}
record.itemSysId = data.itemSysId;
record.label = data.label;
record.encodedRecord = data.encoded_record || '';
record.uiPolicy = data.policy;
record.uiActions = data.actions;
record.clientScripts = data.client_script;
record.g_scratchpad = data.g_scratchpad;
record.validatorScripts = data.validator_script;
record.uiScripts = data.ui_script;
_applyDirtyQueryFields(record);
return record;
});
}
});
function transformRelatedLists(lists) {
lists = lists || [];
angular.forEach(lists, function(list) {
list.visible = true;
});
return lists;
}
function transformLayout(record, layout) {
var sections = [];
angular.forEach(layout, function(layoutSection) {
var count = layoutSection.column_count = layoutSection.columns.length;
var sectionHasFields = false;
if (count > 0) {
var columnSize = count > 0 ? 12 / count : 0;
angular.forEach(layoutSection.columns, function(layoutColumn) {
layoutColumn.classes = 'col-xs-12 col-sm-' + columnSize;
var realFields = [];
angular.forEach(layoutColumn.fields, function(layoutField) {
var realField = record.getField(layoutField.name, layoutSection.id);
if (realField) {
realFields.push(realField);
sectionHasFields = true;
} else {
$log.warn('(FormLayout)', 'Could not find field for layout item: ', layoutField.name);
}
});
layoutColumn.fields = realFields;
});
}
if (sectionHasFields) {
sections.push({
classes: 'row',
columns: layoutSection.columns,
caption: layoutSection.caption,
title: layoutSection.caption,
titleClasses: 'col-xs-12',
visible: layoutSection.visible
});
}
});
return {
sections: sections
};
}
function mapCatalogFieldTypes(fields) {
var mappedFields = [];
fields.forEach(function(field) {
var fieldType = field.type;
field.is_variable = true;
if (field.ref_table && !field.refTable) {
field.refTable = field.ref_table;
}
field.dbType = fieldType;
field.catalogType = fieldType;
if (field.fields) {
field.fields = mapCatalogFieldTypes(field.fields);
}
switch (fieldType) {
case 1:
field.catalogType = 'yesno';
field.type = 'choice';
break;
case 2:
field.catalogType = 'multilinetext';
field.type = 'text_area';
break;
case 3:
field.catalogType = 'multiplechoice';
field.type = 'choice';
break;
case 4:
field.catalogType = 'numericscale';
field.type = 'integer';
break;
case 100:
field.catalogType = 'quantity';
field.type = 'choice';
break;
case 5:
field.catalogType = 'selectbox';
field.type = 'choice';
break;
case 6:
field.catalogType = 'singlelinetext';
field.type = 'string';
break;
case 7:
field.catalogType = 'checkbox';
field.type = 'boolean';
break;
case 8:
field.type = 'reference';
break;
case 9:
field.catalogType = 'date';
field.type = 'glide_date';
break;
case 10:
field.catalogType = 'datetime';
field.type = 'glide_date_time';
break;
case 11:
field.type = 'label';
break;
case 12:
field.type = 'break';
break;
case 0:
field.catalogType = 'block_container';
field.type = 'block_container';
break;
case 99:
field.catalogType = 'checkbox_container';
field.type = 'checkbox_container';
break;
case 14:
field.type = 'macro';
break;
case 15:
field.type = 'uipage';
break;
case 16:
field.catalogType = 'widesinglelinetext';
field.type = 'string';
break;
case 17:
field.type = 'macrowithlabel';
break;
case 18:
field.catalogType = 'lookupselectbox';
field.type = 'choice';
break;
case 19:
field.type = 'containerstart';
break;
case 20:
field.type = 'containerend';
break;
case 21:
field.type = 'listcollector';
break;
case 22:
field.catalogType = 'lookupmultiplechoice';
field.type = 'choice';
break;
case 23:
field.type = 'html';
break;
case 24:
field.catalogType = 'containersplit';
field.type = 'split';
return;
break;
case 25:
field.type = 'masked';
break;
default:
$log.warn('Unknown field type:', fieldType);
}
mappedFields.push(field);
});
return mappedFields;
}
function _parseQueryFields(queryFields) {
var splitFields = queryFields.split('^');
var fields = {};
splitFields.forEach(function(fieldPair) {
var field = fieldPair.split('=', 2);
fields[field[0]] = field[1];
});
return fields;
}
function _applyDirtyQueryFields(record) {
if (record.isNewRecord() && record.queryValues) {
var queryFields = _parseQueryFields(record.queryValues);
record.fields.forEach(function(field) {
field.dirtyQueryField = false;
var fieldValue = queryFields[field.name];
if (typeof fieldValue !== 'undefined') {
field.dirtyQueryField = true;
}
});
}
}
return {
NEW_SYS_ID: NEW_SYS_ID,
loadRecord: loadRecord,
loadRecordByKey: loadRecordByKey,
mapCatalogFieldTypes: mapCatalogFieldTypes
};
});
;
/*! RESOURCE: /scripts/snm/serviceCatalog/data/catalogItemFactory.js */
angular.module('snm.serviceCatalog.data').factory('catalogItemFactory', function(
$q,
$log,
$http,
glideRecordData,
urlTools
) {
'use strict';
var DEBUG_LOG = false;
var TYPE_ITEM = 'item';
var TYPE_PRODUCER = 'producer';
function loadItem(categorySysId, itemSysId, type) {
switch (type) {
case TYPE_ITEM:
case TYPE_PRODUCER:
break;
default:
type = TYPE_ITEM;
}
var url = urlTools.getURL('catalog_item', {
type: type,
sys_id: itemSysId,
category_sys_id: categorySysId
});
return $http.get(url).then(function(response) {
var data = response.data;
if (DEBUG_LOG) {
$log.log('(catalogItemFactory) loadItem', data);
}
if (!angular.isDefined(data.sys_id)) {
return $q.reject('Item not found');
}
return createCatalogItem(response.data, type);
});
}
function loadProducer(categorySysId, itemSysId) {
return loadItem(categorySysId, itemSysId, TYPE_PRODUCER).then(function(item) {
angular.extend(item, {
recordParams: {
tableName: item.table,
sysId: item.sysparm_item_guid
}
});
return item;
});
}
function createCatalogItem(data, itemType, viewLayout) {
if (!data.type) {
data.type = itemType;
}
if (data.fields) {
data.fields = glideRecordData.mapCatalogFieldTypes(data.fields);
}
if (data.item_sys_id) {
data.sysId = data.item_sys_id;
data.cartItemSysId = data.sys_id;
} else {
data.sysId = data.sys_id;
}
if (data.category_sys_id) {
data.categorySysId = data.category_sys_id;
}
var hasPicture = true;
var pictureUrl = null;
if (angular.isDefined(data.picture) && data.picture !== null) {
if (data.picture === '') {
hasPicture = false;
} else if (data.picture !== 'sc_placeholder_image.png') {
pictureUrl = '/' + data.picture;
}
}
data.hasPicture = hasPicture;
data.pictureUrl = pictureUrl;
angular.extend(data, {
getTitle: function() {
if (typeof data.displayValue === 'undefined') {
return data.name;
}
return data.name;
},
getDescription: function() {
if (data.getTitle() == data.short_description) {
return '';
}
return data.short_description;
},
getCategoryTitle: function() {
var total = data.breadcrumbs.length;
return data.breadcrumbs[total-2].displayValue;
},
getPrice: function() {
return data.price_raw ? data.price_raw : parseFloat(data.price.replace(/\$|,/g, ''));
},
getRecurringPrice: function() {
return data.recurring_price_raw ? data.recurring_price_raw : parseFloat(data.recurring_price.replace(/\$|,/g, ''));
},
hasDescription: function() {
if (viewLayout && !viewLayout.sc_descriptions) {
return false;
}
return true;
},
hasQuantity: function() {
if (viewLayout && !viewLayout.sc_quantity) {
return false;
}
return !data.no_quantity ? data.quantity > 1 : false;
},
hasPrice: function() {
if (viewLayout && !viewLayout.sc_price) {
return false;
}
return data.price !== -1;
},
hasRecurring: function() {
if (viewLayout && !viewLayout.sc_recurring_price) {
return false;
}
return data.recurring_price !== -1;
}
});
return data;
}
function loadItemScripts(itemSysId) {
return $q.all([loadItemUiPolicy(itemSysId), loadItemClientScripts(itemSysId)]).then(function(results) {
return {
uiPolicy: results[0],
clientScripts: results[1]
};
});
}
function loadItemUiPolicy(itemSysId) {
var url = urlTools.getURL('catalog_ui_policy', {
item: itemSysId
});
return $http.get(url).then(function(response) {
var data = response.data;
if (DEBUG_LOG) {
$log.log('(catalogItemFactory) loadItemUiPolicy', data);
}
return data.policy || [];
});
}
function loadItemClientScripts(itemSysId) {
var url = urlTools.getURL('catalog_client_script', {
item: itemSysId
});
return $http.get(url).then(function(response) {
var data = response.data;
if (DEBUG_LOG) {
$log.log('(catalogItemFactory) loadItemClientScripts', data);
}
return data;
});
}
function executeProducerSubmit(itemSysId, itemGuid, fieldParams, fieldSequence) {
var requestFields = angular.extend({}, fieldParams, {
type: 'produce_record',
sysparm_action: 'execute_producer',
sysparm_item_guid: itemGuid,
sysparm_id: itemSysId,
variable_sequence: fieldSequence,
sysparm_uitype: 'classic_mobile'
});
var url = urlTools.getURL('catalog_item');
return $http({
method: 'post',
url: url,
data: urlTools.encodeURIParameters(requestFields),
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=iso-8859-1'
}
}).then(function(response) {
if (DEBUG_LOG) {
$log.log('(catalogItemFactory) producerSubmit', data);
}
var data = response.data;
return data;
});
}
return {
TYPE_ITEM: TYPE_ITEM,
TYPE_PRODUCER: TYPE_PRODUCER,
loadItem: loadItem,
loadProducer: loadProducer,
loadItemScripts: loadItemScripts,
executeProducerSubmit: executeProducerSubmit,
create: createCatalogItem
};
});
;
/*! RESOURCE: /scripts/doctype/attachments_util.js */
var ATTACHMENT_SIZE_ERROR = 1;
var EXTENSION_ERROR = 2;
var SUCCESS = 3;
var MB_TO_BYTES = 1048576;
function validateAttachmentVariable(file, field) {
if (field.allowedFileSize) {
var attrMaxSize = parseInt(field.allowedFileSize);
var allowedSizeInBytes = attrMaxSize * MB_TO_BYTES;
if (file.size > allowedSizeInBytes) {
return ATTACHMENT_SIZE_ERROR;
}
}
if (field.allowedExtensions && field.allowedExtensions.length) {
var dot = file.name.lastIndexOf('.') + 1;
var suffix = file.name.substring(dot).toLowerCase();
for (var i = 0; i < field.allowedExtensions.length; i++) {
if (suffix === field.allowedExtensions[i].toLowerCase())
return SUCCESS;
}
return EXTENSION_ERROR;
}
return SUCCESS;
}
;
/*! RESOURCE: /scripts/table_variable_util.js */
function getDuplicateFields(uniqueColumnNames, parentGridData,
existingRowData, currentRowData) {
var uniqueColumnData = new Map();
var duplicateUniqueFields = new Set();
var isExecutedFromScript = true;
var duplicateUniqueFieldsArray = [];
if (currentRowData)
isExecutedFromScript = false;
for ( var name in uniqueColumnNames) {
uniqueColumnData.set(name, new Map());
}
if (existingRowData && Object.keys(existingRowData).length > 0) {
for ( var columnName in uniqueColumnNames) {
var currentColumnData = currentRowData[columnName];
var existingColumnData = existingRowData[columnName];
if (currentColumnData && existingColumnData
&& currentColumnData.toLowerCase() === existingColumnData.toLowerCase()) {
delete uniqueColumnNames[columnName];
}
}
}
if (Object.keys(uniqueColumnNames).length > 0) {
if (Array.isArray(parentGridData) && parentGridData.length > 0) {
for (var i = 0; i < parentGridData.length; i++) {
var row = parentGridData[i];
if (row !== null && typeof row === 'object') {
for ( var uniqueColumnName in uniqueColumnNames) {
var columnValue = row[uniqueColumnName];
if (columnValue) {
columnValue = columnValue.toLowerCase();
if (!uniqueColumnData.get(uniqueColumnName).has(columnValue))
uniqueColumnData.get(uniqueColumnName).set(columnValue, true);
else
if (isExecutedFromScript)
duplicateUniqueFields.add(uniqueColumnNames[uniqueColumnName]);
}
}
}
}
}
if (!isExecutedFromScript){
for (var uniqueColumnName in uniqueColumnNames) {
var currentColumnData = currentRowData[uniqueColumnName];
if (currentColumnData && uniqueColumnData.get(uniqueColumnName).has(currentColumnData.toLowerCase()))
duplicateUniqueFields.add(uniqueColumnNames[uniqueColumnName])
}
}
}
if (duplicateUniqueFields) {
duplicateUniqueFields.forEach(function(element) {
duplicateUniqueFieldsArray.push(element)
});
}
return duplicateUniqueFieldsArray;
}
if (typeof Object.assign !== 'function') {
Object.defineProperty(Object, "assign", {
value : function assign(target, varArgs) {
'use strict';
if (target === null || target === undefined) {
throw new TypeError(
'Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource !== null && nextSource !== undefined) {
for ( var nextKey in nextSource) {
if (Object.prototype.hasOwnProperty.call(nextSource,
nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable : true,
configurable : true
});
}
;
/*! RESOURCE: /scripts/angular-ui-tinymce.js */
angular.module('ui.tinymce', [])
.value('uiTinymceConfig', {})
.directive('uiTinymce', ['$rootScope', '$compile', '$timeout', '$window', '$sce', 'uiTinymceConfig', function($rootScope, $compile, $timeout, $window, $sce, uiTinymceConfig) {
uiTinymceConfig = uiTinymceConfig || {};
var ID_ATTR = 'ui-tinymce';
if (uiTinymceConfig.baseUrl) {
tinymce.baseURL = uiTinymceConfig.baseUrl;
}
return {
require: ['ngModel', '^?form'],
priority: 599,
link: function(scope, element, attrs, ctrls) {
if (!$window.tinymce) {
return;
}
var ngModel = ctrls[0],
form = ctrls[1] || null;
var expression, options = {
debounce: true
}, tinyInstance,
updateView = function(editor) {
var content = editor.getContent({format: options.format}).trim();
content = $sce.trustAsHtml(content);
ngModel.$setViewValue(content);
if (!$rootScope.$$phase) {
scope.$digest();
}
};
function toggleDisable(disabled) {
if (disabled) {
ensureInstance();
if (tinyInstance && tinyInstance.getBody()) {
tinyInstance.getBody().setAttribute('contenteditable', false);
}
} else {
ensureInstance();
if (tinyInstance && !tinyInstance.settings.readonly && tinyInstance.getDoc()) {
tinyInstance.getBody().setAttribute('contenteditable', true);
}
}
}
if (!attrs.id)
attrs.$set('id', ID_ATTR + '-' + (new Date().valueOf()));
expression = {};
angular.extend(expression, scope.$eval(attrs.uiTinymce));
var debouncedUpdate = (function(debouncedUpdateDelay) {
var debouncedUpdateTimer;
return function(ed) {
$timeout.cancel(debouncedUpdateTimer);
debouncedUpdateTimer = $timeout(function() {
return (function(ed) {
if (ed.isDirty()) {
ed.save();
updateView(ed);
}
})(ed);
}, debouncedUpdateDelay);
};
})(400);
var setupOptions = {
setup: function(ed) {
ed.on('init', function() {
ngModel.$render();
ngModel.$setPristine();
ngModel.$setUntouched();
if (form) {
form.$setPristine();
}
});
ed.on('ExecCommand change NodeChange ObjectResized', function() {
if (!options.debounce) {
ed.save();
updateView(ed);
return;
}
debouncedUpdate(ed);
});
ed.on('blur', function() {
element[0].blur();
ngModel.$setTouched();
if (!$rootScope.$$phase) {
scope.$digest();
}
});
ed.on('remove', function() {
element.remove();
});
if (uiTinymceConfig.setup) {
uiTinymceConfig.setup(ed, {
updateView: updateView
});
}
if (expression.setup) {
expression.setup(ed, {
updateView: updateView
});
}
},
format: expression.format || 'html',
selector: '#' + attrs.id
};
angular.extend(options, uiTinymceConfig, expression, setupOptions);
$timeout(function() {
if (options.baseURL){
tinymce.baseURL = options.baseURL;
}
var maybeInitPromise = tinymce.init(options);
if(maybeInitPromise && typeof maybeInitPromise.then === 'function') {
maybeInitPromise.then(function() {
toggleDisable(scope.$eval(attrs.ngDisabled));
});
} else {
toggleDisable(scope.$eval(attrs.ngDisabled));
}
});
ngModel.$formatters.unshift(function(modelValue) {
return modelValue ? $sce.trustAsHtml(modelValue) : '';
});
ngModel.$parsers.unshift(function(viewValue) {
return viewValue ? $sce.getTrustedHtml(viewValue) : '';
});
ngModel.$render = function() {
ensureInstance();
var viewValue = ngModel.$viewValue ?
$sce.getTrustedHtml(ngModel.$viewValue) : '';
if (tinyInstance &&
tinyInstance.getDoc()
) {
tinyInstance.setContent(viewValue);
tinyInstance.fire('change');
}
};
attrs.$observe('disabled', toggleDisable);
scope.$on('$tinymce:refresh', function(e, id) {
var eid = attrs.id;
if (angular.isUndefined(id) || id === eid) {
var parentElement = element.parent();
var clonedElement = element.clone();
clonedElement.removeAttr('id');
clonedElement.removeAttr('style');
clonedElement.removeAttr('aria-hidden');
tinymce.execCommand('mceRemoveEditor', false, eid);
parentElement.append($compile(clonedElement)(scope));
}
});
scope.$on('$destroy', function() {
ensureInstance();
if (tinyInstance) {
tinyInstance.remove();
tinyInstance = null;
}
});
function ensureInstance() {
if (!tinyInstance) {
tinyInstance = tinymce.get(attrs.id);
}
}
}
};
}]);
;
/*! RESOURCE: /scripts/sp-tinymce/decorator.uiTinymce.js */
angular.module('ui.tinymce').decorator('uiTinymceDirective', function($delegate, tinymceService) {
tinymceService.loadTinymceSync();
tinyMCE.baseURL = "/scripts/sp-tinymce";
tinyMCE.suffix = '.min';
$delegate[0].priority = 10;
return $delegate;
});
;
/*! RESOURCE: /scripts/prism/prism.js */
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==n)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a,r){r=r||{};for(var l in e)e.hasOwnProperty(l)&&(n.call(e,l,e[l],a||l),"Object"!==t.util.type(e[l])||r[e[l]]?"Array"!==t.util.type(e[l])||r[e[l]]||(r[e[l]]=!0,t.languages.DFS(e[l],n,l,r)):(r[e[l]]=!0,t.languages.DFS(e[l],n,null,r)))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),l=0;a=r[l++];)t.highlightElement(a,e===!0,n)},highlightElement:function(n,a,r){for(var l,i,o=n;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1],i=t.languages[l]),n.className=n.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=n.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=n.textContent,u={element:n,language:l,grammar:i,code:s};if(!s||!i)return t.hooks.run("complete",u),void 0;if(t.hooks.run("before-highlight",u),a&&_self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(n),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},highlight:function(e,a,r){var l=t.tokenize(e,a);return n.stringify(t.util.encode(l),r)},tokenize:function(e,n){var a=t.Token,r=[e],l=n.rest;if(l){for(var i in l)n[i]=l[i];delete n.rest}e:for(var i in n)if(n.hasOwnProperty(i)&&n[i]){var o=n[i];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],c=u.inside,g=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){g&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),P=[p,1];b&&P.push(b);var A=new a(i,c?t.tokenize(m,c):m,h);P.push(A),w&&P.push(w),Array.prototype.splice.apply(r,P)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var l={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}t.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,l=n.immediateClose;_self.postMessage(t.highlight(r,t.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
!function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var n={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:n}},{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:n}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:n}}]}(Prism);
Prism.languages.java=Prism.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}});
Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),Prism.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),Prism.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(e){"php"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(a){return e.tokenStack.push(a),"{{{PHP"+e.tokenStack.length+"}}}"}))}),Prism.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),Prism.hooks.add("after-highlight",function(e){if("php"===e.language){for(var a,n=0;a=e.tokenStack[n];n++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(n+1)+"}}}",Prism.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),Prism.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'<span class="token php">$1</span>'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/}));
Prism.languages.python={"triple-quoted-string":{pattern:/"""[\s\S]+?"""|'''[\s\S]+?'''/,alias:"string"},comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/};
;
/*! RESOURCE: /scripts/sp-tinymce/service.tinymce.js */
angular.module('ui.tinymce').factory('tinymceService', function($http) {
'use strict';
function cachedScript (url, options) {
options = $.extend( options || {}, {
dataType: "script",
cache: true,
url: url
});
return $.ajax( options );
};
function loadTinyMCE (options) {
options = options || {};
if (!window.hasOwnProperty('tinyMCE')) {
cachedScript('scripts/js_includes_sp_tinymce.js?v=' + g_builddate, options);
}
}
return {
loadTinymceAsync: loadTinyMCE,
loadTinymceSync: function () {
loadTinyMCE({ async: false });
}
}
});
;
/*! RESOURCE: /scripts/libs/autosize/autosize-3.0.17.min.js */
/*!
	Autosize 3.0.17
	license: MIT
	http://www.jacklmoore.com/autosize
*/
!function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),l="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(l)&&(l=0),a()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t,r()}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){var t=e.style.height,n=o(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="auto";var i=e.scrollHeight+l;return 0===e.scrollHeight?void(e.style.height=t):(e.style.height=i+"px",s=e.clientWidth,n.forEach(function(e){e.node.scrollTop=e.scrollTop}),void(r&&(document.documentElement.scrollTop=r)))}function a(){r();var t=window.getComputedStyle(e,null),o=Math.round(parseFloat(t.height)),i=Math.round(parseFloat(e.style.height));if(o!==i?"visible"!==t.overflowY&&n("visible"):"hidden"!==t.overflowY&&n("hidden"),u!==o){u=o;var a=d("autosize:resized");e.dispatchEvent(a)}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var l=null,s=e.clientWidth,u=null,c=function(){e.clientWidth!==s&&a()},p=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",a,!1),e.removeEventListener("keyup",a,!1),e.removeEventListener("autosize:destroy",p,!1),e.removeEventListener("autosize:update",a,!1),i["delete"](e),Object.keys(t).forEach(function(n){e.style[n]=t[n]})}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",p,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",a,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",a,!1),e.addEventListener("autosize:update",a,!1),i.add(e),e.style.overflowX="hidden",e.style.wordWrap="break-word",t()}}function o(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=d("autosize:destroy");e.dispatchEvent(t)}}function r(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName){var t=d("autosize:update");e.dispatchEvent(t)}}var i="function"==typeof Set?new Set:function(){var e=[];return{has:function(t){return Boolean(e.indexOf(t)>-1)},add:function(t){e.push(t)},"delete":function(t){e.splice(e.indexOf(t),1)}}}(),d=function(e){return new Event(e)};try{new Event("test")}catch(a){d=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(l=function(e){return e},l.destroy=function(e){return e},l.update=function(e){return e}):(l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},l.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.exports=l});
/*! RESOURCE: /scripts/sn-signals-js.min.js */
!function(t){var n={};function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)r.d(e,i,function(n){return t[n]}.bind(null,i));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=1)}([function(t,n,r){window,t.exports=function(t){var n={};function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)r.d(e,i,function(n){return t[n]}.bind(null,i));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=121)}([function(t,n,r){var e=r(1),i=r(7),o=r(14),u=r(11),c=r(17),a=function(t,n,r){var f,s,l,h,p=t&a.F,v=t&a.G,d=t&a.S,y=t&a.P,g=t&a.B,x=v?e:d?e[n]||(e[n]={}):(e[n]||{}).prototype,b=v?i:i[n]||(i[n]={}),m=b.prototype||(b.prototype={});for(f in v&&(r=n),r)l=((s=!p&&x&&void 0!==x[f])?x:r)[f],h=g&&s?c(l,e):y&&"function"==typeof l?c(Function.call,l):l,x&&u(x,f,l,t&a.U),b[f]!=l&&o(b,f,h),y&&m[f]!=l&&(m[f]=l)};e.core=i,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(4);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){var e=r(48)("wks"),i=r(29),o=r(1).Symbol,u="function"==typeof o;(t.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},function(t,n,r){var e=r(19),i=Math.min;t.exports=function(t){return t>0?i(e(t),9007199254740991):0}},function(t,n){var r=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=r)},function(t,n,r){t.exports=!r(2)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,n,r){var e=r(3),i=r(88),o=r(26),u=Object.defineProperty;n.f=r(8)?Object.defineProperty:function(t,n,r){if(e(t),n=o(n,!0),e(r),i)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(24);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(1),i=r(14),o=r(13),u=r(29)("src"),c=r(126),a=(""+c).split("toString");r(7).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var f="function"==typeof r;f&&(o(r,"name")||i(r,"name",n)),t[n]!==r&&(f&&(o(r,u)||i(r,u,t[n]?""+t[n]:a.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:i(t,n,r):(delete t[n],i(t,n,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[u]||c.call(this)}))},function(t,n,r){var e=r(0),i=r(2),o=r(24),u=/"/g,c=function(t,n,r,e){var i=String(o(t)),c="<"+n;return""!==r&&(c+=" "+r+'="'+String(e).replace(u,"&quot;")+'"'),c+">"+i+"</"+n+">"};t.exports=function(t,n){var r={};r[t]=n(c),e(e.P+e.F*i((function(){var n=""[t]('"');return n!==n.toLowerCase()||n.split('"').length>3})),"String",r)}},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(9),i=r(28);t.exports=r(8)?function(t,n,r){return e.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(44),i=r(24);t.exports=function(t){return e(i(t))}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t,n){return!!t&&e((function(){n?t.call(null,(function(){}),1):t.call(null)}))}},function(t,n,r){var e=r(18);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,i){return t.call(n,r,e,i)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(45),i=r(28),o=r(15),u=r(26),c=r(13),a=r(88),f=Object.getOwnPropertyDescriptor;n.f=r(8)?f:function(t,n){if(t=o(t),n=u(n,!0),a)try{return f(t,n)}catch(t){}if(c(t,n))return i(!e.f.call(t,n),t[n])}},function(t,n,r){var e=r(0),i=r(7),o=r(2);t.exports=function(t,n){var r=(i.Object||{})[t]||Object[t],u={};u[t]=n(r),e(e.S+e.F*o((function(){r(1)})),"Object",u)}},function(t,n,r){var e=r(17),i=r(44),o=r(10),u=r(6),c=r(104);t.exports=function(t,n){var r=1==t,a=2==t,f=3==t,s=4==t,l=6==t,h=5==t||l,p=n||c;return function(n,c,v){for(var d,y,g=o(n),x=i(g),b=e(c,v,3),m=u(x.length),w=0,S=r?p(n,m):a?p(n,0):void 0;m>w;w++)if((h||w in x)&&(y=b(d=x[w],w,g),t))if(r)S[w]=y;else if(y)switch(t){case 3:return!0;case 5:return d;case 6:return w;case 2:S.push(d)}else if(s)return!1;return l?-1:f||s?s:S}}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on  "+t);return t}},function(t,n,r){"use strict";if(r(8)){var e=r(30),i=r(1),o=r(2),u=r(0),c=r(59),a=r(84),f=r(17),s=r(42),l=r(28),h=r(14),p=r(43),v=r(19),d=r(6),y=r(115),g=r(32),x=r(26),b=r(13),m=r(46),w=r(4),S=r(10),_=r(76),O=r(33),E=r(35),P=r(34).f,F=r(78),M=r(29),j=r(5),A=r(22),I=r(49),N=r(47),T=r(80),R=r(40),L=r(52),k=r(41),C=r(79),W=r(106),D=r(9),G=r(20),U=D.f,B=G.f,V=i.RangeError,q=i.TypeError,z=i.Uint8Array,H=Array.prototype,Y=a.ArrayBuffer,X=a.DataView,J=A(0),$=A(2),K=A(3),Z=A(4),Q=A(5),tt=A(6),nt=I(!0),rt=I(!1),et=T.values,it=T.keys,ot=T.entries,ut=H.lastIndexOf,ct=H.reduce,at=H.reduceRight,ft=H.join,st=H.sort,lt=H.slice,ht=H.toString,pt=H.toLocaleString,vt=j("iterator"),dt=j("toStringTag"),yt=M("typed_constructor"),gt=M("def_constructor"),xt=c.CONSTR,bt=c.TYPED,mt=c.VIEW,wt=A(1,(function(t,n){return Pt(N(t,t[gt]),n)})),St=o((function(){return 1===new z(new Uint16Array([1]).buffer)[0]})),_t=!!z&&!!z.prototype.set&&o((function(){new z(1).set({})})),Ot=function(t,n){var r=v(t);if(r<0||r%n)throw V("Wrong offset!");return r},Et=function(t){if(w(t)&&bt in t)return t;throw q(t+" is not a typed array!")},Pt=function(t,n){if(!(w(t)&&yt in t))throw q("It is not a typed array constructor!");return new t(n)},Ft=function(t,n){return Mt(N(t,t[gt]),n)},Mt=function(t,n){for(var r=0,e=n.length,i=Pt(t,e);e>r;)i[r]=n[r++];return i},jt=function(t,n,r){U(t,n,{get:function(){return this._d[r]}})},At=function(t){var n,r,e,i,o,u,c=S(t),a=arguments.length,s=a>1?arguments[1]:void 0,l=void 0!==s,h=F(c);if(null!=h&&!_(h)){for(u=h.call(c),e=[],n=0;!(o=u.next()).done;n++)e.push(o.value);c=e}for(l&&a>2&&(s=f(s,arguments[2],2)),n=0,r=d(c.length),i=Pt(this,r);r>n;n++)i[n]=l?s(c[n],n):c[n];return i},It=function(){for(var t=0,n=arguments.length,r=Pt(this,n);n>t;)r[t]=arguments[t++];return r},Nt=!!z&&o((function(){pt.call(new z(1))})),Tt=function(){return pt.apply(Nt?lt.call(Et(this)):Et(this),arguments)},Rt={copyWithin:function(t,n){return W.call(Et(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return Z(Et(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return C.apply(Et(this),arguments)},filter:function(t){return Ft(this,$(Et(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Q(Et(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(Et(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){J(Et(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return rt(Et(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return nt(Et(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ft.apply(Et(this),arguments)},lastIndexOf:function(t){return ut.apply(Et(this),arguments)},map:function(t){return wt(Et(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ct.apply(Et(this),arguments)},reduceRight:function(t){return at.apply(Et(this),arguments)},reverse:function(){for(var t,n=Et(this).length,r=Math.floor(n/2),e=0;e<r;)t=this[e],this[e++]=this[--n],this[n]=t;return this},some:function(t){return K(Et(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return st.call(Et(this),t)},subarray:function(t,n){var r=Et(this),e=r.length,i=g(t,e);return new(N(r,r[gt]))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,d((void 0===n?e:g(n,e))-i))}},Lt=function(t,n){return Ft(this,lt.call(Et(this),t,n))},kt=function(t){Et(this);var n=Ot(arguments[1],1),r=this.length,e=S(t),i=d(e.length),o=0;if(i+n>r)throw V("Wrong length!");for(;o<i;)this[n+o]=e[o++]},Ct={entries:function(){return ot.call(Et(this))},keys:function(){return it.call(Et(this))},values:function(){return et.call(Et(this))}},Wt=function(t,n){return w(t)&&t[bt]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},Dt=function(t,n){return Wt(t,n=x(n,!0))?l(2,t[n]):B(t,n)},Gt=function(t,n,r){return!(Wt(t,n=x(n,!0))&&w(r)&&b(r,"value"))||b(r,"get")||b(r,"set")||r.configurable||b(r,"writable")&&!r.writable||b(r,"enumerable")&&!r.enumerable?U(t,n,r):(t[n]=r.value,t)};xt||(G.f=Dt,D.f=Gt),u(u.S+u.F*!xt,"Object",{getOwnPropertyDescriptor:Dt,defineProperty:Gt}),o((function(){ht.call({})}))&&(ht=pt=function(){return ft.call(this)});var Ut=p({},Rt);p(Ut,Ct),h(Ut,vt,Ct.values),p(Ut,{slice:Lt,set:kt,constructor:function(){},toString:ht,toLocaleString:Tt}),jt(Ut,"buffer","b"),jt(Ut,"byteOffset","o"),jt(Ut,"byteLength","l"),jt(Ut,"length","e"),U(Ut,dt,{get:function(){return this[bt]}}),t.exports=function(t,n,r,a){var f=t+((a=!!a)?"Clamped":"")+"Array",l="get"+t,p="set"+t,v=i[f],g=v||{},x=v&&E(v),b=!v||!c.ABV,S={},_=v&&v.prototype,F=function(t,r){U(t,r,{get:function(){return function(t,r){var e=t._d;return e.v[l](r*n+e.o,St)}(this,r)},set:function(t){return function(t,r,e){var i=t._d;a&&(e=(e=Math.round(e))<0?0:e>255?255:255&e),i.v[p](r*n+i.o,e,St)}(this,r,t)},enumerable:!0})};b?(v=r((function(t,r,e,i){s(t,v,f,"_d");var o,u,c,a,l=0,p=0;if(w(r)){if(!(r instanceof Y||"ArrayBuffer"==(a=m(r))||"SharedArrayBuffer"==a))return bt in r?Mt(v,r):At.call(v,r);o=r,p=Ot(e,n);var g=r.byteLength;if(void 0===i){if(g%n)throw V("Wrong length!");if((u=g-p)<0)throw V("Wrong length!")}else if((u=d(i)*n)+p>g)throw V("Wrong length!");c=u/n}else c=y(r),o=new Y(u=c*n);for(h(t,"_d",{b:o,o:p,l:u,e:c,v:new X(o)});l<c;)F(t,l++)})),_=v.prototype=O(Ut),h(_,"constructor",v)):o((function(){v(1)}))&&o((function(){new v(-1)}))&&L((function(t){new v,new v(null),new v(1.5),new v(t)}),!0)||(v=r((function(t,r,e,i){var o;return s(t,v,f),w(r)?r instanceof Y||"ArrayBuffer"==(o=m(r))||"SharedArrayBuffer"==o?void 0!==i?new g(r,Ot(e,n),i):void 0!==e?new g(r,Ot(e,n)):new g(r):bt in r?Mt(v,r):At.call(v,r):new g(y(r))})),J(x!==Function.prototype?P(g).concat(P(x)):P(g),(function(t){t in v||h(v,t,g[t])})),v.prototype=_,e||(_.constructor=v));var M=_[vt],j=!!M&&("values"==M.name||null==M.name),A=Ct.values;h(v,yt,!0),h(_,bt,f),h(_,mt,!0),h(_,gt,v),(a?new v(1)[dt]==f:dt in _)||U(_,dt,{get:function(){return f}}),S[f]=v,u(u.G+u.W+u.F*(v!=g),S),u(u.S,f,{BYTES_PER_ELEMENT:n}),u(u.S+u.F*o((function(){g.of.call(v,1)})),f,{from:At,of:It}),"BYTES_PER_ELEMENT"in _||h(_,"BYTES_PER_ELEMENT",n),u(u.P,f,Rt),k(f),u(u.P+u.F*_t,f,{set:kt}),u(u.P+u.F*!j,f,Ct),e||_.toString==ht||(_.toString=ht),u(u.P+u.F*o((function(){new v(1).slice()})),f,{slice:Lt}),u(u.P+u.F*(o((function(){return[1,2].toLocaleString()!=new v([1,2]).toLocaleString()}))||!o((function(){_.toLocaleString.call([1,2])}))),f,{toLocaleString:Tt}),R[f]=j?M:A,e||j||h(_,vt,A)}}else t.exports=function(){}},function(t,n,r){var e=r(4);t.exports=function(t,n){if(!e(t))return t;var r,i;if(n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!e(i=r.call(t)))return i;if(!n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){var e=r(29)("meta"),i=r(4),o=r(13),u=r(9).f,c=0,a=Object.isExtensible||function(){return!0},f=!r(2)((function(){return a(Object.preventExtensions({}))})),s=function(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})},l=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,e)){if(!a(t))return"F";if(!n)return"E";s(t)}return t[e].i},getWeak:function(t,n){if(!o(t,e)){if(!a(t))return!0;if(!n)return!1;s(t)}return t[e].w},onFreeze:function(t){return f&&l.NEED&&a(t)&&!o(t,e)&&s(t),t}}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){t.exports=!1},function(t,n,r){var e=r(90),i=r(63);t.exports=Object.keys||function(t){return e(t,i)}},function(t,n,r){var e=r(19),i=Math.max,o=Math.min;t.exports=function(t,n){return(t=e(t))<0?i(t+n,0):o(t,n)}},function(t,n,r){var e=r(3),i=r(91),o=r(63),u=r(62)("IE_PROTO"),c=function(){},a=function(){var t,n=r(60)("iframe"),e=o.length;for(n.style.display="none",r(64).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;e--;)delete a.prototype[o[e]];return a()};t.exports=Object.create||function(t,n){var r;return null!==t?(c.prototype=e(t),r=new c,c.prototype=null,r[u]=t):r=a(),void 0===n?r:i(r,n)}},function(t,n,r){var e=r(90),i=r(63).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,i)}},function(t,n,r){var e=r(13),i=r(10),o=r(62)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),e(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,r){var e=r(5)("unscopables"),i=Array.prototype;null==i[e]&&r(14)(i,e,{}),t.exports=function(t){i[e][t]=!0}},function(t,n,r){var e=r(4);t.exports=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},function(t,n,r){var e=r(9).f,i=r(13),o=r(5)("toStringTag");t.exports=function(t,n,r){t&&!i(t=r?t:t.prototype,o)&&e(t,o,{configurable:!0,value:n})}},function(t,n,r){var e=r(0),i=r(24),o=r(2),u=r(66),c="["+u+"]",a=RegExp("^"+c+c+"*"),f=RegExp(c+c+"*$"),s=function(t,n,r){var i={},c=o((function(){return!!u[t]()||"​…"!="​…"[t]()})),a=i[t]=c?n(l):u[t];r&&(i[r]=a),e(e.P+e.F*c,"String",i)},l=s.trim=function(t,n){return t=String(i(t)),1&n&&(t=t.replace(a,"")),2&n&&(t=t.replace(f,"")),t};t.exports=s},function(t,n){t.exports={}},function(t,n,r){"use strict";var e=r(1),i=r(9),o=r(8),u=r(5)("species");t.exports=function(t){var n=e[t];o&&n&&!n[u]&&i.f(n,u,{configurable:!0,get:function(){return this}})}},function(t,n){t.exports=function(t,n,r,e){if(!(t instanceof n)||void 0!==e&&e in t)throw TypeError(r+": incorrect invocation!");return t}},function(t,n,r){var e=r(11);t.exports=function(t,n,r){for(var i in n)e(t,i,n[i],r);return t}},function(t,n,r){var e=r(23);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){var e=r(23),i=r(5)("toStringTag"),o="Arguments"==e(function(){return arguments}());t.exports=function(t){var n,r,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),i))?r:o?e(n):"Object"==(u=e(n))&&"function"==typeof n.callee?"Arguments":u}},function(t,n,r){var e=r(3),i=r(18),o=r(5)("species");t.exports=function(t,n){var r,u=e(t).constructor;return void 0===u||null==(r=e(u)[o])?n:i(r)}},function(t,n,r){var e=r(7),i=r(1),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(30)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,n,r){var e=r(15),i=r(6),o=r(32);t.exports=function(t){return function(n,r,u){var c,a=e(n),f=i(a.length),s=o(u,f);if(t&&r!=r){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===r)return t||s||0;return!t&&-1}}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(23);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(5)("iterator"),i=!1;try{var o=[7][e]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,n){if(!n&&!i)return!1;var r=!1;try{var o=[7],u=o[e]();u.next=function(){return{done:r=!0}},o[e]=function(){return u},t(o)}catch(t){}return r}},function(t,n,r){"use strict";var e=r(3);t.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n,r){"use strict";var e=r(46),i=RegExp.prototype.exec;t.exports=function(t,n){var r=t.exec;if("function"==typeof r){var o=r.call(t,n);if("object"!=typeof o)throw new TypeError("RegExp exec method returned something other than an Object or null");return o}if("RegExp"!==e(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,n)}},function(t,n,r){"use strict";r(108);var e=r(11),i=r(14),o=r(2),u=r(24),c=r(5),a=r(81),f=c("species"),s=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),l=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();t.exports=function(t,n,r){var h=c(t),p=!o((function(){var n={};return n[h]=function(){return 7},7!=""[t](n)})),v=p?!o((function(){var n=!1,r=/a/;return r.exec=function(){return n=!0,null},"split"===t&&(r.constructor={},r.constructor[f]=function(){return r}),r[h](""),!n})):void 0;if(!p||!v||"replace"===t&&!s||"split"===t&&!l){var d=/./[h],y=r(u,h,""[t],(function(t,n,r,e,i){return n.exec===a?p&&!i?{done:!0,value:d.call(n,r,e)}:{done:!0,value:t.call(r,n,e)}:{done:!1}})),g=y[0],x=y[1];e(String.prototype,t,g),i(RegExp.prototype,h,2==n?function(t,n){return x.call(t,this,n)}:function(t){return x.call(t,this)})}}},function(t,n,r){var e=r(17),i=r(103),o=r(76),u=r(3),c=r(6),a=r(78),f={},s={};(n=t.exports=function(t,n,r,l,h){var p,v,d,y,g=h?function(){return t}:a(t),x=e(r,l,n?2:1),b=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(o(g)){for(p=c(t.length);p>b;b++)if((y=n?x(u(v=t[b])[0],v[1]):x(t[b]))===f||y===s)return y}else for(d=g.call(t);!(v=d.next()).done;)if((y=i(d,x,v.value,n))===f||y===s)return y}).BREAK=f,n.RETURN=s},function(t,n,r){var e=r(1).navigator;t.exports=e&&e.userAgent||""},function(t,n,r){"use strict";var e=r(1),i=r(0),o=r(11),u=r(43),c=r(27),a=r(56),f=r(42),s=r(4),l=r(2),h=r(52),p=r(38),v=r(67);t.exports=function(t,n,r,d,y,g){var x=e[t],b=x,m=y?"set":"add",w=b&&b.prototype,S={},_=function(t){var n=w[t];o(w,t,"delete"==t||"has"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return g&&!s(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,r){return n.call(this,0===t?0:t,r),this})};if("function"==typeof b&&(g||w.forEach&&!l((function(){(new b).entries().next()})))){var O=new b,E=O[m](g?{}:-0,1)!=O,P=l((function(){O.has(1)})),F=h((function(t){new b(t)})),M=!g&&l((function(){for(var t=new b,n=5;n--;)t[m](n,n);return!t.has(-0)}));F||((b=n((function(n,r){f(n,b,t);var e=v(new x,n,b);return null!=r&&a(r,y,e[m],e),e}))).prototype=w,w.constructor=b),(P||M)&&(_("delete"),_("has"),y&&_("get")),(M||E)&&_(m),g&&w.clear&&delete w.clear}else b=d.getConstructor(n,t,y,m),u(b.prototype,r),c.NEED=!0;return p(b,t),S[t]=b,i(i.G+i.W+i.F*(b!=x),S),g||d.setStrong(b,t,y),b}},function(t,n,r){for(var e,i=r(1),o=r(14),u=r(29),c=u("typed_array"),a=u("view"),f=!(!i.ArrayBuffer||!i.DataView),s=f,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=i[h[l++]])?(o(e.prototype,c,!0),o(e.prototype,a,!0)):s=!1;t.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},function(t,n,r){var e=r(4),i=r(1).document,o=e(i)&&e(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,n,r){n.f=r(5)},function(t,n,r){var e=r(48)("keys"),i=r(29);t.exports=function(t){return e[t]||(e[t]=i(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,r){var e=r(1).document;t.exports=e&&e.documentElement},function(t,n,r){var e=r(4),i=r(3),o=function(t,n){if(i(t),!e(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,e){try{(e=r(17)(Function.call,r(20).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,r){return o(t,r),n?t.__proto__=r:e(t,r),t}}({},!1):void 0),check:o}},function(t,n){t.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},function(t,n,r){var e=r(4),i=r(65).set;t.exports=function(t,n,r){var o,u=n.constructor;return u!==r&&"function"==typeof u&&(o=u.prototype)!==r.prototype&&e(o)&&i&&i(t,o),t}},function(t,n,r){"use strict";var e=r(19),i=r(24);t.exports=function(t){var n=String(i(this)),r="",o=e(t);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(n+=n))1&o&&(r+=n);return r}},function(t,n){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,n){var r=Math.expm1;t.exports=!r||r(10)>22025.465794806718||r(10)<22025.465794806718||-2e-17!=r(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:r},function(t,n,r){var e=r(19),i=r(24);t.exports=function(t){return function(n,r){var o,u,c=String(i(n)),a=e(r),f=c.length;return a<0||a>=f?t?"":void 0:(o=c.charCodeAt(a))<55296||o>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):o:t?c.slice(a,a+2):u-56320+(o-55296<<10)+65536}}},function(t,n,r){"use strict";var e=r(30),i=r(0),o=r(11),u=r(14),c=r(40),a=r(102),f=r(38),s=r(35),l=r(5)("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,n,r,v,d,y,g){a(r,n,v);var x,b,m,w=function(t){if(!h&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},S=n+" Iterator",_="values"==d,O=!1,E=t.prototype,P=E[l]||E["@@iterator"]||d&&E[d],F=P||w(d),M=d?_?w("entries"):F:void 0,j="Array"==n&&E.entries||P;if(j&&(m=s(j.call(new t)))!==Object.prototype&&m.next&&(f(m,S,!0),e||"function"==typeof m[l]||u(m,l,p)),_&&P&&"values"!==P.name&&(O=!0,F=function(){return P.call(this)}),e&&!g||!h&&!O&&E[l]||u(E,l,F),c[n]=F,c[S]=p,d)if(x={values:_?F:w("values"),keys:y?F:w("keys"),entries:M},g)for(b in x)b in E||o(E,b,x[b]);else i(i.P+i.F*(h||O),n,x);return x}},function(t,n,r){var e=r(74),i=r(24);t.exports=function(t,n,r){if(e(n))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(t))}},function(t,n,r){var e=r(4),i=r(23),o=r(5)("match");t.exports=function(t){var n;return e(t)&&(void 0!==(n=t[o])?!!n:"RegExp"==i(t))}},function(t,n,r){var e=r(5)("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(r){try{return n[e]=!1,!"/./"[t](n)}catch(t){}}return!0}},function(t,n,r){var e=r(40),i=r(5)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(e.Array===t||o[i]===t)}},function(t,n,r){"use strict";var e=r(9),i=r(28);t.exports=function(t,n,r){n in t?e.f(t,n,i(0,r)):t[n]=r}},function(t,n,r){var e=r(46),i=r(5)("iterator"),o=r(40);t.exports=r(7).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[e(t)]}},function(t,n,r){"use strict";var e=r(10),i=r(32),o=r(6);t.exports=function(t){for(var n=e(this),r=o(n.length),u=arguments.length,c=i(u>1?arguments[1]:void 0,r),a=u>2?arguments[2]:void 0,f=void 0===a?r:i(a,r);f>c;)n[c++]=t;return n}},function(t,n,r){"use strict";var e=r(36),i=r(107),o=r(40),u=r(15);t.exports=r(72)(Array,"Array",(function(t,n){this._t=u(t),this._i=0,this._k=n}),(function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,i(1)):i(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])}),"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},function(t,n,r){"use strict";var e,i,o=r(53),u=RegExp.prototype.exec,c=String.prototype.replace,a=u,f=(e=/a/,i=/b*/g,u.call(e,"a"),u.call(i,"a"),0!==e.lastIndex||0!==i.lastIndex),s=void 0!==/()??/.exec("")[1];(f||s)&&(a=function(t){var n,r,e,i,a=this;return s&&(r=new RegExp("^"+a.source+"$(?!\\s)",o.call(a))),f&&(n=a.lastIndex),e=u.call(a,t),f&&e&&(a.lastIndex=a.global?e.index+e[0].length:n),s&&e&&e.length>1&&c.call(e[0],r,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(e[i]=void 0)})),e}),t.exports=a},function(t,n,r){"use strict";var e=r(71)(!0);t.exports=function(t,n,r){return n+(r?e(t,n).length:1)}},function(t,n,r){var e,i,o,u=r(17),c=r(96),a=r(64),f=r(60),s=r(1),l=s.process,h=s.setImmediate,p=s.clearImmediate,v=s.MessageChannel,d=s.Dispatch,y=0,g={},x=function(){var t=+this;if(g.hasOwnProperty(t)){var n=g[t];delete g[t],n()}},b=function(t){x.call(t.data)};h&&p||(h=function(t){for(var n=[],r=1;arguments.length>r;)n.push(arguments[r++]);return g[++y]=function(){c("function"==typeof t?t:Function(t),n)},e(y),y},p=function(t){delete g[t]},"process"==r(23)(l)?e=function(t){l.nextTick(u(x,t,1))}:d&&d.now?e=function(t){d.now(u(x,t,1))}:v?(o=(i=new v).port2,i.port1.onmessage=b,e=u(o.postMessage,o,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(e=function(t){s.postMessage(t+"","*")},s.addEventListener("message",b,!1)):e="onreadystatechange"in f("script")?function(t){a.appendChild(f("script")).onreadystatechange=function(){a.removeChild(this),x.call(t)}}:function(t){setTimeout(u(x,t,1),0)}),t.exports={set:h,clear:p}},function(t,n,r){"use strict";var e=r(1),i=r(8),o=r(30),u=r(59),c=r(14),a=r(43),f=r(2),s=r(42),l=r(19),h=r(6),p=r(115),v=r(34).f,d=r(9).f,y=r(79),g=r(38),x=e.ArrayBuffer,b=e.DataView,m=e.Math,w=e.RangeError,S=e.Infinity,_=x,O=m.abs,E=m.pow,P=m.floor,F=m.log,M=m.LN2,j=i?"_b":"buffer",A=i?"_l":"byteLength",I=i?"_o":"byteOffset";function N(t,n,r){var e,i,o,u=new Array(r),c=8*r-n-1,a=(1<<c)-1,f=a>>1,s=23===n?E(2,-24)-E(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for((t=O(t))!=t||t===S?(i=t!=t?1:0,e=a):(e=P(F(t)/M),t*(o=E(2,-e))<1&&(e--,o*=2),(t+=e+f>=1?s/o:s*E(2,1-f))*o>=2&&(e++,o/=2),e+f>=a?(i=0,e=a):e+f>=1?(i=(t*o-1)*E(2,n),e+=f):(i=t*E(2,f-1)*E(2,n),e=0));n>=8;u[l++]=255&i,i/=256,n-=8);for(e=e<<n|i,c+=n;c>0;u[l++]=255&e,e/=256,c-=8);return u[--l]|=128*h,u}function T(t,n,r){var e,i=8*r-n-1,o=(1<<i)-1,u=o>>1,c=i-7,a=r-1,f=t[a--],s=127&f;for(f>>=7;c>0;s=256*s+t[a],a--,c-=8);for(e=s&(1<<-c)-1,s>>=-c,c+=n;c>0;e=256*e+t[a],a--,c-=8);if(0===s)s=1-u;else{if(s===o)return e?NaN:f?-S:S;e+=E(2,n),s-=u}return(f?-1:1)*e*E(2,s-n)}function R(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function L(t){return[255&t]}function k(t){return[255&t,t>>8&255]}function C(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function W(t){return N(t,52,8)}function D(t){return N(t,23,4)}function G(t,n,r){d(t.prototype,n,{get:function(){return this[r]}})}function U(t,n,r,e){var i=p(+r);if(i+n>t[A])throw w("Wrong index!");var o=t[j]._b,u=i+t[I],c=o.slice(u,u+n);return e?c:c.reverse()}function B(t,n,r,e,i,o){var u=p(+r);if(u+n>t[A])throw w("Wrong index!");for(var c=t[j]._b,a=u+t[I],f=e(+i),s=0;s<n;s++)c[a+s]=f[o?s:n-s-1]}if(u.ABV){if(!f((function(){x(1)}))||!f((function(){new x(-1)}))||f((function(){return new x,new x(1.5),new x(NaN),"ArrayBuffer"!=x.name}))){for(var V,q=(x=function(t){return s(this,x),new _(p(t))}).prototype=_.prototype,z=v(_),H=0;z.length>H;)(V=z[H++])in x||c(x,V,_[V]);o||(q.constructor=x)}var Y=new b(new x(2)),X=b.prototype.setInt8;Y.setInt8(0,2147483648),Y.setInt8(1,2147483649),!Y.getInt8(0)&&Y.getInt8(1)||a(b.prototype,{setInt8:function(t,n){X.call(this,t,n<<24>>24)},setUint8:function(t,n){X.call(this,t,n<<24>>24)}},!0)}else x=function(t){s(this,x,"ArrayBuffer");var n=p(t);this._b=y.call(new Array(n),0),this[A]=n},b=function(t,n,r){s(this,b,"DataView"),s(t,x,"DataView");var e=t[A],i=l(n);if(i<0||i>e)throw w("Wrong offset!");if(i+(r=void 0===r?e-i:h(r))>e)throw w("Wrong length!");this[j]=t,this[I]=i,this[A]=r},i&&(G(x,"byteLength","_l"),G(b,"buffer","_b"),G(b,"byteLength","_l"),G(b,"byteOffset","_o")),a(b.prototype,{getInt8:function(t){return U(this,1,t)[0]<<24>>24},getUint8:function(t){return U(this,1,t)[0]},getInt16:function(t){var n=U(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=U(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return R(U(this,4,t,arguments[1]))},getUint32:function(t){return R(U(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return T(U(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return T(U(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){B(this,1,t,L,n)},setUint8:function(t,n){B(this,1,t,L,n)},setInt16:function(t,n){B(this,2,t,k,n,arguments[2])},setUint16:function(t,n){B(this,2,t,k,n,arguments[2])},setInt32:function(t,n){B(this,4,t,C,n,arguments[2])},setUint32:function(t,n){B(this,4,t,C,n,arguments[2])},setFloat32:function(t,n){B(this,4,t,D,n,arguments[2])},setFloat64:function(t,n){B(this,8,t,W,n,arguments[2])}});g(x,"ArrayBuffer"),g(b,"DataView"),c(b.prototype,u.VIEW,!0),n.ArrayBuffer=x,n.DataView=b},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){t.exports=!r(120)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,n,r){t.exports=!r(8)&&!r(2)((function(){return 7!=Object.defineProperty(r(60)("div"),"a",{get:function(){return 7}}).a}))},function(t,n,r){var e=r(1),i=r(7),o=r(30),u=r(61),c=r(9).f;t.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n,r){var e=r(13),i=r(15),o=r(49)(!1),u=r(62)("IE_PROTO");t.exports=function(t,n){var r,c=i(t),a=0,f=[];for(r in c)r!=u&&e(c,r)&&f.push(r);for(;n.length>a;)e(c,r=n[a++])&&(~o(f,r)||f.push(r));return f}},function(t,n,r){var e=r(9),i=r(3),o=r(31);t.exports=r(8)?Object.defineProperties:function(t,n){i(t);for(var r,u=o(n),c=u.length,a=0;c>a;)e.f(t,r=u[a++],n[r]);return t}},function(t,n,r){var e=r(15),i=r(34).f,o={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return u.slice()}}(t):i(e(t))}},function(t,n,r){"use strict";var e=r(8),i=r(31),o=r(50),u=r(45),c=r(10),a=r(44),f=Object.assign;t.exports=!f||r(2)((function(){var t={},n={},r=Symbol(),e="abcdefghijklmnopqrst";return t[r]=7,e.split("").forEach((function(t){n[t]=t})),7!=f({},t)[r]||Object.keys(f({},n)).join("")!=e}))?function(t,n){for(var r=c(t),f=arguments.length,s=1,l=o.f,h=u.f;f>s;)for(var p,v=a(arguments[s++]),d=l?i(v).concat(l(v)):i(v),y=d.length,g=0;y>g;)p=d[g++],e&&!h.call(v,p)||(r[p]=v[p]);return r}:f},function(t,n){t.exports=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}},function(t,n,r){"use strict";var e=r(18),i=r(4),o=r(96),u=[].slice,c={},a=function(t,n,r){if(!(n in c)){for(var e=[],i=0;i<n;i++)e[i]="a["+i+"]";c[n]=Function("F,a","return new F("+e.join(",")+")")}return c[n](t,r)};t.exports=Function.bind||function(t){var n=e(this),r=u.call(arguments,1),c=function(){var e=r.concat(u.call(arguments));return this instanceof c?a(n,e.length,e):o(n,e,t)};return i(n.prototype)&&(c.prototype=n.prototype),c}},function(t,n){t.exports=function(t,n,r){var e=void 0===r;switch(n.length){case 0:return e?t():t.call(r);case 1:return e?t(n[0]):t.call(r,n[0]);case 2:return e?t(n[0],n[1]):t.call(r,n[0],n[1]);case 3:return e?t(n[0],n[1],n[2]):t.call(r,n[0],n[1],n[2]);case 4:return e?t(n[0],n[1],n[2],n[3]):t.call(r,n[0],n[1],n[2],n[3])}return t.apply(r,n)}},function(t,n,r){var e=r(1).parseInt,i=r(39).trim,o=r(66),u=/^[-+]?0[xX]/;t.exports=8!==e(o+"08")||22!==e(o+"0x16")?function(t,n){var r=i(String(t),3);return e(r,n>>>0||(u.test(r)?16:10))}:e},function(t,n,r){var e=r(1).parseFloat,i=r(39).trim;t.exports=1/e(r(66)+"-0")!=-1/0?function(t){var n=i(String(t),3),r=e(n);return 0===r&&"-"==n.charAt(0)?-0:r}:e},function(t,n,r){var e=r(23);t.exports=function(t,n){if("number"!=typeof t&&"Number"!=e(t))throw TypeError(n);return+t}},function(t,n,r){var e=r(4),i=Math.floor;t.exports=function(t){return!e(t)&&isFinite(t)&&i(t)===t}},function(t,n){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,n,r){"use strict";var e=r(33),i=r(28),o=r(38),u={};r(14)(u,r(5)("iterator"),(function(){return this})),t.exports=function(t,n,r){t.prototype=e(u,{next:i(1,r)}),o(t,n+" Iterator")}},function(t,n,r){var e=r(3);t.exports=function(t,n,r,i){try{return i?n(e(r)[0],r[1]):n(r)}catch(n){var o=t.return;throw void 0!==o&&e(o.call(t)),n}}},function(t,n,r){var e=r(216);t.exports=function(t,n){return new(e(t))(n)}},function(t,n,r){var e=r(18),i=r(10),o=r(44),u=r(6);t.exports=function(t,n,r,c,a){e(n);var f=i(t),s=o(f),l=u(f.length),h=a?l-1:0,p=a?-1:1;if(r<2)for(;;){if(h in s){c=s[h],h+=p;break}if(h+=p,a?h<0:l<=h)throw TypeError("Reduce of empty array with no initial value")}for(;a?h>=0:l>h;h+=p)h in s&&(c=n(c,s[h],h,f));return c}},function(t,n,r){"use strict";var e=r(10),i=r(32),o=r(6);t.exports=[].copyWithin||function(t,n){var r=e(this),u=o(r.length),c=i(t,u),a=i(n,u),f=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===f?u:i(f,u))-a,u-c),l=1;for(a<c&&c<a+s&&(l=-1,a+=s-1,c+=s-1);s-- >0;)a in r?r[c]=r[a]:delete r[c],c+=l,a+=l;return r}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){"use strict";var e=r(81);r(0)({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e})},function(t,n,r){r(8)&&"g"!=/./g.flags&&r(9).f(RegExp.prototype,"flags",{configurable:!0,get:r(53)})},function(t,n,r){"use strict";var e,i,o,u,c=r(30),a=r(1),f=r(17),s=r(46),l=r(0),h=r(4),p=r(18),v=r(42),d=r(56),y=r(47),g=r(83).set,x=r(236)(),b=r(111),m=r(237),w=r(57),S=r(112),_=a.TypeError,O=a.process,E=O&&O.versions,P=E&&E.v8||"",F=a.Promise,M="process"==s(O),j=function(){},A=i=b.f,I=!!function(){try{var t=F.resolve(1),n=(t.constructor={})[r(5)("species")]=function(t){t(j,j)};return(M||"function"==typeof PromiseRejectionEvent)&&t.then(j)instanceof n&&0!==P.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(t){}}(),N=function(t){var n;return!(!h(t)||"function"!=typeof(n=t.then))&&n},T=function(t,n){if(!t._n){t._n=!0;var r=t._c;x((function(){for(var e=t._v,i=1==t._s,o=0,u=function(n){var r,o,u,c=i?n.ok:n.fail,a=n.resolve,f=n.reject,s=n.domain;try{c?(i||(2==t._h&&k(t),t._h=1),!0===c?r=e:(s&&s.enter(),r=c(e),s&&(s.exit(),u=!0)),r===n.promise?f(_("Promise-chain cycle")):(o=N(r))?o.call(r,a,f):a(r)):f(e)}catch(t){s&&!u&&s.exit(),f(t)}};r.length>o;)u(r[o++]);t._c=[],t._n=!1,n&&!t._h&&R(t)}))}},R=function(t){g.call(a,(function(){var n,r,e,i=t._v,o=L(t);if(o&&(n=m((function(){M?O.emit("unhandledRejection",i,t):(r=a.onunhandledrejection)?r({promise:t,reason:i}):(e=a.console)&&e.error&&e.error("Unhandled promise rejection",i)})),t._h=M||L(t)?2:1),t._a=void 0,o&&n.e)throw n.v}))},L=function(t){return 1!==t._h&&0===(t._a||t._c).length},k=function(t){g.call(a,(function(){var n;M?O.emit("rejectionHandled",t):(n=a.onrejectionhandled)&&n({promise:t,reason:t._v})}))},C=function(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),T(n,!0))},W=function(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw _("Promise can't be resolved itself");(n=N(t))?x((function(){var e={_w:r,_d:!1};try{n.call(t,f(W,e,1),f(C,e,1))}catch(t){C.call(e,t)}})):(r._v=t,r._s=1,T(r,!1))}catch(t){C.call({_w:r,_d:!1},t)}}};I||(F=function(t){v(this,F,"Promise","_h"),p(t),e.call(this);try{t(f(W,this,1),f(C,this,1))}catch(t){C.call(this,t)}},(e=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(43)(F.prototype,{then:function(t,n){var r=A(y(this,F));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=M?O.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&T(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new e;this.promise=t,this.resolve=f(W,t,1),this.reject=f(C,t,1)},b.f=A=function(t){return t===F||t===u?new o(t):i(t)}),l(l.G+l.W+l.F*!I,{Promise:F}),r(38)(F,"Promise"),r(41)("Promise"),u=r(7).Promise,l(l.S+l.F*!I,"Promise",{reject:function(t){var n=A(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!I),"Promise",{resolve:function(t){return S(c&&this===u?F:this,t)}}),l(l.S+l.F*!(I&&r(52)((function(t){F.all(t).catch(j)}))),"Promise",{all:function(t){var n=this,r=A(n),e=r.resolve,i=r.reject,o=m((function(){var r=[],o=0,u=1;d(t,!1,(function(t){var c=o++,a=!1;r.push(void 0),u++,n.resolve(t).then((function(t){a||(a=!0,r[c]=t,--u||e(r))}),i)})),--u||e(r)}));return o.e&&i(o.v),r.promise},race:function(t){var n=this,r=A(n),e=r.reject,i=m((function(){d(t,!1,(function(t){n.resolve(t).then(r.resolve,e)}))}));return i.e&&e(i.v),r.promise}})},function(t,n,r){"use strict";var e=r(18);function i(t){var n,r;this.promise=new t((function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e})),this.resolve=e(n),this.reject=e(r)}t.exports.f=function(t){return new i(t)}},function(t,n,r){var e=r(3),i=r(4),o=r(111);t.exports=function(t,n){if(e(t),i(n)&&n.constructor===t)return n;var r=o.f(t);return(0,r.resolve)(n),r.promise}},function(t,n,r){"use strict";var e=r(9).f,i=r(33),o=r(43),u=r(17),c=r(42),a=r(56),f=r(72),s=r(107),l=r(41),h=r(8),p=r(27).fastKey,v=r(37),d=h?"_s":"size",y=function(t,n){var r,e=p(n);if("F"!==e)return t._i[e];for(r=t._f;r;r=r.n)if(r.k==n)return r};t.exports={getConstructor:function(t,n,r,f){var s=t((function(t,e){c(t,s,n,"_i"),t._t=n,t._i=i(null),t._f=void 0,t._l=void 0,t[d]=0,null!=e&&a(e,r,t[f],t)}));return o(s.prototype,{clear:function(){for(var t=v(this,n),r=t._i,e=t._f;e;e=e.n)e.r=!0,e.p&&(e.p=e.p.n=void 0),delete r[e.i];t._f=t._l=void 0,t[d]=0},delete:function(t){var r=v(this,n),e=y(r,t);if(e){var i=e.n,o=e.p;delete r._i[e.i],e.r=!0,o&&(o.n=i),i&&(i.p=o),r._f==e&&(r._f=i),r._l==e&&(r._l=o),r[d]--}return!!e},forEach:function(t){v(this,n);for(var r,e=u(t,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(e(r.v,r.k,this);r&&r.r;)r=r.p},has:function(t){return!!y(v(this,n),t)}}),h&&e(s.prototype,"size",{get:function(){return v(this,n)[d]}}),s},def:function(t,n,r){var e,i,o=y(t,n);return o?o.v=r:(t._l=o={i:i=p(n,!0),k:n,v:r,p:e=t._l,n:void 0,r:!1},t._f||(t._f=o),e&&(e.n=o),t[d]++,"F"!==i&&(t._i[i]=o)),t},getEntry:y,setStrong:function(t,n,r){f(t,n,(function(t,r){this._t=v(t,n),this._k=r,this._l=void 0}),(function(){for(var t=this._k,n=this._l;n&&n.r;)n=n.p;return this._t&&(this._l=n=n?n.n:this._t._f)?s(0,"keys"==t?n.k:"values"==t?n.v:[n.k,n.v]):(this._t=void 0,s(1))}),r?"entries":"values",!r,!0),l(n)}}},function(t,n,r){"use strict";var e=r(43),i=r(27).getWeak,o=r(3),u=r(4),c=r(42),a=r(56),f=r(22),s=r(13),l=r(37),h=f(5),p=f(6),v=0,d=function(t){return t._l||(t._l=new y)},y=function(){this.a=[]},g=function(t,n){return h(t.a,(function(t){return t[0]===n}))};y.prototype={get:function(t){var n=g(this,t);if(n)return n[1]},has:function(t){return!!g(this,t)},set:function(t,n){var r=g(this,t);r?r[1]=n:this.a.push([t,n])},delete:function(t){var n=p(this.a,(function(n){return n[0]===t}));return~n&&this.a.splice(n,1),!!~n}},t.exports={getConstructor:function(t,n,r,o){var f=t((function(t,e){c(t,f,n,"_i"),t._t=n,t._i=v++,t._l=void 0,null!=e&&a(e,r,t[o],t)}));return e(f.prototype,{delete:function(t){if(!u(t))return!1;var r=i(t);return!0===r?d(l(this,n)).delete(t):r&&s(r,this._i)&&delete r[this._i]},has:function(t){if(!u(t))return!1;var r=i(t);return!0===r?d(l(this,n)).has(t):r&&s(r,this._i)}}),f},def:function(t,n,r){var e=i(o(n),!0);return!0===e?d(t).set(n,r):e[t._i]=r,t},ufstore:d}},function(t,n,r){var e=r(19),i=r(6);t.exports=function(t){if(void 0===t)return 0;var n=e(t),r=i(n);if(n!==r)throw RangeError("Wrong length!");return r}},function(t,n,r){var e=r(34),i=r(50),o=r(3),u=r(1).Reflect;t.exports=u&&u.ownKeys||function(t){var n=e.f(o(t)),r=i.f;return r?n.concat(r(t)):n}},function(t,n,r){var e=r(6),i=r(68),o=r(24);t.exports=function(t,n,r,u){var c=String(o(t)),a=c.length,f=void 0===r?" ":String(r),s=e(n);if(s<=a||""==f)return c;var l=s-a,h=i.call(f,Math.ceil(l/f.length));return h.length>l&&(h=h.slice(0,l)),u?h+c:c+h}},function(t,n,r){var e=r(8),i=r(31),o=r(15),u=r(45).f;t.exports=function(t){return function(n){for(var r,c=o(n),a=i(c),f=a.length,s=0,l=[];f>s;)r=a[s++],e&&!u.call(c,r)||l.push(t?[r,c[r]]:c[r]);return l}}},function(t,n){var r=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=r)},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){r(122),t.exports=r(308)},function(t,n,r){"use strict";r(123);var e,i=(e=r(295))&&e.__esModule?e:{default:e};i.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),i.default._babelPolyfill=!0},function(t,n,r){"use strict";r(124),r(267),r(269),r(272),r(274),r(276),r(278),r(280),r(282),r(284),r(286),r(288),r(290),r(294)},function(t,n,r){r(125),r(128),r(129),r(130),r(131),r(132),r(133),r(134),r(135),r(136),r(137),r(138),r(139),r(140),r(141),r(142),r(143),r(144),r(145),r(146),r(147),r(148),r(149),r(150),r(151),r(152),r(153),r(154),r(155),r(156),r(157),r(158),r(159),r(160),r(161),r(162),r(163),r(164),r(165),r(166),r(167),r(168),r(169),r(171),r(172),r(173),r(174),r(175),r(176),r(177),r(178),r(179),r(180),r(181),r(182),r(183),r(184),r(185),r(186),r(187),r(188),r(189),r(190),r(191),r(192),r(193),r(194),r(195),r(196),r(197),r(198),r(199),r(200),r(201),r(202),r(203),r(204),r(206),r(207),r(209),r(210),r(211),r(212),r(213),r(214),r(215),r(217),r(218),r(219),r(220),r(221),r(222),r(223),r(224),r(225),r(226),r(227),r(228),r(229),r(80),r(230),r(108),r(231),r(109),r(232),r(233),r(234),r(235),r(110),r(238),r(239),r(240),r(241),r(242),r(243),r(244),r(245),r(246),r(247),r(248),r(249),r(250),r(251),r(252),r(253),r(254),r(255),r(256),r(257),r(258),r(259),r(260),r(261),r(262),r(263),r(264),r(265),r(266),t.exports=r(7)},function(t,n,r){"use strict";var e=r(1),i=r(13),o=r(8),u=r(0),c=r(11),a=r(27).KEY,f=r(2),s=r(48),l=r(38),h=r(29),p=r(5),v=r(61),d=r(89),y=r(127),g=r(51),x=r(3),b=r(4),m=r(10),w=r(15),S=r(26),_=r(28),O=r(33),E=r(92),P=r(20),F=r(50),M=r(9),j=r(31),A=P.f,I=M.f,N=E.f,T=e.Symbol,R=e.JSON,L=R&&R.stringify,k=p("_hidden"),C=p("toPrimitive"),W={}.propertyIsEnumerable,D=s("symbol-registry"),G=s("symbols"),U=s("op-symbols"),B=Object.prototype,V="function"==typeof T&&!!F.f,q=e.QObject,z=!q||!q.prototype||!q.prototype.findChild,H=o&&f((function(){return 7!=O(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a}))?function(t,n,r){var e=A(B,n);e&&delete B[n],I(t,n,r),e&&t!==B&&I(B,n,e)}:I,Y=function(t){var n=G[t]=O(T.prototype);return n._k=t,n},X=V&&"symbol"==typeof T.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof T},J=function(t,n,r){return t===B&&J(U,n,r),x(t),n=S(n,!0),x(r),i(G,n)?(r.enumerable?(i(t,k)&&t[k][n]&&(t[k][n]=!1),r=O(r,{enumerable:_(0,!1)})):(i(t,k)||I(t,k,_(1,{})),t[k][n]=!0),H(t,n,r)):I(t,n,r)},$=function(t,n){x(t);for(var r,e=y(n=w(n)),i=0,o=e.length;o>i;)J(t,r=e[i++],n[r]);return t},K=function(t){var n=W.call(this,t=S(t,!0));return!(this===B&&i(G,t)&&!i(U,t))&&(!(n||!i(this,t)||!i(G,t)||i(this,k)&&this[k][t])||n)},Z=function(t,n){if(t=w(t),n=S(n,!0),t!==B||!i(G,n)||i(U,n)){var r=A(t,n);return!r||!i(G,n)||i(t,k)&&t[k][n]||(r.enumerable=!0),r}},Q=function(t){for(var n,r=N(w(t)),e=[],o=0;r.length>o;)i(G,n=r[o++])||n==k||n==a||e.push(n);return e},tt=function(t){for(var n,r=t===B,e=N(r?U:w(t)),o=[],u=0;e.length>u;)!i(G,n=e[u++])||r&&!i(B,n)||o.push(G[n]);return o};V||(c((T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),n=function(r){this===B&&n.call(U,r),i(this,k)&&i(this[k],t)&&(this[k][t]=!1),H(this,t,_(1,r))};return o&&z&&H(B,t,{configurable:!0,set:n}),Y(t)}).prototype,"toString",(function(){return this._k})),P.f=Z,M.f=J,r(34).f=E.f=Q,r(45).f=K,F.f=tt,o&&!r(30)&&c(B,"propertyIsEnumerable",K,!0),v.f=function(t){return Y(p(t))}),u(u.G+u.W+u.F*!V,{Symbol:T});for(var nt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),rt=0;nt.length>rt;)p(nt[rt++]);for(var et=j(p.store),it=0;et.length>it;)d(et[it++]);u(u.S+u.F*!V,"Symbol",{for:function(t){return i(D,t+="")?D[t]:D[t]=T(t)},keyFor:function(t){if(!X(t))throw TypeError(t+" is not a symbol!");for(var n in D)if(D[n]===t)return n},useSetter:function(){z=!0},useSimple:function(){z=!1}}),u(u.S+u.F*!V,"Object",{create:function(t,n){return void 0===n?O(t):$(O(t),n)},defineProperty:J,defineProperties:$,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ot=f((function(){F.f(1)}));u(u.S+u.F*ot,"Object",{getOwnPropertySymbols:function(t){return F.f(m(t))}}),R&&u(u.S+u.F*(!V||f((function(){var t=T();return"[null]"!=L([t])||"{}"!=L({a:t})||"{}"!=L(Object(t))}))),"JSON",{stringify:function(t){for(var n,r,e=[t],i=1;arguments.length>i;)e.push(arguments[i++]);if(r=n=e[1],(b(n)||void 0!==t)&&!X(t))return g(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!X(n))return n}),e[1]=n,L.apply(R,e)}}),T.prototype[C]||r(14)(T.prototype,C,T.prototype.valueOf),l(T,"Symbol"),l(Math,"Math",!0),l(e.JSON,"JSON",!0)},function(t,n,r){t.exports=r(48)("native-function-to-string",Function.toString)},function(t,n,r){var e=r(31),i=r(50),o=r(45);t.exports=function(t){var n=e(t),r=i.f;if(r)for(var u,c=r(t),a=o.f,f=0;c.length>f;)a.call(t,u=c[f++])&&n.push(u);return n}},function(t,n,r){var e=r(0);e(e.S,"Object",{create:r(33)})},function(t,n,r){var e=r(0);e(e.S+e.F*!r(8),"Object",{defineProperty:r(9).f})},function(t,n,r){var e=r(0);e(e.S+e.F*!r(8),"Object",{defineProperties:r(91)})},function(t,n,r){var e=r(15),i=r(20).f;r(21)("getOwnPropertyDescriptor",(function(){return function(t,n){return i(e(t),n)}}))},function(t,n,r){var e=r(10),i=r(35);r(21)("getPrototypeOf",(function(){return function(t){return i(e(t))}}))},function(t,n,r){var e=r(10),i=r(31);r(21)("keys",(function(){return function(t){return i(e(t))}}))},function(t,n,r){r(21)("getOwnPropertyNames",(function(){return r(92).f}))},function(t,n,r){var e=r(4),i=r(27).onFreeze;r(21)("freeze",(function(t){return function(n){return t&&e(n)?t(i(n)):n}}))},function(t,n,r){var e=r(4),i=r(27).onFreeze;r(21)("seal",(function(t){return function(n){return t&&e(n)?t(i(n)):n}}))},function(t,n,r){var e=r(4),i=r(27).onFreeze;r(21)("preventExtensions",(function(t){return function(n){return t&&e(n)?t(i(n)):n}}))},function(t,n,r){var e=r(4);r(21)("isFrozen",(function(t){return function(n){return!e(n)||!!t&&t(n)}}))},function(t,n,r){var e=r(4);r(21)("isSealed",(function(t){return function(n){return!e(n)||!!t&&t(n)}}))},function(t,n,r){var e=r(4);r(21)("isExtensible",(function(t){return function(n){return!!e(n)&&(!t||t(n))}}))},function(t,n,r){var e=r(0);e(e.S+e.F,"Object",{assign:r(93)})},function(t,n,r){var e=r(0);e(e.S,"Object",{is:r(94)})},function(t,n,r){var e=r(0);e(e.S,"Object",{setPrototypeOf:r(65).set})},function(t,n,r){"use strict";var e=r(46),i={};i[r(5)("toStringTag")]="z",i+""!="[object z]"&&r(11)(Object.prototype,"toString",(function(){return"[object "+e(this)+"]"}),!0)},function(t,n,r){var e=r(0);e(e.P,"Function",{bind:r(95)})},function(t,n,r){var e=r(9).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||r(8)&&e(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},function(t,n,r){"use strict";var e=r(4),i=r(35),o=r(5)("hasInstance"),u=Function.prototype;o in u||r(9).f(u,o,{value:function(t){if("function"!=typeof this||!e(t))return!1;if(!e(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},function(t,n,r){var e=r(0),i=r(97);e(e.G+e.F*(parseInt!=i),{parseInt:i})},function(t,n,r){var e=r(0),i=r(98);e(e.G+e.F*(parseFloat!=i),{parseFloat:i})},function(t,n,r){"use strict";var e=r(1),i=r(13),o=r(23),u=r(67),c=r(26),a=r(2),f=r(34).f,s=r(20).f,l=r(9).f,h=r(39).trim,p=e.Number,v=p,d=p.prototype,y="Number"==o(r(33)(d)),g="trim"in String.prototype,x=function(t){var n=c(t,!1);if("string"==typeof n&&n.length>2){var r,e,i,o=(n=g?n.trim():h(n,3)).charCodeAt(0);if(43===o||45===o){if(88===(r=n.charCodeAt(2))||120===r)return NaN}else if(48===o){switch(n.charCodeAt(1)){case 66:case 98:e=2,i=49;break;case 79:case 111:e=8,i=55;break;default:return+n}for(var u,a=n.slice(2),f=0,s=a.length;f<s;f++)if((u=a.charCodeAt(f))<48||u>i)return NaN;return parseInt(a,e)}}return+n};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var n=arguments.length<1?0:t,r=this;return r instanceof p&&(y?a((function(){d.valueOf.call(r)})):"Number"!=o(r))?u(new v(x(n)),r,p):x(n)};for(var b,m=r(8)?f(v):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),w=0;m.length>w;w++)i(v,b=m[w])&&!i(p,b)&&l(p,b,s(v,b));p.prototype=d,d.constructor=p,r(11)(e,"Number",p)}},function(t,n,r){"use strict";var e=r(0),i=r(19),o=r(99),u=r(68),c=1..toFixed,a=Math.floor,f=[0,0,0,0,0,0],s="Number.toFixed: incorrect invocation!",l=function(t,n){for(var r=-1,e=n;++r<6;)e+=t*f[r],f[r]=e%1e7,e=a(e/1e7)},h=function(t){for(var n=6,r=0;--n>=0;)r+=f[n],f[n]=a(r/t),r=r%t*1e7},p=function(){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==f[t]){var r=String(f[t]);n=""===n?r:n+u.call("0",7-r.length)+r}return n},v=function(t,n,r){return 0===n?r:n%2==1?v(t,n-1,r*t):v(t*t,n/2,r)};e(e.P+e.F*(!!c&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!r(2)((function(){c.call({})}))),"Number",{toFixed:function(t){var n,r,e,c,a=o(this,s),f=i(t),d="",y="0";if(f<0||f>20)throw RangeError(s);if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(a);if(a<0&&(d="-",a=-a),a>1e-21)if(r=(n=function(t){for(var n=0,r=t;r>=4096;)n+=12,r/=4096;for(;r>=2;)n+=1,r/=2;return n}(a*v(2,69,1))-69)<0?a*v(2,-n,1):a/v(2,n,1),r*=4503599627370496,(n=52-n)>0){for(l(0,r),e=f;e>=7;)l(1e7,0),e-=7;for(l(v(10,e,1),0),e=n-1;e>=23;)h(1<<23),e-=23;h(1<<e),l(1,1),h(2),y=p()}else l(0,r),l(1<<-n,0),y=p()+u.call("0",f);return f>0?d+((c=y.length)<=f?"0."+u.call("0",f-c)+y:y.slice(0,c-f)+"."+y.slice(c-f)):d+y}})},function(t,n,r){"use strict";var e=r(0),i=r(2),o=r(99),u=1..toPrecision;e(e.P+e.F*(i((function(){return"1"!==u.call(1,void 0)}))||!i((function(){u.call({})}))),"Number",{toPrecision:function(t){var n=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?u.call(n):u.call(n,t)}})},function(t,n,r){var e=r(0);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,n,r){var e=r(0),i=r(1).isFinite;e(e.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},function(t,n,r){var e=r(0);e(e.S,"Number",{isInteger:r(100)})},function(t,n,r){var e=r(0);e(e.S,"Number",{isNaN:function(t){return t!=t}})},function(t,n,r){var e=r(0),i=r(100),o=Math.abs;e(e.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},function(t,n,r){var e=r(0);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,n,r){var e=r(0);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,n,r){var e=r(0),i=r(98);e(e.S+e.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},function(t,n,r){var e=r(0),i=r(97);e(e.S+e.F*(Number.parseInt!=i),"Number",{parseInt:i})},function(t,n,r){var e=r(0),i=r(101),o=Math.sqrt,u=Math.acosh;e(e.S+e.F*!(u&&710==Math.floor(u(Number.MAX_VALUE))&&u(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},function(t,n,r){var e=r(0),i=Math.asinh;e(e.S+e.F*!(i&&1/i(0)>0),"Math",{asinh:function t(n){return isFinite(n=+n)&&0!=n?n<0?-t(-n):Math.log(n+Math.sqrt(n*n+1)):n}})},function(t,n,r){var e=r(0),i=Math.atanh;e(e.S+e.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,n,r){var e=r(0),i=r(69);e(e.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,n,r){var e=r(0);e(e.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,n,r){var e=r(0),i=Math.exp;e(e.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},function(t,n,r){var e=r(0),i=r(70);e(e.S+e.F*(i!=Math.expm1),"Math",{expm1:i})},function(t,n,r){var e=r(0);e(e.S,"Math",{fround:r(170)})},function(t,n,r){var e=r(69),i=Math.pow,o=i(2,-52),u=i(2,-23),c=i(2,127)*(2-u),a=i(2,-126);t.exports=Math.fround||function(t){var n,r,i=Math.abs(t),f=e(t);return i<a?f*(i/a/u+1/o-1/o)*a*u:(r=(n=(1+u/o)*i)-(n-i))>c||r!=r?f*(1/0):f*r}},function(t,n,r){var e=r(0),i=Math.abs;e(e.S,"Math",{hypot:function(t,n){for(var r,e,o=0,u=0,c=arguments.length,a=0;u<c;)a<(r=i(arguments[u++]))?(o=o*(e=a/r)*e+1,a=r):o+=r>0?(e=r/a)*e:r;return a===1/0?1/0:a*Math.sqrt(o)}})},function(t,n,r){var e=r(0),i=Math.imul;e(e.S+e.F*r(2)((function(){return-5!=i(4294967295,5)||2!=i.length})),"Math",{imul:function(t,n){var r=+t,e=+n,i=65535&r,o=65535&e;return 0|i*o+((65535&r>>>16)*o+i*(65535&e>>>16)<<16>>>0)}})},function(t,n,r){var e=r(0);e(e.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,n,r){var e=r(0);e(e.S,"Math",{log1p:r(101)})},function(t,n,r){var e=r(0);e(e.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,n,r){var e=r(0);e(e.S,"Math",{sign:r(69)})},function(t,n,r){var e=r(0),i=r(70),o=Math.exp;e(e.S+e.F*r(2)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},function(t,n,r){var e=r(0),i=r(70),o=Math.exp;e(e.S,"Math",{tanh:function(t){var n=i(t=+t),r=i(-t);return n==1/0?1:r==1/0?-1:(n-r)/(o(t)+o(-t))}})},function(t,n,r){var e=r(0);e(e.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,n,r){var e=r(0),i=r(32),o=String.fromCharCode,u=String.fromCodePoint;e(e.S+e.F*(!!u&&1!=u.length),"String",{fromCodePoint:function(t){for(var n,r=[],e=arguments.length,u=0;e>u;){if(n=+arguments[u++],i(n,1114111)!==n)throw RangeError(n+" is not a valid code point");r.push(n<65536?o(n):o(55296+((n-=65536)>>10),n%1024+56320))}return r.join("")}})},function(t,n,r){var e=r(0),i=r(15),o=r(6);e(e.S,"String",{raw:function(t){for(var n=i(t.raw),r=o(n.length),e=arguments.length,u=[],c=0;r>c;)u.push(String(n[c++])),c<e&&u.push(String(arguments[c]));return u.join("")}})},function(t,n,r){"use strict";r(39)("trim",(function(t){return function(){return t(this,3)}}))},function(t,n,r){"use strict";var e=r(71)(!0);r(72)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})}))},function(t,n,r){"use strict";var e=r(0),i=r(71)(!1);e(e.P,"String",{codePointAt:function(t){return i(this,t)}})},function(t,n,r){"use strict";var e=r(0),i=r(6),o=r(73),u="".endsWith;e(e.P+e.F*r(75)("endsWith"),"String",{endsWith:function(t){var n=o(this,t,"endsWith"),r=arguments.length>1?arguments[1]:void 0,e=i(n.length),c=void 0===r?e:Math.min(i(r),e),a=String(t);return u?u.call(n,a,c):n.slice(c-a.length,c)===a}})},function(t,n,r){"use strict";var e=r(0),i=r(73);e(e.P+e.F*r(75)("includes"),"String",{includes:function(t){return!!~i(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,n,r){var e=r(0);e(e.P,"String",{repeat:r(68)})},function(t,n,r){"use strict";var e=r(0),i=r(6),o=r(73),u="".startsWith;e(e.P+e.F*r(75)("startsWith"),"String",{startsWith:function(t){var n=o(this,t,"startsWith"),r=i(Math.min(arguments.length>1?arguments[1]:void 0,n.length)),e=String(t);return u?u.call(n,e,r):n.slice(r,r+e.length)===e}})},function(t,n,r){"use strict";r(12)("anchor",(function(t){return function(n){return t(this,"a","name",n)}}))},function(t,n,r){"use strict";r(12)("big",(function(t){return function(){return t(this,"big","","")}}))},function(t,n,r){"use strict";r(12)("blink",(function(t){return function(){return t(this,"blink","","")}}))},function(t,n,r){"use strict";r(12)("bold",(function(t){return function(){return t(this,"b","","")}}))},function(t,n,r){"use strict";r(12)("fixed",(function(t){return function(){return t(this,"tt","","")}}))},function(t,n,r){"use strict";r(12)("fontcolor",(function(t){return function(n){return t(this,"font","color",n)}}))},function(t,n,r){"use strict";r(12)("fontsize",(function(t){return function(n){return t(this,"font","size",n)}}))},function(t,n,r){"use strict";r(12)("italics",(function(t){return function(){return t(this,"i","","")}}))},function(t,n,r){"use strict";r(12)("link",(function(t){return function(n){return t(this,"a","href",n)}}))},function(t,n,r){"use strict";r(12)("small",(function(t){return function(){return t(this,"small","","")}}))},function(t,n,r){"use strict";r(12)("strike",(function(t){return function(){return t(this,"strike","","")}}))},function(t,n,r){"use strict";r(12)("sub",(function(t){return function(){return t(this,"sub","","")}}))},function(t,n,r){"use strict";r(12)("sup",(function(t){return function(){return t(this,"sup","","")}}))},function(t,n,r){var e=r(0);e(e.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,n,r){"use strict";var e=r(0),i=r(10),o=r(26);e(e.P+e.F*r(2)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(t){var n=i(this),r=o(n);return"number"!=typeof r||isFinite(r)?n.toISOString():null}})},function(t,n,r){var e=r(0),i=r(205);e(e.P+e.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},function(t,n,r){"use strict";var e=r(2),i=Date.prototype.getTime,o=Date.prototype.toISOString,u=function(t){return t>9?t:"0"+t};t.exports=e((function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-50000000000001))}))||!e((function(){o.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,n=t.getUTCFullYear(),r=t.getUTCMilliseconds(),e=n<0?"-":n>9999?"+":"";return e+("00000"+Math.abs(n)).slice(e?-6:-4)+"-"+u(t.getUTCMonth()+1)+"-"+u(t.getUTCDate())+"T"+u(t.getUTCHours())+":"+u(t.getUTCMinutes())+":"+u(t.getUTCSeconds())+"."+(r>99?r:"0"+u(r))+"Z"}:o},function(t,n,r){var e=Date.prototype,i=e.toString,o=e.getTime;new Date(NaN)+""!="Invalid Date"&&r(11)(e,"toString",(function(){var t=o.call(this);return t==t?i.call(this):"Invalid Date"}))},function(t,n,r){var e=r(5)("toPrimitive"),i=Date.prototype;e in i||r(14)(i,e,r(208))},function(t,n,r){"use strict";var e=r(3),i=r(26);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return i(e(this),"number"!=t)}},function(t,n,r){var e=r(0);e(e.S,"Array",{isArray:r(51)})},function(t,n,r){"use strict";var e=r(17),i=r(0),o=r(10),u=r(103),c=r(76),a=r(6),f=r(77),s=r(78);i(i.S+i.F*!r(52)((function(t){Array.from(t)})),"Array",{from:function(t){var n,r,i,l,h=o(t),p="function"==typeof this?this:Array,v=arguments.length,d=v>1?arguments[1]:void 0,y=void 0!==d,g=0,x=s(h);if(y&&(d=e(d,v>2?arguments[2]:void 0,2)),null==x||p==Array&&c(x))for(r=new p(n=a(h.length));n>g;g++)f(r,g,y?d(h[g],g):h[g]);else for(l=x.call(h),r=new p;!(i=l.next()).done;g++)f(r,g,y?u(l,d,[i.value,g],!0):i.value);return r.length=g,r}})},function(t,n,r){"use strict";var e=r(0),i=r(77);e(e.S+e.F*r(2)((function(){function t(){}return!(Array.of.call(t)instanceof t)})),"Array",{of:function(){for(var t=0,n=arguments.length,r=new("function"==typeof this?this:Array)(n);n>t;)i(r,t,arguments[t++]);return r.length=n,r}})},function(t,n,r){"use strict";var e=r(0),i=r(15),o=[].join;e(e.P+e.F*(r(44)!=Object||!r(16)(o)),"Array",{join:function(t){return o.call(i(this),void 0===t?",":t)}})},function(t,n,r){"use strict";var e=r(0),i=r(64),o=r(23),u=r(32),c=r(6),a=[].slice;e(e.P+e.F*r(2)((function(){i&&a.call(i)})),"Array",{slice:function(t,n){var r=c(this.length),e=o(this);if(n=void 0===n?r:n,"Array"==e)return a.call(this,t,n);for(var i=u(t,r),f=u(n,r),s=c(f-i),l=new Array(s),h=0;h<s;h++)l[h]="String"==e?this.charAt(i+h):this[i+h];return l}})},function(t,n,r){"use strict";var e=r(0),i=r(18),o=r(10),u=r(2),c=[].sort,a=[1,2,3];e(e.P+e.F*(u((function(){a.sort(void 0)}))||!u((function(){a.sort(null)}))||!r(16)(c)),"Array",{sort:function(t){return void 0===t?c.call(o(this)):c.call(o(this),i(t))}})},function(t,n,r){"use strict";var e=r(0),i=r(22)(0),o=r(16)([].forEach,!0);e(e.P+e.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},function(t,n,r){var e=r(4),i=r(51),o=r(5)("species");t.exports=function(t){var n;return i(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!i(n.prototype)||(n=void 0),e(n)&&null===(n=n[o])&&(n=void 0)),void 0===n?Array:n}},function(t,n,r){"use strict";var e=r(0),i=r(22)(1);e(e.P+e.F*!r(16)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(0),i=r(22)(2);e(e.P+e.F*!r(16)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(0),i=r(22)(3);e(e.P+e.F*!r(16)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(0),i=r(22)(4);e(e.P+e.F*!r(16)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(0),i=r(105);e(e.P+e.F*!r(16)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},function(t,n,r){"use strict";var e=r(0),i=r(105);e(e.P+e.F*!r(16)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},function(t,n,r){"use strict";var e=r(0),i=r(49)(!1),o=[].indexOf,u=!!o&&1/[1].indexOf(1,-0)<0;e(e.P+e.F*(u||!r(16)(o)),"Array",{indexOf:function(t){return u?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,n,r){"use strict";var e=r(0),i=r(15),o=r(19),u=r(6),c=[].lastIndexOf,a=!!c&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(a||!r(16)(c)),"Array",{lastIndexOf:function(t){if(a)return c.apply(this,arguments)||0;var n=i(this),r=u(n.length),e=r-1;for(arguments.length>1&&(e=Math.min(e,o(arguments[1]))),e<0&&(e=r+e);e>=0;e--)if(e in n&&n[e]===t)return e||0;return-1}})},function(t,n,r){var e=r(0);e(e.P,"Array",{copyWithin:r(106)}),r(36)("copyWithin")},function(t,n,r){var e=r(0);e(e.P,"Array",{fill:r(79)}),r(36)("fill")},function(t,n,r){"use strict";var e=r(0),i=r(22)(5),o=!0;"find"in[]&&Array(1).find((function(){o=!1})),e(e.P+e.F*o,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(36)("find")},function(t,n,r){"use strict";var e=r(0),i=r(22)(6),o="findIndex",u=!0;o in[]&&Array(1)[o]((function(){u=!1})),e(e.P+e.F*u,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(36)(o)},function(t,n,r){r(41)("Array")},function(t,n,r){var e=r(1),i=r(67),o=r(9).f,u=r(34).f,c=r(74),a=r(53),f=e.RegExp,s=f,l=f.prototype,h=/a/g,p=/a/g,v=new f(h)!==h;if(r(8)&&(!v||r(2)((function(){return p[r(5)("match")]=!1,f(h)!=h||f(p)==p||"/a/i"!=f(h,"i")})))){f=function(t,n){var r=this instanceof f,e=c(t),o=void 0===n;return!r&&e&&t.constructor===f&&o?t:i(v?new s(e&&!o?t.source:t,n):s((e=t instanceof f)?t.source:t,e&&o?a.call(t):n),r?this:l,f)};for(var d=function(t){t in f||o(f,t,{configurable:!0,get:function(){return s[t]},set:function(n){s[t]=n}})},y=u(s),g=0;y.length>g;)d(y[g++]);l.constructor=f,f.prototype=l,r(11)(e,"RegExp",f)}r(41)("RegExp")},function(t,n,r){"use strict";r(109);var e=r(3),i=r(53),o=r(8),u=/./.toString,c=function(t){r(11)(RegExp.prototype,"toString",t,!0)};r(2)((function(){return"/a/b"!=u.call({source:"a",flags:"b"})}))?c((function(){var t=e(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)})):"toString"!=u.name&&c((function(){return u.call(this)}))},function(t,n,r){"use strict";var e=r(3),i=r(6),o=r(82),u=r(54);r(55)("match",1,(function(t,n,r,c){return[function(r){var e=t(this),i=null==r?void 0:r[n];return void 0!==i?i.call(r,e):new RegExp(r)[n](String(e))},function(t){var n=c(r,t,this);if(n.done)return n.value;var a=e(t),f=String(this);if(!a.global)return u(a,f);var s=a.unicode;a.lastIndex=0;for(var l,h=[],p=0;null!==(l=u(a,f));){var v=String(l[0]);h[p]=v,""===v&&(a.lastIndex=o(f,i(a.lastIndex),s)),p++}return 0===p?null:h}]}))},function(t,n,r){"use strict";var e=r(3),i=r(10),o=r(6),u=r(19),c=r(82),a=r(54),f=Math.max,s=Math.min,l=Math.floor,h=/\$([$&`']|\d\d?|<[^>]*>)/g,p=/\$([$&`']|\d\d?)/g;r(55)("replace",2,(function(t,n,r,v){return[function(e,i){var o=t(this),u=null==e?void 0:e[n];return void 0!==u?u.call(e,o,i):r.call(String(o),e,i)},function(t,n){var i=v(r,t,this,n);if(i.done)return i.value;var l=e(t),h=String(this),p="function"==typeof n;p||(n=String(n));var y=l.global;if(y){var g=l.unicode;l.lastIndex=0}for(var x=[];;){var b=a(l,h);if(null===b)break;if(x.push(b),!y)break;""===String(b[0])&&(l.lastIndex=c(h,o(l.lastIndex),g))}for(var m,w="",S=0,_=0;_<x.length;_++){b=x[_];for(var O=String(b[0]),E=f(s(u(b.index),h.length),0),P=[],F=1;F<b.length;F++)P.push(void 0===(m=b[F])?m:String(m));var M=b.groups;if(p){var j=[O].concat(P,E,h);void 0!==M&&j.push(M);var A=String(n.apply(void 0,j))}else A=d(O,h,E,P,M,n);E>=S&&(w+=h.slice(S,E)+A,S=E+O.length)}return w+h.slice(S)}];function d(t,n,e,o,u,c){var a=e+t.length,f=o.length,s=p;return void 0!==u&&(u=i(u),s=h),r.call(c,s,(function(r,i){var c;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,e);case"'":return n.slice(a);case"<":c=u[i.slice(1,-1)];break;default:var s=+i;if(0===s)return r;if(s>f){var h=l(s/10);return 0===h?r:h<=f?void 0===o[h-1]?i.charAt(1):o[h-1]+i.charAt(1):r}c=o[s-1]}return void 0===c?"":c}))}}))},function(t,n,r){"use strict";var e=r(3),i=r(94),o=r(54);r(55)("search",1,(function(t,n,r,u){return[function(r){var e=t(this),i=null==r?void 0:r[n];return void 0!==i?i.call(r,e):new RegExp(r)[n](String(e))},function(t){var n=u(r,t,this);if(n.done)return n.value;var c=e(t),a=String(this),f=c.lastIndex;i(f,0)||(c.lastIndex=0);var s=o(c,a);return i(c.lastIndex,f)||(c.lastIndex=f),null===s?-1:s.index}]}))},function(t,n,r){"use strict";var e=r(74),i=r(3),o=r(47),u=r(82),c=r(6),a=r(54),f=r(81),s=r(2),l=Math.min,h=[].push,p="length",v=!s((function(){RegExp(4294967295,"y")}));r(55)("split",2,(function(t,n,r,s){var d;return d="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[p]||2!="ab".split(/(?:ab)*/)[p]||4!=".".split(/(.?)(.?)/)[p]||".".split(/()()/)[p]>1||"".split(/.?/)[p]?function(t,n){var i=String(this);if(void 0===t&&0===n)return[];if(!e(t))return r.call(i,t,n);for(var o,u,c,a=[],s=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,v=void 0===n?4294967295:n>>>0,d=new RegExp(t.source,s+"g");(o=f.call(d,i))&&!((u=d.lastIndex)>l&&(a.push(i.slice(l,o.index)),o[p]>1&&o.index<i[p]&&h.apply(a,o.slice(1)),c=o[0][p],l=u,a[p]>=v));)d.lastIndex===o.index&&d.lastIndex++;return l===i[p]?!c&&d.test("")||a.push(""):a.push(i.slice(l)),a[p]>v?a.slice(0,v):a}:"0".split(void 0,0)[p]?function(t,n){return void 0===t&&0===n?[]:r.call(this,t,n)}:r,[function(r,e){var i=t(this),o=null==r?void 0:r[n];return void 0!==o?o.call(r,i,e):d.call(String(i),r,e)},function(t,n){var e=s(d,t,this,n,d!==r);if(e.done)return e.value;var f=i(t),h=String(this),p=o(f,RegExp),y=f.unicode,g=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(v?"y":"g"),x=new p(v?f:"^(?:"+f.source+")",g),b=void 0===n?4294967295:n>>>0;if(0===b)return[];if(0===h.length)return null===a(x,h)?[h]:[];for(var m=0,w=0,S=[];w<h.length;){x.lastIndex=v?w:0;var _,O=a(x,v?h:h.slice(w));if(null===O||(_=l(c(x.lastIndex+(v?0:w)),h.length))===m)w=u(h,w,y);else{if(S.push(h.slice(m,w)),S.length===b)return S;for(var E=1;E<=O.length-1;E++)if(S.push(O[E]),S.length===b)return S;w=m=_}}return S.push(h.slice(m)),S}]}))},function(t,n,r){var e=r(1),i=r(83).set,o=e.MutationObserver||e.WebKitMutationObserver,u=e.process,c=e.Promise,a="process"==r(23)(u);t.exports=function(){var t,n,r,f=function(){var e,i;for(a&&(e=u.domain)&&e.exit();t;){i=t.fn,t=t.next;try{i()}catch(e){throw t?r():n=void 0,e}}n=void 0,e&&e.enter()};if(a)r=function(){u.nextTick(f)};else if(!o||e.navigator&&e.navigator.standalone)if(c&&c.resolve){var s=c.resolve(void 0);r=function(){s.then(f)}}else r=function(){i.call(e,f)};else{var l=!0,h=document.createTextNode("");new o(f).observe(h,{characterData:!0}),r=function(){h.data=l=!l}}return function(e){var i={fn:e,next:void 0};n&&(n.next=i),t||(t=i,r()),n=i}}},function(t,n){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,n,r){"use strict";var e=r(113),i=r(37);t.exports=r(58)("Map",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(t){var n=e.getEntry(i(this,"Map"),t);return n&&n.v},set:function(t,n){return e.def(i(this,"Map"),0===t?0:t,n)}},e,!0)},function(t,n,r){"use strict";var e=r(113),i=r(37);t.exports=r(58)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return e.def(i(this,"Set"),t=0===t?0:t,t)}},e)},function(t,n,r){"use strict";var e,i=r(1),o=r(22)(0),u=r(11),c=r(27),a=r(93),f=r(114),s=r(4),l=r(37),h=r(37),p=!i.ActiveXObject&&"ActiveXObject"in i,v=c.getWeak,d=Object.isExtensible,y=f.ufstore,g=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},x={get:function(t){if(s(t)){var n=v(t);return!0===n?y(l(this,"WeakMap")).get(t):n?n[this._i]:void 0}},set:function(t,n){return f.def(l(this,"WeakMap"),t,n)}},b=t.exports=r(58)("WeakMap",g,x,f,!0,!0);h&&p&&(a((e=f.getConstructor(g,"WeakMap")).prototype,x),c.NEED=!0,o(["delete","has","get","set"],(function(t){var n=b.prototype,r=n[t];u(n,t,(function(n,i){if(s(n)&&!d(n)){this._f||(this._f=new e);var o=this._f[t](n,i);return"set"==t?this:o}return r.call(this,n,i)}))})))},function(t,n,r){"use strict";var e=r(114),i=r(37);r(58)("WeakSet",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return e.def(i(this,"WeakSet"),t,!0)}},e,!1,!0)},function(t,n,r){"use strict";var e=r(0),i=r(59),o=r(84),u=r(3),c=r(32),a=r(6),f=r(4),s=r(1).ArrayBuffer,l=r(47),h=o.ArrayBuffer,p=o.DataView,v=i.ABV&&s.isView,d=h.prototype.slice,y=i.VIEW;e(e.G+e.W+e.F*(s!==h),{ArrayBuffer:h}),e(e.S+e.F*!i.CONSTR,"ArrayBuffer",{isView:function(t){return v&&v(t)||f(t)&&y in t}}),e(e.P+e.U+e.F*r(2)((function(){return!new h(2).slice(1,void 0).byteLength})),"ArrayBuffer",{slice:function(t,n){if(void 0!==d&&void 0===n)return d.call(u(this),t);for(var r=u(this).byteLength,e=c(t,r),i=c(void 0===n?r:n,r),o=new(l(this,h))(a(i-e)),f=new p(this),s=new p(o),v=0;e<i;)s.setUint8(v++,f.getUint8(e++));return o}}),r(41)("ArrayBuffer")},function(t,n,r){var e=r(0);e(e.G+e.W+e.F*!r(59).ABV,{DataView:r(84).DataView})},function(t,n,r){r(25)("Int8",1,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Uint8",1,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Uint8",1,(function(t){return function(n,r,e){return t(this,n,r,e)}}),!0)},function(t,n,r){r(25)("Int16",2,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Uint16",2,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Int32",4,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Uint32",4,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Float32",4,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){r(25)("Float64",8,(function(t){return function(n,r,e){return t(this,n,r,e)}}))},function(t,n,r){var e=r(0),i=r(18),o=r(3),u=(r(1).Reflect||{}).apply,c=Function.apply;e(e.S+e.F*!r(2)((function(){u((function(){}))})),"Reflect",{apply:function(t,n,r){var e=i(t),a=o(r);return u?u(e,n,a):c.call(e,n,a)}})},function(t,n,r){var e=r(0),i=r(33),o=r(18),u=r(3),c=r(4),a=r(2),f=r(95),s=(r(1).Reflect||{}).construct,l=a((function(){function t(){}return!(s((function(){}),[],t)instanceof t)})),h=!a((function(){s((function(){}))}));e(e.S+e.F*(l||h),"Reflect",{construct:function(t,n){o(t),u(n);var r=arguments.length<3?t:o(arguments[2]);if(h&&!l)return s(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(f.apply(t,e))}var a=r.prototype,p=i(c(a)?a:Object.prototype),v=Function.apply.call(t,p,n);return c(v)?v:p}})},function(t,n,r){var e=r(9),i=r(0),o=r(3),u=r(26);i(i.S+i.F*r(2)((function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(t,n,r){o(t),n=u(n,!0),o(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},function(t,n,r){var e=r(0),i=r(20).f,o=r(3);e(e.S,"Reflect",{deleteProperty:function(t,n){var r=i(o(t),n);return!(r&&!r.configurable)&&delete t[n]}})},function(t,n,r){"use strict";var e=r(0),i=r(3),o=function(t){this._t=i(t),this._i=0;var n,r=this._k=[];for(n in t)r.push(n)};r(102)(o,"Object",(function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}})),e(e.S,"Reflect",{enumerate:function(t){return new o(t)}})},function(t,n,r){var e=r(20),i=r(35),o=r(13),u=r(0),c=r(4),a=r(3);u(u.S,"Reflect",{get:function t(n,r){var u,f,s=arguments.length<3?n:arguments[2];return a(n)===s?n[r]:(u=e.f(n,r))?o(u,"value")?u.value:void 0!==u.get?u.get.call(s):void 0:c(f=i(n))?t(f,r,s):void 0}})},function(t,n,r){var e=r(20),i=r(0),o=r(3);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,n){return e.f(o(t),n)}})},function(t,n,r){var e=r(0),i=r(35),o=r(3);e(e.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},function(t,n,r){var e=r(0);e(e.S,"Reflect",{has:function(t,n){return n in t}})},function(t,n,r){var e=r(0),i=r(3),o=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},function(t,n,r){var e=r(0);e(e.S,"Reflect",{ownKeys:r(116)})},function(t,n,r){var e=r(0),i=r(3),o=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},function(t,n,r){var e=r(9),i=r(20),o=r(35),u=r(13),c=r(0),a=r(28),f=r(3),s=r(4);c(c.S,"Reflect",{set:function t(n,r,c){var l,h,p=arguments.length<4?n:arguments[3],v=i.f(f(n),r);if(!v){if(s(h=o(n)))return t(h,r,c,p);v=a(0)}if(u(v,"value")){if(!1===v.writable||!s(p))return!1;if(l=i.f(p,r)){if(l.get||l.set||!1===l.writable)return!1;l.value=c,e.f(p,r,l)}else e.f(p,r,a(0,c));return!0}return void 0!==v.set&&(v.set.call(p,c),!0)}})},function(t,n,r){var e=r(0),i=r(65);i&&e(e.S,"Reflect",{setPrototypeOf:function(t,n){i.check(t,n);try{return i.set(t,n),!0}catch(t){return!1}}})},function(t,n,r){r(268),t.exports=r(7).Array.includes},function(t,n,r){"use strict";var e=r(0),i=r(49)(!0);e(e.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(36)("includes")},function(t,n,r){r(270),t.exports=r(7).Array.flatMap},function(t,n,r){"use strict";var e=r(0),i=r(271),o=r(10),u=r(6),c=r(18),a=r(104);e(e.P,"Array",{flatMap:function(t){var n,r,e=o(this);return c(t),n=u(e.length),r=a(e,0),i(r,e,e,n,0,1,t,arguments[1]),r}}),r(36)("flatMap")},function(t,n,r){"use strict";var e=r(51),i=r(4),o=r(6),u=r(17),c=r(5)("isConcatSpreadable");t.exports=function t(n,r,a,f,s,l,h,p){for(var v,d,y=s,g=0,x=!!h&&u(h,p,3);g<f;){if(g in a){if(v=x?x(a[g],g,r):a[g],d=!1,i(v)&&(d=void 0!==(d=v[c])?!!d:e(v)),d&&l>0)y=t(n,r,v,o(v.length),y,l-1)-1;else{if(y>=9007199254740991)throw TypeError();n[y]=v}y++}g++}return y}},function(t,n,r){r(273),t.exports=r(7).String.padStart},function(t,n,r){"use strict";var e=r(0),i=r(117),o=r(57),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,n,r){r(275),t.exports=r(7).String.padEnd},function(t,n,r){"use strict";var e=r(0),i=r(117),o=r(57),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,n,r){r(277),t.exports=r(7).String.trimLeft},function(t,n,r){"use strict";r(39)("trimLeft",(function(t){return function(){return t(this,1)}}),"trimStart")},function(t,n,r){r(279),t.exports=r(7).String.trimRight},function(t,n,r){"use strict";r(39)("trimRight",(function(t){return function(){return t(this,2)}}),"trimEnd")},function(t,n,r){r(281),t.exports=r(61).f("asyncIterator")},function(t,n,r){r(89)("asyncIterator")},function(t,n,r){r(283),t.exports=r(7).Object.getOwnPropertyDescriptors},function(t,n,r){var e=r(0),i=r(116),o=r(15),u=r(20),c=r(77);e(e.S,"Object",{getOwnPropertyDescriptors:function(t){for(var n,r,e=o(t),a=u.f,f=i(e),s={},l=0;f.length>l;)void 0!==(r=a(e,n=f[l++]))&&c(s,n,r);return s}})},function(t,n,r){r(285),t.exports=r(7).Object.values},function(t,n,r){var e=r(0),i=r(118)(!1);e(e.S,"Object",{values:function(t){return i(t)}})},function(t,n,r){r(287),t.exports=r(7).Object.entries},function(t,n,r){var e=r(0),i=r(118)(!0);e(e.S,"Object",{entries:function(t){return i(t)}})},function(t,n,r){"use strict";r(110),r(289),t.exports=r(7).Promise.finally},function(t,n,r){"use strict";var e=r(0),i=r(7),o=r(1),u=r(47),c=r(112);e(e.P+e.R,"Promise",{finally:function(t){var n=u(this,i.Promise||o.Promise),r="function"==typeof t;return this.then(r?function(r){return c(n,t()).then((function(){return r}))}:t,r?function(r){return c(n,t()).then((function(){throw r}))}:t)}})},function(t,n,r){r(291),r(292),r(293),t.exports=r(7)},function(t,n,r){var e=r(1),i=r(0),o=r(57),u=[].slice,c=/MSIE .\./.test(o),a=function(t){return function(n,r){var e=arguments.length>2,i=!!e&&u.call(arguments,2);return t(e?function(){("function"==typeof n?n:Function(n)).apply(this,i)}:n,r)}};i(i.G+i.B+i.F*c,{setTimeout:a(e.setTimeout),setInterval:a(e.setInterval)})},function(t,n,r){var e=r(0),i=r(83);e(e.G+e.B,{setImmediate:i.set,clearImmediate:i.clear})},function(t,n,r){for(var e=r(80),i=r(31),o=r(11),u=r(1),c=r(14),a=r(40),f=r(5),s=f("iterator"),l=f("toStringTag"),h=a.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},v=i(p),d=0;d<v.length;d++){var y,g=v[d],x=p[g],b=u[g],m=b&&b.prototype;if(m&&(m[s]||c(m,s,h),m[l]||c(m,l,g),a[g]=h,x))for(y in e)m[y]||o(m,y,e[y],!0)}},function(t,n,r){var e=function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},i=e.iterator||"@@iterator",o=e.asyncIterator||"@@asyncIterator",u=e.toStringTag||"@@toStringTag";function c(t,n,r,e){var i=n&&n.prototype instanceof s?n:s,o=Object.create(i.prototype),u=new S(e||[]);return o._invoke=function(t,n,r){var e="suspendedStart";return function(i,o){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var c=b(u,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===e)throw e="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);e="executing";var s=a(t,n,r);if("normal"===s.type){if(e=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(e="completed",r.method="throw",r.arg=s.arg)}}}(t,r,u),o}function a(t,n,r){try{return{type:"normal",arg:t.call(n,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function s(){}function l(){}function h(){}var p={};p[i]=function(){return this};var v=Object.getPrototypeOf,d=v&&v(v(_([])));d&&d!==n&&r.call(d,i)&&(p=d);var y=h.prototype=s.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(n){t[n]=function(t){return this._invoke(n,t)}}))}function x(t,n){var e;this._invoke=function(i,o){function u(){return new n((function(e,u){!function e(i,o,u,c){var f=a(t[i],t,o);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?n.resolve(l.__await).then((function(t){e("next",t,u,c)}),(function(t){e("throw",t,u,c)})):n.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return e("throw",t,u,c)}))}c(f.arg)}(i,o,e,u)}))}return e=e?e.then(u,u):u()}}function b(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,b(t,n),"throw"===n.method))return f;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var e=a(r,t.iterator,n.arg);if("throw"===e.type)return n.method="throw",n.arg=e.arg,n.delegate=null,f;var i=e.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,f):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}function m(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function w(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function _(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,o=function n(){for(;++e<t.length;)if(r.call(t,e))return n.value=t[e],n.done=!1,n;return n.value=void 0,n.done=!0,n};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return l.prototype=y.constructor=h,h.constructor=l,h[u]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===l||"GeneratorFunction"===(n.displayName||n.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(x.prototype),x.prototype[o]=function(){return this},t.AsyncIterator=x,t.async=function(n,r,e,i,o){void 0===o&&(o=Promise);var u=new x(c(n,r,e,i),o);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},g(y),y[u]="Generator",y[i]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var n=[];for(var r in t)n.push(r);return n.reverse(),function r(){for(;n.length;){var e=n.pop();if(e in t)return r.value=e,r.done=!1,r}return r.done=!0,r}},t.values=_,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function e(r,e){return u.type="throw",u.arg=t,n.next=r,e&&(n.method="next",n.arg=void 0),!!e}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),a=r.call(o,"finallyLoc");if(c&&a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=n&&n<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=n,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(u)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),f},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc===t){var e=r.completion;if("throw"===e.type){var i=e.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},function(t,n,r){r(296),t.exports=r(119).global},function(t,n,r){var e=r(297);e(e.G,{global:r(85)})},function(t,n,r){var e=r(85),i=r(119),o=r(298),u=r(300),c=r(307),a=function(t,n,r){var f,s,l,h=t&a.F,p=t&a.G,v=t&a.S,d=t&a.P,y=t&a.B,g=t&a.W,x=p?i:i[n]||(i[n]={}),b=x.prototype,m=p?e:v?e[n]:(e[n]||{}).prototype;for(f in p&&(r=n),r)(s=!h&&m&&void 0!==m[f])&&c(x,f)||(l=s?m[f]:r[f],x[f]=p&&"function"!=typeof m[f]?r[f]:y&&s?o(l,e):g&&m[f]==l?function(t){var n=function(n,r,e){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,r)}return new t(n,r,e)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(l):d&&"function"==typeof l?o(Function.call,l):l,d&&((x.virtual||(x.virtual={}))[f]=l,t&a.R&&b&&!b[f]&&u(b,f,l)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n,r){var e=r(299);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,i){return t.call(n,r,e,i)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(301),i=r(306);t.exports=r(87)?function(t,n,r){return e.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(302),i=r(303),o=r(305),u=Object.defineProperty;n.f=r(87)?Object.defineProperty:function(t,n,r){if(e(t),n=o(n,!0),e(r),i)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(86);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n,r){t.exports=!r(87)&&!r(120)((function(){return 7!=Object.defineProperty(r(304)("div"),"a",{get:function(){return 7}}).a}))},function(t,n,r){var e=r(86),i=r(85).document,o=e(i)&&e(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,n,r){var e=r(86);t.exports=function(t,n){if(!e(t))return t;var r,i;if(n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!e(i=r.call(t)))return i;if(!n&&"function"==typeof(r=t.toString)&&!e(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){"use strict";function e(t,n,r,e,i,o,u){try{var c=t[o](u),a=c.value}catch(t){return void r(t)}c.done?n(a):Promise.resolve(a).then(e,i)}function i(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var u=t.apply(n,r);function c(t){e(u,i,o,c,a,"next",t)}function a(t){e(u,i,o,c,a,"throw",t)}c(void 0)}))}}function o(){return u.apply(this,arguments)}function u(){return(u=i(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){window.navigator.geolocation.getCurrentPosition((function(n){t({latitude:n.coords.latitude,longitude:n.coords.longitude})}),(function(){n({latitude:null,longitude:null})}),{enableHighAccuracy:!0,timeout:6e4})})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}r.r(n);var c=[],a=null,f=function(){c.forEach((function(t){s(t)})),c=[],a=null},s=function(t){var n=t.eventAction,r=t.eventPriority,e=t.eventBody,i=new XMLHttpRequest,o="?sysparm_event_action=".concat(n,"&sysparm_event_priority=").concat(r);i.open("POST","/api/now/analytics/events"+o),i.setRequestHeader("Content-Type","application/json"),window.g_ck&&i.setRequestHeader("X-UserToken",g_ck),i.send(JSON.stringify(e))};function l(t,n,r,e,i,o,u){try{var c=t[o](u),a=c.value}catch(t){return void r(t)}c.done?n(a):Promise.resolve(a).then(e,i)}function h(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function p(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?h(Object(r),!0).forEach((function(n){v(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}function v(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var d={_location:{},priority:{INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},postContextProperty:function(t,n){var r=new XMLHttpRequest,e={sys_context_property_name:t,sys_context_property_value:n};r.open("POST","/api/now/analytics/updateContext"),r.setRequestHeader("Content-Type","application/json"),window.g_ck&&r.setRequestHeader("X-UserToken",g_ck),r.send(JSON.stringify(e))},trackEvent:function(t,n,r){var e;!function(t){if(c.push(t),100===c.length)f();else{if(a)return;a=setTimeout((function(){f()}),3e3)}}({eventAction:t,eventPriority:n,eventBody:p({},r,{},(e=this._location,{userSessionId:window.NOW&&window.NOW.session_id?window.NOW.session_id:"",userLanguage:window.NOW&&window.NOW.language&&""!=window.NOW.language?window.NOW.language:"",browserInfo:window.navigator.userAgent,latitude:e.hasOwnProperty("latitude")?e.latitude:null,longitude:e.hasOwnProperty("longitude")?e.longitude:null}))})},init:function(){var t,n=this;return(t=regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,o();case 3:n._location=t.sent,n._location.hasOwnProperty("latitude")&&n.postContextProperty("latitude",n._location.latitude),n._location.hasOwnProperty("longitude")&&n.postContextProperty("longitude",n._location.longitude),t.next=10;break;case 8:t.prev=8,t.t0=t.catch(0);case 10:case"end":return t.stop()}}),t,null,[[0,8]])})),function(){var n=this,r=arguments;return new Promise((function(e,i){var o=t.apply(n,r);function u(t){l(o,e,i,u,c,"next",t)}function c(t){l(o,e,i,u,c,"throw",t)}u(void 0)}))})()}};n.default=d}])},function(t,n,r){"use strict";r.r(n);var e=r(0),i=r.n(e);window.GlideSignals=window.GlideSignals||i.a}]);
/*! RESOURCE: /scripts/lib/tabbable/tabbable.js */
(function() {
window.tabbable = function(el, selectorList) {
var basicTabbables = [];
var orderedTabbables = [];
var isHidden = createIsHidden();
var candidates = el.querySelectorAll(selectorList || 'input, select, a[href], textarea, button, [tabindex], [contenteditable]:not([contenteditable="false"])');
var candidate, candidateIndex;
for (var i = 0, l = candidates.length; i < l; i++) {
candidate = candidates[i];
candidateIndex = getTabindex(candidate);
if (
candidateIndex < 0
|| (candidate.tagName === 'INPUT' && candidate.type === 'hidden')
|| candidate.disabled
|| isHidden(candidate)
) {
continue;
}
if (candidateIndex === 0) {
basicTabbables.push(candidate);
} else {
orderedTabbables.push({
tabIndex: candidateIndex,
node: candidate,
});
}
}
var tabbableNodes = orderedTabbables
.sort(function(a, b) {
return a.tabIndex - b.tabIndex;
})
.map(function(a) {
return a.node
});
Array.prototype.push.apply(tabbableNodes, basicTabbables);
return tabbableNodes;
}
function isContentEditable(node) {
return node.contentEditable === "true";
}
function getTabindex(node) {
var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
if (!isNaN(tabindexAttr)) return tabindexAttr;
if (isContentEditable(node)) return 0;
return node.tabIndex;
}
function createIsHidden() {
var nodeCache = [];
return function isHidden(node) {
if (node === document.documentElement || !node.tagName) return false;
for (var i = 0, length = nodeCache.length; i < length; i++) {
if (nodeCache[i][0] === node) return nodeCache[i][1];
}
var result = false;
var style = window.getComputedStyle(node);
if (style.visibility === 'hidden' || style.display === 'none') {
result = true;
} else if (node.parentNode) {
result = isHidden(node.parentNode);
}
nodeCache.push([node, result]);
return result;
}
}
})();
;
/*! RESOURCE: /scripts/lib/focus-trap/focus-trap.js */
(function() {
var listeningFocusTrap = null;
function focusTrap(element, userOptions) {
var tabbableNodes = [];
var nodeFocusedBeforeActivation = null;
var active = false;
var container = (typeof element === 'string')
? document.querySelector(element)
: element;
var config = userOptions || {};
config.returnFocusOnDeactivate = (userOptions && userOptions.returnFocusOnDeactivate != undefined)
? userOptions.returnFocusOnDeactivate
: true;
config.escapeDeactivates = (userOptions && userOptions.escapeDeactivates != undefined)
? userOptions.escapeDeactivates
: true;
var trap = {
activate: activate,
deactivate: deactivate,
pause: removeListeners,
unpause: addListeners
};
return trap;
function activate(activateOptions) {
var defaultedActivateOptions = {
onActivate: (activateOptions && activateOptions.onActivate !== undefined)
? activateOptions.onActivate
: config.onActivate,
};
active = true;
nodeFocusedBeforeActivation = getFocusedElement();
if (defaultedActivateOptions.onActivate) {
defaultedActivateOptions.onActivate();
}
addListeners();
return trap;
}
function deactivate(deactivateOptions) {
var defaultedDeactivateOptions = {
returnFocus: (deactivateOptions && deactivateOptions.returnFocus != undefined)
? deactivateOptions.returnFocus
: config.returnFocusOnDeactivate,
returnFocusTo: deactivateOptions && deactivateOptions.returnFocusTo,
onDeactivate: (deactivateOptions && deactivateOptions.onDeactivate !== undefined)
? deactivateOptions.onDeactivate
: config.onDeactivate,
};
removeListeners();
if (defaultedDeactivateOptions.onDeactivate) {
defaultedDeactivateOptions.onDeactivate();
}
if (defaultedDeactivateOptions.returnFocus) {
setTimeout(function() {
tryFocus(defaultedDeactivateOptions.returnFocusTo || nodeFocusedBeforeActivation);
}, 0);
}
active = false;
return this;
}
function addListeners() {
if (!active) return;
if (listeningFocusTrap) {
listeningFocusTrap.pause();
}
listeningFocusTrap = trap;
updateTabbableNodes();
tryFocus(firstFocusNode());
document.addEventListener('focus', checkFocus, true);
document.addEventListener('click', checkClick, true);
document.addEventListener('mousedown', checkPointerDown, true);
document.addEventListener('touchstart', checkPointerDown, true);
document.addEventListener('keydown', checkKey, true);
return trap;
}
function removeListeners() {
if (!active || !listeningFocusTrap) return;
document.removeEventListener('focus', checkFocus, true);
document.removeEventListener('click', checkClick, true);
document.removeEventListener('mousedown', checkPointerDown, true);
document.removeEventListener('touchstart', checkPointerDown, true);
document.removeEventListener('keydown', checkKey, true);
listeningFocusTrap = null;
return trap;
}
function firstFocusNode() {
var node;
if (!config.initialFocus) {
node = tabbableNodes[0];
if (!node) {
throw new Error('You can\'t have a focus-trap without at least one focusable element');
}
return node;
}
node = (typeof config.initialFocus === 'string')
? document.querySelector(config.initialFocus)
: config.initialFocus;
if (!node) {
throw new Error('`initialFocus` refers to no known node');
}
return node;
}
function checkPointerDown(e) {
if (config.clickOutsideDeactivates) {
deactivate({ returnFocus: false });
}
}
function checkClick(e) {
if (config.clickOutsideDeactivates) return;
var composedPath = getEventPath(e);
if (composedPath.indexOf(container) >= 0) return;
e.preventDefault();
e.stopImmediatePropagation();
}
function checkFocus(e) {
if (config.focusOutsideDeactivates === false) return;
var composedPath = getEventPath(e);
var target = composedPath[0];
if (composedPath.indexOf(container) >= 0) return;
e.preventDefault();
e.stopImmediatePropagation();
target.blur();
}
function checkKey(e) {
if (e.key === 'Tab' || e.keyCode === 9) {
handleTab(e);
}
if (config.escapeDeactivates !== false && isEscapeEvent(e)) {
deactivate();
}
}
function handleTab(e) {
e.preventDefault();
updateTabbableNodes();
var target = getEventPath(e)[0];
var currentFocusIndex = tabbableNodes.indexOf(target);
var lastTabbableNode = tabbableNodes[tabbableNodes.length - 1];
var firstTabbableNode = tabbableNodes[0];
if (e.shiftKey) {
if (target === firstTabbableNode || tabbableNodes.indexOf(target) === -1) {
return tryFocus(lastTabbableNode);
}
return tryFocus(tabbableNodes[currentFocusIndex - 1]);
}
if (target === lastTabbableNode) return tryFocus(firstTabbableNode);
tryFocus(tabbableNodes[currentFocusIndex + 1]);
}
function updateTabbableNodes() {
tabbableNodes = tabbable(container);
}
}
function isEscapeEvent(e) {
return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
}
function tryFocus(node) {
if (!node || !node.focus) return;
node.focus();
if (node.tagName.toLowerCase() === 'input') {
node.select();
}
}
function getFocusedElement() {
var activeElement = document.activeElement;
if (!activeElement || activeElement === document.body) {
return;
}
var getShadowActiveElement = function(element) {
if (element.shadowRoot && element.shadowRoot.activeElement) {
element = getShadowActiveElement(element.shadowRoot.activeElement);
}
return element;
};
return getShadowActiveElement(activeElement);
}
function getEventPath(evt) {
return evt.path || (evt.composedPath && evt.composedPath()) || composedPath(evt.target);
}
function composedPath(el) {
var path = [];
while (el) {
if (el.shadowRoot) {
if (el.shadowRoot.activeElement) {
path.push(el.shadowRoot.activeElement);
}
path.push(el.shadowRoot);
}
path.push(el);
if (el.tagName === 'HTML') {
path.push(document);
path.push(window);
break;
}
el = el.parentElement;
}
return path;
}
window.focusTrap = focusTrap;
})();
;
/*! RESOURCE: /scripts/heisenberg/custom/accessibility.js */
jQuery(function($) {
if (!window.WeakMap)
return;
window.NOW = window.NOW || {};
if (window.NOW.accessibilityJSLoaded) {
return;
}
window.NOW.accessibilityJSLoaded = true;
var $document = $(document),
store = new WeakMap();
$document.on('show.bs.modal', function(evt) {
var modal = evt.target,
previouslyFocusedElement = document.activeElement;
if (hasOptions(modal))
return;
createOptions(modal);
rememberTrigger(modal, previouslyFocusedElement);
});
$document.on('hidden.bs.modal', function(evt) {
var modal = evt.target;
restoreTriggerFocus(modal);
destroyOptions(modal);
});
function createOptions(modal) {
store.set(modal, {});
}
function hasOptions(modal) {
return !!store.get(modal);
}
function destroyOptions(modal) {
store.delete(modal);
}
function getOption(modal, key) {
var options = store.get(modal);
return options && options[key];
}
function setOption(modal, key, value) {
var options = store.get(modal);
if (options) {
options[key] = value;
}
}
function rememberTrigger(modal, triggerElement) {
setOption(modal, 'trigger-element', triggerElement);
}
function restoreTriggerFocus(modal) {
var $target = $(getOption(modal, 'trigger-element'));
var isFocusable = function($el) {
if ($el.filter(':visible').length > 0) {
return $el[0].tabIndex > -1;
}
return false;
}
var tryFocus = function(el) {
var $el = $(el);
if (isFocusable($el)) {
$el.focus();
return true;
}
return false;
}
do {
if (tryFocus($target) || tryFocus($target.data('menu-trigger'))) {
return;
}
$target = $target.parent();
} while ($target.length > 0);
}
});
;
/*! RESOURCE: /scripts/heisenberg/custom/modals.js */
(function($) {
"use strict";
var bsModal = $.fn.modal.Constructor;
var bsModalShow = bsModal.prototype.show;
var bsModalHide = bsModal.prototype.hide;
var visibleModalStack = [];
var $document = $(document);
function isMobileSafari() {
return navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i);
}
function forceRedraw(element) {
return element.offsetLeft;
}
function getFirstTabbableElement(container, depth) {
if (typeof depth === 'undefined')
depth = 1;
if (depth === 3)
return null;
var elements = window.tabbable(container, 'input, select, a[href], textarea, button, [tabindex]:not(.focus-trap-boundary-south), iframe');
if (elements.length === 0) return null;
var result = null;
if (elements[0].tagName !== 'IFRAME')
return elements[0];
for (var i = 0; i <= elements.length - 1 && result === null; i++) {
result = elements[i];
if (result.tagName === 'IFRAME')
result = getFirstTabbableElement(result.contentDocument, depth + 1);
}
return result;
}
function getLastTabbableElement(container, depth) {
if (typeof depth === 'undefined')
depth = 1;
if (depth === 3)
return null;
var elements = window.tabbable(container, 'input, select, a[href], textarea, button, [tabindex]:not(.focus-trap-boundary-south), iframe');
if (elements.length === 0) return null;
if (elements[elements.length - 1].tagName !== 'IFRAME')
return elements[elements.length - 1];
var result = null;
for (var i = elements.length - 1; i >= 0 && result === null; i--) {
result = elements[i];
if (result.tagName === 'IFRAME')
result = getLastTabbableElement(result.contentDocument, depth + 1);
}
return result;
}
function visibleModalFocusInHandler(event) {
var $modal = visibleModalStack[visibleModalStack.length - 1];
if (!$modal || !$modal.$element)
return;
$modal = $modal.$element;
if ($modal.attr('focus-escape') === 'true')
return;
var modal = $modal[0];
var targetIsModal = modal === event.target;
var modalContainsTarget = $modal.has(event.target).length > 0;
var targetIsSouthernBoundary = event.target.classList.contains('focus-trap-boundary-south');
var targetIsIframe = event.target.tagName === "IFRAME";
if (!targetIsModal) {
if (!modalContainsTarget) {
var lastTabbableElement = getLastTabbableElement(modal);
if (lastTabbableElement && typeof lastTabbableElement.focus === 'function')
lastTabbableElement.focus();
else
$modal.trigger('focus');
}
else if (targetIsSouthernBoundary){
var firstTabbableElement = getFirstTabbableElement(modal);
if (firstTabbableElement && typeof firstTabbableElement.focus === 'function')
firstTabbableElement.focus();
else
$modal.trigger('focus');
}
else if (targetIsIframe) {
var firstTabbableElement = getFirstTabbableElement(event.target.contentDocument);
if (firstTabbableElement && typeof firstTabbableElement.focus === 'function')
firstTabbableElement.focus();
}
}
}
bsModal.prototype.show = function() {
bsModalShow.apply(this, arguments);
visibleModalStack.push(this);
var $backdrop = $('body').find('.modal-backdrop').not('.stacked');
var zmodal = this.$element.css('z-index');
var zbackdrop = $backdrop.css('z-index');
this.$element.css('z-index', (~~zmodal) + (10 * visibleModalStack.length));
$backdrop.css('z-index', (~~zbackdrop) + (10 * visibleModalStack.length));
$backdrop.addClass('stacked');
forceRedraw(this.$element[0]);
};
bsModal.prototype.hide = function(e) {
bsModalHide.apply(this, arguments);
var modalPosition = visibleModalStack.indexOf(this);
if (modalPosition !== -1)
visibleModalStack.splice(modalPosition, 1);
if (this.isShown) return;
if (visibleModalStack.length > 0)
$document.on('focusin.bs.modal', visibleModalFocusInHandler)
this.$element.css('z-index', '');
forceRedraw(this.$element[0]);
};
$document.on('shown.bs.modal hidden.bs.modal', function() {
if (window._frameChanged)
_frameChanged();
})
$document.on('shown.bs.modal', function(event) {
$document.off('focusin.bs.modal');
$document.on('focusin.bs.modal', visibleModalFocusInHandler);
var modal = event.target;
var autoFocus = true;
if (modal.getAttribute('data-auto-focus') === 'false') {
autoFocus = false;
}
if (autoFocus && window.tabbable) {
var tabbableElements = window.tabbable(modal);
if (
tabbableElements
&& tabbableElements.length
&& tabbableElements[0]
) {
tabbableElements[0].focus();
}
}
});
})(jQuery);
;
;
/*! RESOURCE: /scripts/js_includes_sp_core.js */
/*! RESOURCE: /scripts/app.$sp/app.$sp.js */
angular.module("sn.$sp", [
'oc.lazyLoad',
'sn.common',
'ngAria',
'ngResource',
'ngCookies',
'ngAnimate',
'sn.base',
'ui.bootstrap',
'sn.common.attachments',
'sn.common.util',
'sn.common.presence',
'sn.common.analytics',
'snm.auth.data',
'snm.cabrillo',
'snm.serviceCatalog.form',
'snm.serviceCatalog.data',
'sn.common.form',
'sn.common.controls',
'ui.tinymce',
'ngSanitize',
'sp.dependencies',
'sp.pageData']);
angular.module('snm.auth.data').provider('glideSystemProperties', function glideSystemPropertiesProvider() {
'use strict';
var systemPropertyCache = {};
this.$get = function glideSystemProperties($window) {
return {
set: function(key, value) {
systemPropertyCache[key] = value;
},
get: function(key) {
return systemPropertyCache[key];
}
};
};
});
;
/*! RESOURCE: /scripts/app.$sp/constant.spConf.js */
(function() {
var config = {
page: 'sp.do',
angularProcessor: 'angular.do',
sysParamType: '$sp',
widgetApi: '/api/now/sp/widget/',
instanceApi: '/api/now/sp/rectangle/',
pageApi: '/api/now/sp/page',
announcementApi: '/api/now/sp/announcement',
logoutUrl: '/logout.do?sysparm_goto_url=/{url_suffix}',
s: 83,
e: {
notification: '$$uiNotification',
announcement: '$$:sp:announcement'
},
SYS_DATE_FORMAT: 'yyyy-MM-dd',
SYS_TIME_FORMAT: 'HH:mm:ss'
};
angular.module('sn.$sp').constant('spConf', config);
}());
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/constant.spSCConf.js */
(function () {
var scConf = {
MULTI_ROW_TYPE : "sc_multi_row",
CONTAINER_START : "container_start",
CHECKBOX : "boolean",
CHECKBOX_MANDATORY : "boolean_confirm",
CHECKBOX_CONTAINER : "checkbox_container",
REFERENCE: "reference",
LABEL : "label",
MASKED : "masked",
STRING : "string",
BREAK : "break",
FORMATTER: "formatter",
HTML : "html",
RICH_TEXT_LABEL: "rich_text_label",
SC_ATTACHMENT : "sc_attachment",
_CAT_VARIABLE : "_cat_variable",
MAX_ALSO_REQUEST_FOR : 50
};
angular.module('sn.$sp').constant('spSCConf', scConf);
}());
;
/*! RESOURCE: /scripts/app.$sp/directive.spFormField.js */
angular.module('sn.$sp').directive('spFormField', function($location, glideFormFieldFactory, $timeout, spLabelHelper, spAriaUtil, i18n, spModelUtil, $ocLazyLoad, $sce, spUtil, $rootScope) {
'use strict';
function getDeps(fieldType) {
var deps = {
codeMirror: [
'/styles/sp_codemirror_includes.css',
'/scripts/libs/sp_codemirror_includes.js'
],
spectrum: [
'/styles/spectrum.css',
'/scripts/lib/spectrum.js'
]
};
deps.momentLocale = function() {
var localeMap = spUtil.localeMap;
if (localeMap[g_lang]) {
return ['/scripts/libs/moment/locale/' + localeMap[g_lang] + '.js'];
}
return;
};
return {
css: deps.codeMirror,
xml: deps.codeMirror,
json: deps.codeMirror,
script: deps.codeMirror,
properties: deps.codeMirror,
script_server: deps.codeMirror,
html_template: deps.codeMirror,
color: deps.spectrum,
glide_date: deps.momentLocale(),
glide_date_time: deps.momentLocale()
}[fieldType];
}
return {
restrict: 'E',
templateUrl: 'sp_form_field.xml',
replace: true,
controllerAs: 'c',
scope: {
field: '=',
formModel: '=',
getGlideForm: '&glideForm',
setDefaultValue: '&defaultValueSetter'
},
controller: function ($element, $scope) {
var c = this;
var field = $scope.field;
if (!field)
throw "spFormField used without providing a field.";
c.depsLoaded = false;
c.getAttachmentGuid = function() {
if ($scope.formModel) {
return $scope.formModel._attachmentGUID;
}
return "";
}
var deps = getDeps(field.type);
if(deps && deps.length) {
$ocLazyLoad.load(deps).then(function() {
c.depsLoaded = true;
if (field.type == 'glide_date' || field.type == 'glide_date_time')
$rootScope.$emit('sp.date.depsLoaded');
});
} else {
c.depsLoaded = true;
}
if (typeof field.isMandatory === "undefined")
spModelUtil.extendField(field);
var _setDefaultValue = $scope.setDefaultValue;
$scope.setDefaultValue = function (fieldName, fieldInternalValue, fieldDisplayValue) {
_setDefaultValue({
fieldName: fieldName,
fieldInternalValue: fieldInternalValue,
fieldDisplayValue: fieldDisplayValue
});
};
$scope.getGlideForm().$private.events.on("change", function(fieldName, oldValue, newValue) {
if (fieldName == field.name)
field.stagedValue = newValue;
});
$scope.stagedValueChange = function() {
$scope.$emit('sp.spFormField.stagedValueChange', null);
};
$scope.fieldValue = function(newValue, displayValue) {
if (angular.isDefined(newValue)) {
$scope.getGlideForm().setValue(field.name, newValue, displayValue);
}
return field.value;
};
$scope.getEncodedRecordValues = function() {
var result = {};
angular.forEach($scope.formModel._fields, function(f){
if (f.type != 'user_image')
result[f.name] = f.value;
else if (f.value)
result[f.name] = 'data:image/jpeg;base64,A==';
});
return result;
};
$scope.formatNumber = function() {
if (!field.noFormat)
field.stagedValue = formatNumber(field.stagedValue);
};
$scope.onImageUpload = function(thumbnail, sys_id) {
$scope.getGlideForm().setValue(field.name, sys_id, thumbnail);
};
$scope.onImageDelete = function() {
$scope.getGlideForm().setValue(field.name, '');
};
$scope.hasValueOrFocus = function() {
var val = $scope.hasFocus || glideFormFieldFactory.hasValue(field);
if (field.type == "user_image")
val = true;
return val;
};
$scope.getAutocompleteValue = function() {
var attributes = spUtil.parseAttributes(field.attributes);
if (typeof attributes.autocomplete !== "undefined")
return attributes.autocomplete;
return "off";
};
c.showLabel = function showLabel(field) {
return field.type != "boolean" && field.type != "boolean_confirm" && field.type != "glide_duration" && field.type != "rich_text_label" && field._class_name != "MacroQuestion" && (field.isMandatory() || (field.label && field.label.trim() != ""));
};
},
link: function (scope, element, attr) {
scope.$applyAsync(function() {
if (scope.field.type != "boolean" && scope.field.type != "glide_duration") {
scope.labelElement = element.closest('.form-group').find('.field-label');
}
var inputField;
switch(scope.field.type) {
case "field_list":
case "glide_list":
case "reference":
case "field_name":
case "table_name":
case "masked":
return;
break;
case "multiple_choice":
case "numericscale":
inputField = element.find("input[type=radio]");
break;
default:
inputField = element.find("[name='"+ scope.field.name +"']");
break;
}
var focusHandler = function(){
scope.hasFocus = true;
scope.$emit("sp.spFormField.focus", element, inputField);
if (!scope.$root.$$phase)
scope.$apply();
};
var blurHandler = function() {
scope.fieldValue(scope.field.stagedValue);
scope.hasFocus = false;
scope.$emit("sp.spFormField.blur", element, inputField);
scope.$broadcast("sp.spFormField.unFocus");
if (!scope.$root.$$phase)
scope.$apply();
};
inputField.on('focus', focusHandler).on('blur', blurHandler);
scope.$on('$destroy', function(){
inputField.off('focus', focusHandler).off('blur', blurHandler);
});
scope.$emit("sp.spFormField.rendered", element, inputField);
});
scope.$on('select2.ready', function(e, $el) {
e.stopPropagation();
var focusHandler = function(e){ $el.select2('open'); };
$el.on('focus', focusHandler);
scope.$on('$destroy', function(){
$el.off('focus', focusHandler);
});
scope.$emit("sp.spFormField.rendered", element, $el);
});
scope.$on('sp.spFormField.rendered', function(e, element, $el) {
var controlElement;
switch(scope.field.type) {
case 'glide_date':
case 'glide_date_time':
case 'multiple_choice':
case 'multi_two_lines':
case 'multi_small':
case 'numericscale':
case 'password':
case 'password2':
case 'textarea':
case 'integer':
case 'decimal':
case 'float':
case 'email':
case 'string':
case 'url':
case 'boolean':
controlElement = $el;
break;
case 'glide_list':
controlElement = $el.parent().find('.select2-input');
break;
case 'reference':
case 'choice':
controlElement = $el.parent().find('.select2-focusser');
break;
default:
return;
}
scope.controlElement = controlElement;
syncFieldAriaDescribedBy();
});
scope.getGlideForm().$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (fieldName != scope.field.name)
return;
if (propertyName === 'messages')
syncFieldAriaDescribedBy();
if (propertyName === 'isInvalid')
syncAriaInvalid();
if (propertyName === 'readonly')
scope.syncFieldAriaLabel(scope);
});
function syncAriaInvalid() {
var field = scope.field;
var controlElement = scope.controlElement;
if (!field || !controlElement)
return;
switch(field.type) {
case 'glide_list':
case 'reference':
case 'choice':
controlElement.attr('aria-invalid', field.isInvalid);
default:
return;
}
}
function syncFieldAriaDescribedBy() {
var controlElement = scope.controlElement;
if (!controlElement)
return;
var messages = scope.field.messages;
var fieldMsgs = messages && messages.length;
var ariaDescribedBy = controlElement.attr('aria-describedby');
var ariaDescribedByList = ariaDescribedBy ? ariaDescribedBy.split(' ') : [];
var fmAriaDescribedBy = 'sp_formfield_' + scope.field.name + '_fieldmsgs_container';
if (fieldMsgs) {
if (ariaDescribedByList.indexOf(fmAriaDescribedBy) === -1) {
ariaDescribedByList.push(fmAriaDescribedBy);
controlElement.attr('aria-describedby', ariaDescribedByList.join(' '));
}
} else {
if (ariaDescribedByList.indexOf(fmAriaDescribedBy) !== -1) {
ariaDescribedByList.splice(ariaDescribedByList.indexOf(fmAriaDescribedBy), 1);
if(ariaDescribedByList.length)
controlElement.attr('aria-describedby', ariaDescribedByList.join(' '));
else
controlElement.removeAttr('aria-describedby');
}
}
}
scope.getFieldAriaHidden = function(field) {
var fieldTypes = ["boolean", "choice", "boolean_confirm", "color", "css", "document_id", "domain_id", "schedule_date_time", "integer_date", "glide_duration", "url", "field_list", "field_name", "glide_date", "glide_date_time", "glide_list",
"glyphicon", "xml", "html_template" ,"json", "masked", "multiple_choice", "multi_two_lines", "multi_small", "numericscale", "price", "currency", "password", "password2", "properties", "reference", "script_server", "script", "table_name",
"textarea", "html", "translated_html", "user_image", "widget", "widget_value", "integer", "decimal", "float", "sc_multi_row", "email", "rich_text_label", "sc_attachment"];
var ariaHiddenFields = [
"email",
"url",
"boolean",
"string",
"textarea",
"sc_attachment",
"glide_date",
"glide_date_time",
"choice",
"html",
"translated_html",
"widget",
"ph_number",
"masked",
"multi_two_lines"
];
return fieldTypes.indexOf(field.type) < 0 || ariaHiddenFields.indexOf(field.type) > -1;
};
scope.getReferenceLabelContents = function(field) {
return spLabelHelper.getReferenceLabelContents(field);
}
scope.syncFieldAriaLabel = spLabelHelper.syncFieldAriaLabel;
scope.getFieldAriaLabel = spLabelHelper.getFieldAriaLabel;
scope.accessible = spAriaUtil.isAccessibilityEnabled();
scope.enhancePriceLabels = function(field) {
return (field._pricing && field._pricing.enhance_price_labels === true);
}
scope.getCheckBoxPrice = function(field) {
return spLabelHelper.getPriceLabelForCheckbox(field);
}
scope.setPriceLabelForChoice = function(field) {
if (angular.isDefined(field) && field._cat_variable === true) {
if (!scope.enhancePriceLabels(field))
return;
var labelArrayPromise = spLabelHelper.getPriceLabelForChoices(field, scope.formModel.recurring_price_frequency);
labelArrayPromise.then(
function(labelArray) {
if(!labelArray || field.choices.length != labelArray.length)
return;
for(var i=0; i<field.choices.length; i++) {
field.choices[i].priceLabel = labelArray[i];
}
},
function(errorMessage) {
console.log(errorMessage);
});
}
}
scope.trustedHTML = function(html) {
return $sce.trustAsHtml(html);
}
if (scope.field.type == "integer" || scope.field.type == "decimal" || scope.field.type == "float") {
if (!scope.field.noFormat) {
scope.field.stagedValue = scope.field.displayValue;
}
return;
}
if (scope.field.encrypted)
scope.field.stagedValue = scope.field.displayValue;
if (scope.field._cat_variable && scope.field.type == "choice" && scope.field._pricing && scope.field._pricing.enhance_price_labels === true) {
scope.$on('sp.sc.refresh_label_choices', function(event, field) {
if (scope.field.name == field.name) {
event.stopPropagation();
scope.setPriceLabelForChoice(field);
}
});
}
var fieldChangeHandlers = [
{
types: ['choice', 'multiple_choice'],
handler: function ($event, payload) {
scope.setPriceLabelForChoice(payload.field);
}
},
{
types: ['boolean', 'boolean_confirm'],
handler: function ($event, payload) {
var newValue = (payload.newValue.toString() === 'true' || payload.newValue.toString() === '1').toString();
if (newValue !== payload.field.value) {
scope.field.value = newValue;
}
}
},
{
types: ['journal_input', 'journal'],
handler: function ($event, payload) {
scope.field.journalInputChanged = true;
}
}
];
fieldChangeHandlers.some(function (fch) {
if (fch.types.indexOf(scope.field.type) > -1) {
scope.$on('field.change.' + scope.field.name, fch.handler);
return true;
}
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spLabelHelper.js */
angular.module('sn.$sp').factory('spLabelHelper', function ($q, $http, i18n, spUtil, glideFormFieldFactory) {
'use strict'
function getReferenceLabelContents(field) {
if (!field)
return;
var label = "";
if (glideFormFieldFactory.isMandatory(field) && (field.mandatory_filled && !field.mandatory_filled())) {
label = i18n.getMessage("Required");
label += " - ";
}
label = label + field.label;
if (field.displayValue) {
label = label + ", " + field.displayValue
}
return label;
}
function syncFieldAriaLabel(scope) {
if (scope.labelElement) {
var ariaLabel = scope.accessible && scope.field.hint ? undefined: getFieldAriaLabel(scope.field);
if (ariaLabel)
scope.labelElement.attr('aria-label', ariaLabel);
else
scope.labelElement.removeAttr('aria-label');
}
}
function getFieldAriaLabel(field) {
var ariaLabel = field.hint || "";
if (field.type !== 'reference' && !ariaLabel && field.readonly)
ariaLabel = field.label;
if (field.readonly)
ariaLabel = i18n.getMessage('Read only - {0}').withValues([ariaLabel]);;
if (field.type === 'reference')
ariaLabel += ' ' + getReferenceLabelContents(field);
return ariaLabel.trim() || undefined;
};
function getPriceLabelForCheckbox(field) {
if (!field || !field._pricing)
return;
if (!(field._pricing.price_if_checked || field._pricing.rec_price_if_checked))
return '';
var label = " [ ";
if (field.value == "true") {
if (field._pricing.price_if_checked && field._pricing.rec_price_if_checked)
label += i18n.getMessage("has added {0} | has added {1}").withValues([field._pricing.price_if_checked_display, field._pricing.rec_price_if_checked_display]);
else if (field._pricing.price_if_checked || field._pricing.rec_price_if_checked)
label += i18n.getMessage("has added {0}").withValues([field._pricing.price_if_checked_display || field._pricing.rec_price_if_checked_display]);
}
else {
if (field._pricing.price_if_checked && field._pricing.rec_price_if_checked)
label += i18n.getMessage("will add {0} | will add {1}").withValues([field._pricing.price_if_checked_display, field._pricing.rec_price_if_checked_display]);
else if (field._pricing.price_if_checked || field._pricing.rec_price_if_checked)
label += i18n.getMessage("will add {0}").withValues([field._pricing.price_if_checked_display || field._pricing.rec_price_if_checked_display]);
}
label += " ]";
return label;
}
function preparePriceMap(field) {
var priceMap = {};
var selectedPrice = field.price || 0;
var selectedRecurringPrice = field.recurring_price || 0;
for (var i=0; i<field.choices.length; i++) {
var choicePrice = 0;
var choiceRecurringPrice = 0;
if (field.choices[i].price) {
choicePrice = field.choices[i].price;
}
if (field.choices[i].recurring_price) {
choiceRecurringPrice = field.choices[i].recurring_price;
}
var adjustedPrice = selectedPrice - choicePrice;
var adjustedRecurringPrice = selectedRecurringPrice - choiceRecurringPrice;
var adjustedPriceAbs = Math.abs(selectedPrice - choicePrice);
var adjustedRecurringPriceAbs = Math.abs(selectedRecurringPrice - choiceRecurringPrice);
var key1 = adjustedPriceAbs + '';
var key2 = adjustedRecurringPriceAbs + '';
if (field.choices[i].price_dc && field.choices[i].price_dc !== "")
key1 += '_' + field.choices[i].price_dc;
if (field.choices[i].rprice_dc && field.choices[i].rprice_dc !== "")
key2 += '_' + field.choices[i].rprice_dc;
if (!priceMap.hasOwnProperty(key1)) {
priceMap[key1] = adjustedPriceAbs;
}
if (!priceMap.hasOwnProperty(key2)) {
priceMap[key2] = adjustedRecurringPriceAbs;
}
}
return priceMap;
}
function getPriceLabelArray(field, recurringPriceFreq, formattedPriceMap) {
var priceLableArray = [];
var selectedPrice = field.price || 0;
var selectedRecurringPrice = field.recurring_price || 0;
for (var i=0; i<field.choices.length; i++) {
var choicePrice = 0;
var choiceRecurringPrice = 0;
if (field.choices[i].price) {
choicePrice = field.choices[i].price;
}
if (field.choices[i].recurring_price) {
choiceRecurringPrice = field.choices[i].recurring_price;
}
var label = " [ ";
var message;
var formattedValues;
var adjustedPrice = selectedPrice - choicePrice;
var adjustedRecurringPrice = selectedRecurringPrice - choiceRecurringPrice;
var adjustedPriceAbs = Math.abs(selectedPrice - choicePrice);
var adjustedRecurringPriceAbs = Math.abs(selectedRecurringPrice - choiceRecurringPrice);
var key1 = adjustedPriceAbs + '';
var key2 = adjustedRecurringPriceAbs + '';
if (field.choices[i].price_dc && field.choices[i].price_dc !== "")
key1 += '_' + field.choices[i].price_dc;
if (field.choices[i].rprice_dc && field.choices[i].rprice_dc !== "")
key2 += '_' + field.choices[i].rprice_dc;
if (adjustedPrice != 0 && adjustedRecurringPrice != 0 && recurringPriceFreq) {
formattedValues = [(formattedPriceMap[key1] ? formattedPriceMap[key1] : ''), (formattedPriceMap[key2] ? formattedPriceMap[key2] : '')];
if (adjustedPrice > 0 && adjustedRecurringPrice > 0)
message = i18n.getMessage("subtract {0} | subtract {1}").withValues(formattedValues);
else if (adjustedPrice > 0 && adjustedRecurringPrice <= 0)
message = i18n.getMessage("subtract {0} | add {1}").withValues(formattedValues);
else if (adjustedPrice <= 0 && adjustedRecurringPrice > 0)
message = i18n.getMessage("add {0} | subtract {1}").withValues(formattedValues);
else
message = i18n.getMessage("add {0} | add {1}").withValues(formattedValues);
label += message + " " + recurringPriceFreq;
} else if (adjustedPrice != 0) {
formattedValues = [(formattedPriceMap[key1] ? formattedPriceMap[key1] : '')];
label += adjustedPrice > 0 ? i18n.getMessage("subtract {0}").withValues(formattedValues) : i18n.getMessage("add {0}").withValues(formattedValues);
} else if (adjustedRecurringPrice != 0 && recurringPriceFreq) {
formattedValues = [(formattedPriceMap[key2] ? formattedPriceMap[key2] : '')];
message = adjustedRecurringPrice > 0 ? i18n.getMessage("subtract {0}").withValues(formattedValues) : i18n.getMessage("add {0}").withValues(formattedValues);
label += message + " " + recurringPriceFreq;
} else {
priceLableArray.push("");
continue;
}
label += " ]";
priceLableArray.push(label);
}
return priceLableArray;
}
function getPriceLabelForChoices(field, recurringPriceFreq) {
return $http.post(spUtil.getURL('format_prices'), preparePriceMap(field))
.then(function(response){return response.data})
.then(function(data) { return getPriceLabelArray(field, recurringPriceFreq, data)});
}
function getPriceLabelsForChoiceFields(fields, recurringPriceFreq) {
return $http.post(spUtil.getURL('format_prices'), function(fields) {
var aggregatedPriceMap = {};
fields.forEach( function(field) {
if(field.type == 'choice' || field.type == 'multiple_choice') {
var fieldPriceMap = preparePriceMap(field);
for(var key in fieldPriceMap) {
if (!aggregatedPriceMap.hasOwnProperty(key))
aggregatedPriceMap[key] = fieldPriceMap[key];
}
}
});
return aggregatedPriceMap;
}(fields)).then(function(response){ return response.data; })
.then(function(data) {
fields.forEach(function(field) {
if (field.type == 'choice' || field.type == 'multiple_choice') {
var labelArray = getPriceLabelArray(field, recurringPriceFreq, data);
if(!labelArray || field.choices.length != labelArray.length)
return;
for(var i=0; i<field.choices.length; i++) {
field.choices[i].priceLabel = labelArray[i];
}
}
});
});
}
return {
getReferenceLabelContents: getReferenceLabelContents,
syncFieldAriaLabel: syncFieldAriaLabel,
getFieldAriaLabel: getFieldAriaLabel,
getPriceLabelForCheckbox: getPriceLabelForCheckbox,
getPriceLabelForChoices: getPriceLabelForChoices,
getPriceLabelsForChoiceFields : getPriceLabelsForChoiceFields
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAttachmentUpload.js */
angular.module('sn.$sp').factory('spAttachmentUpload', function(spModal, $q, i18n) {
'use strict';
return {
uploadAttachments: function(attachmentHandler, files) {
if (!files || !files.length)
return;
if (!g_has_encryption_context) {
attachmentHandler.onFileSelect(files);
return;
}
var context = "";
var title = files.length > 1 ? i18n.getMessage("Encrypt attachments?") : i18n.getMessage("Encrypt attachment?");
spModal.open({
title: title,
shared: {files: files},
backdrop: 'static',
keyboard: false,
widget: 'encryption-context-picker',
buttons: [
{label: i18n.getMessage('Upload Without Encrypting'), value: "no"},
{label: i18n.getMessage('Upload and Encrypt'), primary: true, value: "yes"}
],
onSubmit: function() {
context = this.shared.context.value;
return $q(function(resolve, reject) {
resolve({status: "ok"});
});
}
}).then(function(clickedButton) {
if (clickedButton.value == "yes")
attachmentHandler.setEncryptionContext(context);
else
attachmentHandler.setEncryptionContext('');
attachmentHandler.onFileSelect(files);
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spUtil.js */
angular.module('sn.$sp').factory('spUtil', function($rootScope, $http, $location, snRecordWatcher, $q, $log, spPreference, spConf, $window, spNotificationEvents, $timeout) {
"use strict";
var spUtil = {
localeMap: {
pb: "pt-br",
zh: "zh-cn",
cs: "cs",
nl: "nl",
et: "et",
fi: "fi",
fr: "fr",
fq: "fr-ca",
de: "de",
he: "he",
hu: "hu",
it: "it",
ja: "ja",
ko: "ko",
nb: "nb",
pl: "pl",
pt: "pt",
ru: "ru",
es: "es",
sv: "sv",
th: "th",
zt: "zh-cn",
tr: "tr"
},
AMBIGUOUS_TIME_ZONES: {
"ACT": "Australia/Darwin",
"AET": "Australia/Sydney",
"AGT": "America/Argentina/Buenos_Aires",
"ART": "Africa/Cairo",
"AST": "America/Anchorage",
"BET": "America/Sao_Paulo",
"BST": "Asia/Dhaka",
"CAT": "Africa/Harare",
"CNT": "America/St_Johns",
"CST": "America/Chicago",
"CTT": "Asia/Shanghai",
"EAT": "Africa/Addis_Ababa",
"ECT": "Europe/Paris",
"IET": "America/Indiana/Indianapolis",
"IST": "Asia/Kolkata",
"JST": "Asia/Tokyo",
"MIT": "Pacific/Apia",
"NET": "Asia/Yerevan",
"NST": "Pacific/Auckland",
"PLT": "Asia/Karachi",
"PNT": "America/Phoenix",
"PRT": "America/Puerto_Rico",
"PST": "America/Los_Angeles",
"SST": "Pacific/Guadalcanal",
"VST": "Asia/Ho_Chi_Minh"
},
getMomentTimeZone : function(tzName) {
if (!tzName)
return;
if (moment.tz.zone(tzName) != null)
return tzName;
if (typeof this.AMBIGUOUS_TIME_ZONES[tzName] !== "undefined")
return this.AMBIGUOUS_TIME_ZONES[tzName];
return tzName;
},
isMobile : function () {
if( navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Windows Phone/i)) {
return true;
} else {
return false;
}
},
format : function(tpl, data) {
var re = /{([^}]+)?}/g, match;
while (match = new RegExp(re).exec(tpl)) {
tpl = tpl.replace(match[0], data[match[1]]);
}
return tpl;
},
update: function($scope) {
var s = $scope;
return this.get(s, s.data).then(function (response) {
if (!response)
return {};
angular.extend(s.data, response.data);
return response.data;
})
},
refresh: function($scope) {
var s = $scope;
return this.get(s, null).then(function (response) {
angular.extend(s.options, response.options);
angular.extend(s.data, response.data);
return response;
})
},
get: function($scope, data) {
var qs = $location.search();
var p = $http({
method: 'POST',
url: this.getWidgetURL($scope),
params: qs,
headers: this.getHeaders(),
data: data
}).then(function (response) {
var r = response.data.result;
if (r && r.invalid_token) {
$window.location.reload();
return Promise.reject("Invalid Session");
}
if (r && r._server_time) {
var w = $scope.widget;
if (w)
w._server_time = r._server_time;
}
if (r && r.$$uiNotification) {
if ($scope.$emit)
$scope.$emit("$$uiNotification", r.$$uiNotification);
else
$rootScope.$broadcast("$$uiNotification", r.$$uiNotification);
}
return r;
});
return p;
},
getHeaders: function() {
return {'Accept': 'application/json', 'x-portal': $rootScope.portal_id, 'X-UserToken' : $window.g_ck};
},
getWidgetURL : function(arg) {
if (typeof arg == 'string')
return "/api/now/sp/widget/" + arg;
else if (arg.widget && arg.widget.rectangle_id)
return "/api/now/sp/rectangle/" + arg.widget.rectangle_id;
else
return "/api/now/sp/widget/" + arg.widget.sys_id;
},
setBreadCrumb: function($scope, list) {
$scope.$emit('sp.update.breadcrumbs', list);
},
setSearchPage: function(searchPage) {
$rootScope.$emit("update.searchpage", searchPage);
},
addTrivialMessage: function(message) {
$rootScope.$broadcast("$$uiNotification", {type: "trivial", message: message});
},
addInfoMessage: function(message) {
$rootScope.$broadcast("$$uiNotification", {type: "info", message: message});
},
addErrorMessage: function(message) {
$rootScope.$broadcast("$$uiNotification", {type: "error", message: message});
},
addWarningMessage: function(message) {
$rootScope.$broadcast("$$uiNotification", {type: "warning", message: message});
},
clearMessages: function() {
$rootScope.$broadcast("$$uiNotification.dismiss");
},
getURL: function(type) {
var n;
if (type !== null && typeof type === 'object') {
n = $.param(type);
} else {
n = $.param({
sysparm_type: spConf.sysParamType,
sysparm_ck: $window.g_ck,
type: type
});
}
return spConf.angularProcessor + '?' + n;
},
getHost: function() {
var host = $location.protocol() + '://' + $location.host();
if ($location.port()) {
host += ':' + $location.port();
}
return host;
},
scrollTo: function(id, time) {
$rootScope.$broadcast('$sp.scroll', {selector: id, time: time || 1000, offset: 'header'});
},
getAccelerator: function(char) {
if (!$window.ontouchstart) {
if ($window.navigator.userAgent.indexOf("Mac OS X") > -1) {
return '⌘ + ' + char;
} else {
return 'Ctrl + ' + char;
}
}
return '';
},
recordWatch: function($scope, table, filter, callback) {
if (!table) {
$log.debug("spUtil.recordWatch called with no table");
return;
}
var watcherChannel = snRecordWatcher.initChannel(table, filter || 'sys_id!=-1');
var subscribe = callback || function(){ $scope.server.update() };
watcherChannel.subscribe(subscribe);
$scope.$on('$destroy', function() {
watcherChannel.unsubscribe();
});
},
createUid: function(str) {
return str.replace(/[xy]/g, function(c) {
var r, v;
r = Math.random() * 16 | 0;
v = c === 'x' ? r : r & 0x3 | 0x8;
return v.toString(16);
});
},
setPreference: function(pref, value) {
spPreference.set(pref, value);
},
getPreference: function(pref, callback) {
spPreference.get(pref, callback);
},
parseAttributes: function(strAttributes) {
if (typeof strAttributes === 'object')
return strAttributes;
var attributeArray = (strAttributes && strAttributes.length ? strAttributes.split(',') : []);
var attributeObj = {};
for (var i = 0; i < attributeArray.length; i++) {
if (attributeArray[i].length > 0) {
var attribute = attributeArray[i].split('=');
attributeObj[attribute[0].trim()] = attribute.length > 1 ? attribute[1].trim() : '';
}
}
return attributeObj;
},
retrieveSessionMessages: function() {
return $http({
method: 'GET',
url: '/api/now/sp/sessionuinotifications'
}).then(function(sessionMessagesResponse) {
spNotificationEvents.addMessages(sessionMessagesResponse.data.result.$$uiNotification);
});
},
simulateFakeFormSubmitForAutoComplete: function(formId, fields) {
var deferred = $q.defer();
fields = fields || {};
if (!this._hasAutocompleteFields(fields)) {
deferred.resolve();
return deferred.promise;
}
var form = $("#" + formId);
var hiddenIframe = $("<iframe>").appendTo(form);
var submitBtn = $("<input>").appendTo(form);
hiddenIframe.attr("name", "hidden_iframe")
.attr("style", "display:none");
form.attr("method", "post")
.attr("action", "about:blank")
.attr("target", "hidden_iframe");
submitBtn.attr("type", "submit")
.attr("id", "hidden_form_btn")
.attr("style", "display:none");
setTimeout(function() {
submitBtn.click();
setTimeout(function() {
hiddenIframe.remove();
submitBtn.remove();
deferred.resolve();
}, 1000);
}, 100);
return deferred.promise;
},
setMobileBanner : function (scope) {
if($window.g_universal_link_flag) {
var locationUrl = $location.url();
var bannerApiUrl = '/api/now/sg/ulink/banner?url=' + encodeURIComponent(locationUrl);
$timeout(function() {
scope.bannerApiUrl = bannerApiUrl;
}, 300);
}
},
_hasAutocompleteFields: function(fields) {
for (var fieldName in fields) {
if (fields.hasOwnProperty(fieldName)) {
var field = fields[fieldName];
if (field.type && ["email", "url"].indexOf(field.type) > -1)
return true;
if (field.attributes) {
var attributes = this.parseAttributes(field.attributes);
if (typeof attributes.autocomplete !== "undefined")
return true;
}
}
}
return false;
}
};
return spUtil;
})
;
/*! RESOURCE: /scripts/app.$sp/service.spWidgetDiagnostics.js */
angular.module('sn.$sp').factory('spWidgetDiagnostics', function ($rootScope, $http, spModal, i18n, $ocLazyLoad) {
'use strict';
var diagnostics = {};
diagnostics.widgetClasses = ['widget-uncategorized', 'widget-oob', 'widget-cloned', 'widget-new', 'widget-customized'];
diagnostics.i18nStrings = {
'widget': i18n.getMessage('Widget'),
'cloned': i18n.getMessage('Cloned'),
'new_widget': i18n.getMessage('New'),
'customized': i18n.getMessage('Customized'),
'basesystem': i18n.getMessage('Base system'),
'color_codes': i18n.getMessage('Color codes'),
'compare_with_oob': i18n.getMessage('Compare with Base system'),
'compare_with_prev': i18n.getMessage('Compare with previous version'),
'widget_diagnostics': i18n.getMessage('Widget Diagnostics'),
'open_in_platform': i18n.getMessage('Open widget in platform'),
'open_diagnostics_info': i18n.getMessage('Open diagnostics information')
};
diagnostics.widgetMsgs = ['Uncategorized', diagnostics.i18nStrings.basesystem, diagnostics.i18nStrings.cloned, diagnostics.i18nStrings.new_widget, diagnostics.i18nStrings.customized];
var body = $('body');
var legendContent = '<button class="fa fa-info-circle legend-icon" data-original-title="' + diagnostics.i18nStrings.color_codes + '" data-toggle="popover" data-trigger="focus" data-placement="left"></button>' +
'<div class="widget-legend-wrapper popper-content hide" id="widget-legend-wrapper">' +
'<div class="widget-legend-info" tabindex="-1">' +
'<div><span class="legend-dot-yellow"></span><span>' + diagnostics.i18nStrings.cloned + '</span></div>' +
'<div><span class="legend-dot-blue"></span><span>' + diagnostics.i18nStrings.new_widget + '</span></div>' +
'<div><span class="legend-dot-red"></span><span>' + diagnostics.i18nStrings.customized + '</span></div>' +
'<div><span class="legend-dot-green"></span><span>' + diagnostics.i18nStrings.basesystem + '</span></div>' +
'</div>' +
'</div>';
var diagnosticIcon = '<button class="fa fa-info-circle widget-diagnostics-info"></button>';
var locationChangeHandle;
function enableDiagnostics() {
if (!diagnostics.depsLoaded) {
$ocLazyLoad.load(['/styles/sp-diagnostics-tool.css']).finally(function () {
diagnostics.depsLoaded = true;
runDiagnostics();
});
} else
runDiagnostics();
}
function runDiagnostics() {
body.attr('data-widget-diagnostics-mode', 'true');
getWidgetsInfoOnPage();
updateWidgetsInfoFromServer();
$(document).on('click', '.widget-diagnostics-info', widgetInfoIconHandler);
locationChangeHandle = $rootScope.$on('$locationChangeStart', function (event, newUrl, oldUrl) {
if (newUrl !== oldUrl && diagnostics.isEnabled)
disableDiagnostics();
});
diagnostics.isEnabled = true;
}
function addLegendToPage() {
body.append($.parseHTML(legendContent));
}
function widgetInfoIconHandler(event) {
event.stopPropagation();
event.stopImmediatePropagation();
var parent = $(event.target).parent();
var parentId = parent.attr('id') || parent.attr('class');
parentId = parentId.split(" ")[0];
var widgetObj = diagnostics.instances.filter(function (item) {
return item['elementId'] === parentId;
});
var details = widgetObj[0].widgetCustDetails;
var bCustomized = details.category == 4 && !!details.isRecordCustomized;
var compareBtnLabel = bCustomized ? diagnostics.i18nStrings.compare_with_oob : diagnostics.i18nStrings.open_in_platform;
var options = {
title: diagnostics.i18nStrings.widget_diagnostics,
widget: 'widget-diagnostics',
widgetInput: widgetObj[0],
buttons: [{
'label': compareBtnLabel,
'primary': true,
'class': 'compare-button compare-button-oob'
}]
};
if (bCustomized) {
var obj = {
'label': diagnostics.i18nStrings.compare_with_prev,
'primary': true,
'compare': 'previous',
'class': 'compare-button compare-button-prev'
};
options.buttons.unshift(obj);
}
spModal.open(options);
setTimeout(function () {
var compareButtons = angular.element(document.querySelectorAll(".compare-button"));
compareButtons.unbind('click');
compareButtons.bind('click', function (event) {
var bComparePrev = $(event.target).hasClass('compare-button-prev');
var url;
var tmp;
if (bCustomized) {
var v1 = bComparePrev ? details.currentSysId : details.baselineSysId;
var v2 = bComparePrev ? details.prevSysId : details.currentSysId;
if (bComparePrev) {
tmp = v1;
v1 = v2;
v2 = tmp;
}
url = 'merge_form_select_version_ro.do?sysparm_hide_back_btn=true&sysparm_version1=' + v1 + '&sysparm_version2=' + v2;
} else {
url = 'sp_widget.do?sys_id=' + details.widSysId;
}
window.open(url, '_blank');
});
}, 1000);
}
function getWidgetsInfoOnPage() {
var instances = [];
var instanceArr = [];
$("[widget='widget']").each(function (index, elem) {
var widget = angular.element(elem).scope().widget;
var widgetInfo = {};
var instanceMap = {};
widgetInfo.widgetName = widget.name;
widgetInfo.widgetId = widget.sys_id;
instanceMap['widgetInfo'] = widgetInfo;
instanceMap['instanceId'] = widget.rectangle_id || widget.sys_id;
if (!!widget.rectangle_id)
instanceMap['elementId'] = "x" + widget.rectangle_id;
else {
instanceMap['elementId'] = "v" + widget.sys_id;
instanceMap['isEmbeddedWidget'] = true;
}
var id = widget.rectangle_id || widget.sys_id;
if (instanceArr.join('####').indexOf(id) == -1) {
instanceArr.push(id);
instances.push(instanceMap);
}
});
diagnostics.instances = instances;
diagnostics.instanceArr = instanceArr;
}
function updateWidgetsInfoFromServer() {
$http({
url: '/xmlhttp.do',
method: 'POST',
params: {
sysparm_processor: 'SPDiagnosticsDriver',
sysparm_name: 'categorize',
sysparm_instances_array: JSON.stringify(diagnostics.instanceArr)
},
dataType: 'json'
}).then(function (response) {
var element = (new DOMParser().parseFromString(response.data, 'text/xml')).getElementsByTagName('xml')[0];
var answer = element.getAttribute('answer');
mergeWidgetsInfo(JSON.parse(answer));
addWidgetCategoryClasses();
addLegendToPage();
$('[data-toggle="popover"]').popover({
html: true,
content: function () {
return $('#widget-legend-wrapper').html();
}
});
});
}
function mergeWidgetsInfo(serverObj) {
var instances = Object.keys(serverObj);
var size = instances.length;
for (var i = 0; i < size; i++) {
var instanceMap = diagnostics.instances.filter(function (item) {
return item['instanceId'] === instances[i];
});
$.extend(true, instanceMap[0], serverObj[instances[i]]);
}
}
function addWidgetCategoryClasses() {
var label = diagnostics.i18nStrings.open_diagnostics_info;
diagnostics.instances.forEach(function (item) {
var details = item['widgetCustDetails'];
var category = details['category'];
var elem = $($.parseHTML(diagnosticIcon));
elem.attr('aria-label', details.name.concat(' ').concat(diagnostics.widgetMsgs[category]).concat(' ').concat(diagnostics.i18nStrings.widget).concat('-').concat(label));
var elemId = item['elementId'];
var domElem;
if (!!item.isEmbeddedWidget) {
domElem = document.querySelectorAll('[class*=' + elemId + ']');
$(domElem).each(function (index, _domElem) {
var _cloneElem = elem.clone();
$(_domElem).innerHeight() == 0 ? _cloneElem.addClass('widget-is-empty') : '';
_cloneElem.insertBefore($(_domElem).children()[0]);
});
} else {
domElem = $('#' + elemId);
domElem.innerHeight() == 0 ? elem.addClass('widget-is-empty') : '';
elem.insertBefore(domElem.contents()[0]);
}
$(domElem).addClass(diagnostics.widgetClasses[category]);
});
}
function disableDiagnostics() {
var widgetClasses = diagnostics.widgetClasses.join(' ');
body.removeAttr('data-widget-diagnostics-mode');
$(document).off('click', '.widget-diagnostics-info');
diagnostics.instances.forEach(function (item) {
var elemId = item['elementId'];
var domElem;
if (!!item.isEmbeddedWidget) {
domElem = document.querySelectorAll('[class*=' + elemId + ']');
$(domElem).each(function (index, _domElem) {
var $_domElem = $(_domElem);
$_domElem.removeClass(widgetClasses);
$_domElem.find('.widget-diagnostics-info').remove();
});
} else {
domElem = $('#' + elemId);
domElem.removeClass(widgetClasses);
domElem.find('.widget-diagnostics-info').remove();
}
$("#" + $('.legend-icon').attr('aria-describedby')).remove();
$('.legend-icon').remove();
$('#widget-legend-wrapper').remove();
});
locationChangeHandle();
diagnostics.isEnabled = false;
}
return {
diagnostics: diagnostics,
enableDiagnostics: enableDiagnostics,
disableDiagnostics: disableDiagnostics
};
});
;
/*! RESOURCE: /scripts/app.$sp/service.spScUtil.js */
angular.module('sn.$sp').factory('spScUtil', function($http, $q, $log, $window, spSCConf, $httpParamSerializer, spUtil, i18n) {
"use strict";
var baseCatalogUrl = "/api/sn_sc/v1/servicecatalog/";
var baseTableApi = "/api/now/table/";
var angProcessorUrl = "angular.do";
function addAdditionalParms(req, parms) {
for (var key in parms)
req[key] = parms[key];
}
function getCart() {
return $http.get(baseCatalogUrl + "cart");
}
function submitProducer(producerId, variables, newRecordID, additionalParms) {
var request = { 'variables': variables, 'sysparm_item_guid': newRecordID, 'get_portal_messages': 'true', sysparm_no_validation: 'true' };
addAdditionalParms(request, additionalParms);
return $http.post(baseCatalogUrl + "items/" + producerId + "/submit_producer", request).then(null, onFail);
}
function submitStdChgProducer(producerId, twoStep, currentVersion, newRecordID, portalSuffix, additionalParms, chgModel) {
var promise;
if (twoStep) {
var urlParameters = {};
urlParameters["sys_id"] = '-1';
urlParameters["id"] = 'form';
urlParameters["table"] = 'change_request';
if (chgModel)
urlParameters["query"] = 'chg_model=' + chgModel + '^std_change_producer_version=' + currentVersion;
else
urlParameters["query"] = 'type=standard^std_change_producer_version=' + currentVersion;
var targetQuery = additionalParms && additionalParms["target_query"] ? additionalParms["target_query"] : "";
var parentSysId = additionalParms && additionalParms["sysparm_parent_sys_id"] ? additionalParms["sysparm_parent_sys_id"] : "";
var targetQueryFieldsAndValues = parseEncodedQuery(targetQuery);
if (!targetQueryFieldsAndValues.hasOwnProperty("parent") && parentSysId)
urlParameters["query"] += "^parent=" + parentSysId;
if (targetQuery)
urlParameters["query"] += '^' + targetQuery;
var completeUrl = portalSuffix + '?' + $httpParamSerializer(urlParameters);
var resp = {};
resp['redirect_portal_url'] = completeUrl;
resp['redirect_url'] = completeUrl;
resp['table'] = 'change_request';
promise = $q.resolve({ data: { result: resp } });
} else {
promise = this.submitProducer(producerId, {}, newRecordID, null);
promise.then(function(response) {
var params;
if (additionalParms && additionalParms["target_query"]) {
var pairs = additionalParms["target_query"].split('^');
params = {};
pairs.forEach(function(pair) {
pair = pair.split('=');
params[pair[0]] = pair[1];
});
}
var table = response.data.result.table;
var recordId = response.data.result.sys_id;
if (table && recordId && params)
$http.patch(baseTableApi + table + '/' + recordId, params);
});
}
return promise;
}
function orderNow(itemId, quantity, variables, newRecordID, additionalParms, alsoRequestFor) {
var request = { 'sysparm_quantity': quantity, 'variables': variables, 'sysparm_item_guid': newRecordID, 'get_portal_messages': 'true', sysparm_no_validation: 'true', 'sysparm_also_request_for': alsoRequestFor };
addAdditionalParms(request, additionalParms);
return $http.post(baseCatalogUrl + "items/" + itemId + "/order_now", request).then(null, onFail);
}
function addToCart(itemId, quantity, variables, newRecordID, alsoRequestFor) {
return $http.post(baseCatalogUrl + "items/" + itemId + "/add_to_cart", { 'sysparm_quantity': quantity, 'variables': variables, 'sysparm_item_guid': newRecordID, sysparm_no_validation: 'true', 'sysparm_also_request_for': alsoRequestFor }).then(null, onFail);
}
function updateCart(itemId, quantity, variables) {
return $http.put(baseCatalogUrl + "cart/" + itemId, { 'sysparm_quantity': quantity, 'variables': variables, sysparm_no_validation: 'true' }).then(null, onFail);
}
function addToWishlist(itemId, quantity, variables, newRecordID) {
return $http.post(baseCatalogUrl + "items/" + itemId + "/add_to_wishlist", { 'sysparm_quantity': quantity, 'variables': variables, 'sysparm_item_guid': newRecordID }).then(null, onFail);
}
function orderWishlistedItem(itemId, quantity, variables, savedItemId, additionalParms) {
var request = { 'sysparm_quantity': quantity, 'variables': variables, 'saved_item_id': savedItemId, 'get_portal_messages': 'true', sysparm_no_validation: 'true' };
addAdditionalParms(request, additionalParms);
return $http.post(baseCatalogUrl + "items/" + itemId + "/order_now", request).then(null, onFail);
}
function addWishlistedItemToCart(itemId, quantity, variables, savedItemId) {
return $http.post(baseCatalogUrl + "items/" + itemId + "/add_to_cart", { 'sysparm_quantity': quantity, 'variables': variables, 'saved_item_id': savedItemId, sysparm_no_validation: 'true' }).then(null, onFail);
}
function submitWishlistedProducer(producerId, variables, savedItemId, additionalParms) {
var request = {'variables': variables, 'sysparm_item_guid': savedItemId, 'get_portal_messages': 'true', 'saved_item_id': savedItemId, sysparm_no_validation: 'true'};
addAdditionalParms(request, additionalParms);
return $http.post(baseCatalogUrl + "items/" + producerId + "/submit_producer", request).then(null, onFail);
}
function getDisplayValueForMultiRowSet(multiRowSetId, value) {
var params = {};
params['sysparm_value'] = value;
var url = baseCatalogUrl + "variables/" + multiRowSetId + "/display_value";
return $http.post(url, params).then(null, onFail);
}
function onFail(response) {
$log.info("REST Failure");
$log.info(response);
if (!isCustomRestException(response))
spUtil.addErrorMessage(i18n.getMessage("Something went wrong and your request could not be submitted. Please contact your system administrator"));
return $q.reject(response);
}
function isCustomRestException(response) {
if (response.data.result && response.data.result.errMsg)
return true;
return false;
}
function isCatalogVariable(field) {
return ('' + field[spSCConf._CAT_VARIABLE]) == 'true';
}
function isRegexDone(fields) {
return isServerValidationDone(fields);
}
function isServerValidationDone(fields) {
for (var field in fields) {
if (fields.hasOwnProperty(field) && fields[field].isServerValidationDone === false)
return false;
}
return true;
}
function queryRecord(table, recordId) {
return $http.get(baseTableApi + table + '/' + recordId);
}
function queryMultipleRecords(table, queryObj) {
var query = "";
for (var obj in queryObj)
query += obj + "=" + queryObj[obj] + '&';
return $http.get(baseTableApi + table + '?' + query);
}
function validateRegex(variableId, value) {
var params = {};
params['sysparm_value'] = value;
var url = baseCatalogUrl + "variables/" + variableId + "/validate_regex";
return $http.post(url, params).then(null, onFail);
}
function validateRequestedForAccess(itemId, value) {
var url = baseCatalogUrl + "items/" + itemId + "/delegation/" + value;
return $http.get(url).then(function(response) {
if (!response.data.result.result)
return $q.reject(response);
});
}
function validateDelegationForMultipleUsers(itemId, userSysIds) {
var url = baseCatalogUrl + "items/" + itemId + "/get_invalid_delegated_users";
var request = { 'sysparm_also_request_for': userSysIds }
return $http.post(url, request).then(function(response) {
if (response.data.result.invalidUsers.length > 0)
return $q.reject(response);
});
}
function isPublicUser() {
var n = $.param({
sysparm_type: 'get_user',
sysparm_ck: $window.g_ck,
});
return $http.post(angProcessorUrl + '?' + n);
}
function getPreference(pref, callback) {
isPublicUser().then(function(response) {
if (response.data.userName !== 'guest')
spUtil.getPreference(pref, callback);
else
callback("");
});
}
function setPreference(pref, value) {
isPublicUser().then(function(response) {
if (response.data.userName !== 'guest')
spUtil.setPreference(pref, value);
});
}
function saveVariables(tableName, tableSysId, variablesData) {
$http.put(baseCatalogUrl + "variables/" + tableName + "/" + tableSysId, variablesData).then(null, onFail);
}
function parseEncodedQuery(queryString) {
var fieldsAndValues = {};
if (!queryString || !queryString.match(/=/g))
return fieldsAndValues;
var queryStringElements = queryString.replaceAll("^^", "&hat;").split("^");
queryStringElements.forEach(function(element) {
if (!element.match(/=/g))
return;
var fieldAndValue = element.split("=");
if (!fieldAndValue[0])
return;
fieldsAndValues[fieldAndValue[0]] = fieldAndValue.splice(1).join("=").replaceAll("&hat;", "^^");
});
return fieldsAndValues;
}
return {
getCart: getCart,
submitProducer: submitProducer,
submitStdChgProducer: submitStdChgProducer,
orderNow: orderNow,
addToCart: addToCart,
updateCart: updateCart,
addToWishlist: addToWishlist,
orderWishlistedItem: orderWishlistedItem,
addWishlistedItemToCart: addWishlistedItemToCart,
submitWishlistedProducer: submitWishlistedProducer,
getDisplayValueForMultiRowSet: getDisplayValueForMultiRowSet,
isCatalogVariable: isCatalogVariable,
queryRecord: queryRecord,
queryMultipleRecords: queryMultipleRecords,
isRegexDone: isRegexDone,
validateRegex: validateRegex,
validateRequestedForAccess: validateRequestedForAccess,
validateDelegationForMultipleUsers: validateDelegationForMultipleUsers,
isServerValidationDone: isServerValidationDone,
getPreference: getPreference,
setPreference: setPreference,
saveVariables: saveVariables
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spCatItem.js */
angular.module("sn.$sp").directive('spCatItem', function ($http, $rootScope, i18n, spModal, spUtil) {
return {
restrict: 'E',
link: function(scope, element, attrs) {
scope.item = scope.$eval(attrs.item);
},
controller: function($scope) {
var c = this;
c.priceHasChanged = function(p, parms) {
if (parms.force_update)
return true;
var changed = false;
var t = parms.recurring_price + p.recurring_price;
if (t != p.recurring_total) {
changed = true;
p.recurring_total = t;
}
t = parms.price + p.price;
if (t != p.price_total) {
changed = true;
p.price_total = parms.price + p.price;
}
return changed;
};
c.getItemId = function () {
return $scope.item.sys_id;
};
c.formatPrice = function(data) {
var response = data.answer;
var t = $scope.item;
t.price = t.recurring_price = "";
t.price = response.price;
t.price_subtotal = response.price_subtotal;
t.recurring_price = response.recurring_price;
t.recurring_price_subtotal = response.recurring_price_subtotal;
t.price_display = response.price_display;
t.recurring_price_display = response.recurring_price_display;
t.price_subtotal_display = response.price_subtotal_display;
t.recurring_price_subtotal_display = response.recurring_price_subtotal_display;
};
var g_form;
$scope.$on('spModel.gForm.initialized', function(e, gFormInstance){
if (gFormInstance.getSysId() != c.getItemId())
return;
g_form = gFormInstance;
var scMandatoryAttachMessage = i18n.getMessage("Attachment(s) are not added");
var scAttachmentDeletionMessage = i18n.getMessage("Please wait, attachment deletion in progress");
g_form.$private.events.on('onSubmit', function () {
if ($scope.item.attachment_action_in_progress) {
var _response = spUtil.addErrorMessage(scAttachmentDeletionMessage);
var handledMessage = _response !== false;
if (!handledMessage)
spModal.alert(scAttachmentDeletionMessage);
return false;
}
if ($scope.item.mandatory_attachment) {
if (!$scope.item.attachment_submitted && !($scope.attachments && $scope.attachments.length > 0)) {
var _response = spUtil.addErrorMessage(scMandatoryAttachMessage);
var handledMessage = _response !== false;
if (!handledMessage)
spModal.alert(scMandatoryAttachMessage);
return false;
}
}
return true;
});
});
function getCalculatedPrices() {
if (!g_form)
return;
var o = {};
o.sys_id = g_form.$private.options('itemSysId');
o.sysparm_id = o.sys_id;
o.variable_sequence1 = g_form.$private.options('getFieldSequence')();
var getFieldParams = g_form.$private.options('getFieldParams');
if (getFieldParams) {
angular.extend(o, getFieldParams());
}
var transform = function(data){
for (var key in data) {
if (key.indexOf("IO") == 0 && Array.isArray(data[key]))
data[key] = JSON.stringify(data[key]);
}
return $.param(data);
}
var config = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
transformRequest : transform
};
$http.post(spUtil.getURL('update_price'), o, config).success(c.formatPrice);
}
$scope.$on('variable.price.change', function(evt, parms) {
var p = $scope.item._pricing;
if (c.priceHasChanged(p, parms)) {
getCalculatedPrices();
}
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spChoiceList.js */
angular.module('sn.$sp').directive('spChoiceList', function($timeout, spUtil, $http, i18n, select2EventBroker, spAriaFocusManager) {
var defaultPlaceholder = '    ';
return {
template: '<select name="{{::field.name}}" id="sp_formfield_{{::field.name}}" ng-model="fieldValue" ng-model-options="{getterSetter: true}" sn-select-width="auto" ng-disabled="field.isReadonly()" ng-options="c.value as getLabel(c) for c in field.choices track by getVal(c.value)"></select>',
restrict: 'E',
replace: true,
require: 'ngModel',
scope: {
'field' : '=',
'getGlideForm': '&glideForm',
'snOnBlur': "&",
'snOptions': "=?",
'setDefaultValue': '&defaultValueSetter'
},
link: function (scope, element, attrs, ngModel) {
scope.getVal = function(v) {
return v;
};
scope.getLabel = function(c) {
if (c.priceLabel) {
return c.label.concat(c.priceLabel);
} else {
return c.label;
}
}
var g_form = scope.getGlideForm();
var field = scope.field;
var isOpen = false;
scope.bEnsureChoice = false;
scope.fieldValue = function() {
return field.value;
};
if (g_choices_show_missing && field.value) {
var isFieldValueInChoiceList = field.choices.some(function(choice) {
return (field.value == choice.value);
});
if (!isFieldValueInChoiceList)
ensureChoice(field);
}
g_form.$private.events.on('change', function(fieldName, oldValue, newValue) {
if (fieldName == field.name) {
if (newValue !== oldValue && g_choices_show_missing)
ensureChoice(field);
} else if (fieldName == field.dependentField) {
field.dependentValue = newValue;
refreshChoiceList();
} else if (typeof field.variable_name !== 'undefined' && field.reference_qual && isRefQualElement(fieldName)) {
refreshReferenceChoices();
}
element.parent().find(".select2-focusser").attr("aria-label", getAriaLabel());
element.parent().find(".select2-focusser").attr("aria-required", field.isMandatory());
});
function isRefQualElement(fieldName) {
var refQualElements = getRefQualElements();
return field.reference_qual.indexOf(fieldName) != -1 || refQualElements.indexOf(fieldName) != -1;
}
function refreshChoiceList() {
var params = {};
params.table = g_form.getTableName();
params.field = field.name;
params.sysparm_dependent_value = field.dependentValue;
params.sysparm_type = 'choice_list_data';
var url = spUtil.getURL(params);
return $http.get(url).success(function(data) {
field.choices = [];
g_form.$private.clearOptionStack(field.name);
angular.forEach(data.items, function(item){
field.choices.push(item);
});
selectValueOrNone();
});
}
function ensureChoice(field) {
var choice;
field.choices.some(function (c) {
if (c.value === field.value) {
choice = c;
return true;
}
});
if (!choice && field.value !== "") {
choice = {
value: field.value,
label: field.displayValue || field.value
};
g_form.addOption(field.name, choice.value, choice.label);
}
return choice;
}
function selectValueOrNone() {
var hasSelectedValue = false;
angular.forEach(field.choices, function(c) {
if (field.value == c.value)
hasSelectedValue = true;
});
if (!hasSelectedValue && field.value && scope.bEnsureChoice && field.dependentField) {
var choice = ensureChoice(field);
g_form.setValue(field.name, choice.value, choice.label);
refreshChoiceList();
return;
}
else if (!hasSelectedValue && field.choices.length > 0) {
var defaultValue = field.choices[0].value;
var defaultLabel = field.choices[0].label;
for (var i = 0; i < field.choices.length; ++i) {
var choice = field.choices[i];
if (field.default_value === choice.value) {
defaultValue = choice.value;
defaultLabel = choice.label;
break;
}
}
scope.setDefaultValue({
fieldName: field.name,
fieldInternalValue: defaultValue,
fieldDisplayValue: defaultLabel
});
}
element.select2('val', ngModel.$viewValue);
if (isOpen)
element.select2("close").select2("open");
}
function refreshReferenceChoices() {
var params = {};
params['qualifier'] = field.reference_qual;
params['table'] = field.lookup_table;
params['o'] = field.lookup_label || field.lookup_value;
params['sysparm_include_variables'] = true;
params['variable_ids'] = field.sys_id;
var getFieldSequence = g_form.$private.options('getFieldSequence');
if (getFieldSequence) {
params['variable_sequence1'] = getFieldSequence();
}
var itemSysId = g_form.$private.options('itemSysId');
params['sysparm_id'] = itemSysId;
params['sysparm_query_refs'] = false;
var getFieldParams = g_form.$private.options('getFieldParams');
if (getFieldParams) {
angular.extend(params, getFieldParams());
}
params.sysparm_type = 'sp_ref_list_data';
var url = spUtil.getURL({sysparm_type: 'sp_ref_list_data'});
return $http.post(url, params).then(function(response){
if (!response.data)
return;
field.choices = [];
g_form.$private.clearOptionStack(field.name);
angular.forEach(response.data.items, function(item){
item.label = item.$$displayValue;
item.value = item.sys_id;
field.choices.push(item);
});
if (field.choices.length === 0)
g_form.clearValue(scope.field.name);
else
selectValueOrNone();
scope.$emit('sp.sc.refresh_label_choices', field);
});
}
if (typeof field.variable_name !== 'undefined' && field.reference_qual && shouldRefreshChoicesOnLoad())
refreshReferenceChoices();
function shouldRefreshChoicesOnLoad() {
var refQualElements = getRefQualElements();
for (var i = 0; i < refQualElements.length; i++) {
var dependentFieldName = refQualElements[i];
if(!dependentFieldName)
continue;
var dependentFieldObj = g_form.$private.getField(dependentFieldName);
if (dependentFieldObj && dependentFieldObj.value != dependentFieldObj.originalValue) {
return true;
}
}
return false;
}
function getRefQualElements() {
var refQualElements = [];
if (field && field.attributes && field.attributes.indexOf('ref_qual_elements') > -1) {
var attributes = spUtil.parseAttributes(field.attributes);
refQualElements = attributes['ref_qual_elements'].split(';');
}
return refQualElements;
}
var pcTimeout;
function updateOptions() {
$timeout.cancel(pcTimeout);
pcTimeout = $timeout(function() {
field.choices = applyOptionStack(field.choices, field.optionStack);
scope.bEnsureChoice = true;
selectValueOrNone();
scope.bEnsureChoice = false;
}, 35);
}
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
if (propertyName == "optionStack") {
updateOptions();
}
});
scope.$watch('field.optionStack', function() {
if (field.optionStack) {
updateOptions();
}
});
updateOptions();
function applyOptionStack(options, optionStack) {
if (!optionStack || optionStack.length == 0) {
return options;
}
var newOptions = angular.copy(options);
if (!newOptions) {
newOptions = [];
}
optionStack.forEach(function(item) {
switch (item.operation) {
case 'add':
for(var o in newOptions) {
if (newOptions[o].label == item.label)
return;
}
var newOption = {
label: item.label,
value: item.value
};
if (typeof item.index === 'undefined') {
newOptions.push(newOption);
} else {
newOptions.splice(item.index, 0, newOption);
}
break;
case 'remove':
var itemValue = String(item.value);
for (var i = 0, iM = newOptions.length; i < iM; i++) {
var optionValue = String(newOptions[i].value);
if (optionValue !== itemValue) {
continue;
}
newOptions.splice(i, 1);
break;
}
break;
case 'clear':
newOptions = [];
break;
default:
}
});
return newOptions;
}
var lookupMsg = jQuery("<span class='sr-only' />");
lookupMsg.text(i18n.getMessage("Lookup using list"));
function setAccessiblePlaceholder() {
if (!field.value && getPlaceholder() === defaultPlaceholder)
element.parent().find('.select2-chosen').append(lookupMsg);
if (defaultPlaceholder !== getPlaceholder())
element.parent().find('.select2-input').attr('placeholder', getPlaceholder());
}
function getPlaceholder() {
var ph = defaultPlaceholder;
if (field.placeholder)
ph = field.placeholder;
if (scope.snOptions && scope.snOptions.placeholder)
ph = scope.snOptions.placeholder;
return ph;
}
if (angular.isFunction(element.select2)) {
var config = {
allowClear: false,
placeholder : getPlaceholder(),
width: '100%'
};
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
i18n.getMessage('No matches found', function(msg) {
config.formatNoMatches = function() {
return msg;
};
});
i18n.getMessage('Loading more results...', function(msg) {
config.formatLoadMore = function() {
return msg;
};
});
element.select2(config).focus(function() {
element.select2('focus');
});
$(element).on("select2.disabled.toggle",function(element){
spAriaFocusManager.enableFocusOnDisabledSelect2(element);
});
element.bind("change select2-removed", function(e) {
e.stopImmediatePropagation();
if (e.added) {
var selectedItem = e.added;
g_form.setValue(field.name, selectedItem.id, selectedItem.text);
} else if (e.removed) {
g_form.clearValue(scope.field.name);
}
});
element.parent().find(".select2-input").attr("autocomplete", "off");
setAccessiblePlaceholder();
element.bind("select2-blur", function() {
scope.snOnBlur();
g_form.setValue(field.name, field.value, field.displayValue);
});
element.bind("select2-opening", function() {
select2EventBroker.publishSelect2Opening();
});
element.bind("select2-open", function(){
if (element.data('select2').search.val() === " ")
element.select2("search", "");
isOpen = true;
element.parent().find(".select2-focusser").attr("aria-expanded", isOpen);
});
element.bind("select2-close", function(){
isOpen = false;
element.parent().find(".select2-focusser").attr("aria-expanded", isOpen);
});
ngModel.$render = function() {
if (ngModel.$viewValue === "" || ngModel.$viewValue === null)
selectValueOrNone();
element.select2('val', ngModel.$viewValue);
};
}
scope.$evalAsync(function() {
var select2Focusser = element.parent().find('.select2-focusser');
var select2Results = element.parent().find('ul.select2-results');
select2Focusser.removeAttr('aria-labelledby');
select2Focusser.attr('aria-label', getAriaLabel());
select2Focusser.attr('aria-required', field.isMandatory());
select2Focusser.attr('aria-expanded', isOpen);
select2Focusser.attr('aria-owns', select2Results.attr('id'));
select2Results.attr('aria-label', field.label);
var container = element.parent().find('.select2-container');
if (container && container.length > 0) {
container.attr('id', (container.attr('id') || 's2id_sp_formfield_{{::field.name}}').replace(/{{::field.name}}/, field.name));
}
});
function getAriaLabel() {
var label = "";
label += field.label;
if (field.displayValue || field.value) {
label += (" " + (field.displayValue || field.value));
}
return label;
}
function getTitle() {
return (field.hint ? (field.label + ' ' + field.hint) : field.label);
}
var select2Choice = element.parent().find(".select2-choice");
select2Choice.attr("aria-hidden", true);
select2Choice.addClass('form-control');
element.parent().find(".select2-offscreen").text(getTitle());
element.parent().find(".select2-focusser").on("keydown", function(e) {
if (e.which === 40 || e.which === 38)
element.select2('open');
});
var el = element.parent().find(".select2-focusser")[0];
if(el) {
var currentBindings = $._data(el, 'events')["keydown"];
if ($.isArray(currentBindings))
currentBindings.unshift(currentBindings.pop());
}
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spRadioOption.js */
angular.module('sn.$sp').directive('spRadioOption', function (spUtil, $http) {
var REF_QUAL_ELEMENTS = "ref_qual_elements";
function isRefQualElement(field, fieldName) {
var refQualElements = getRefQualElements(field);
return field.reference_qual.indexOf(fieldName) != -1 || refQualElements.indexOf(fieldName) != -1;
}
function getRefQualElements(field) {
var refQualElements = [];
if (field && field.attributes && field.attributes.indexOf('ref_qual_elements') > -1) {
var attributes = spUtil.parseAttributes(field.attributes);
refQualElements = attributes[REF_QUAL_ELEMENTS].split(';');
}
return refQualElements;
}
return {
template: '<ng-include src="getTemplateUrl()" />',
restrict: 'E',
scope: {
'field': '=',
'getGlideForm': '&glideForm',
'catItemSysId': '=?'
},
link: function (scope, element, attrs) {
var g_form = scope.getGlideForm();
var field = scope.field;
var radioButtons = [];
var valueToRadioButtonMap = {};
keyCode = Object.freeze({
'RETURN': 13,
'SPACE': 32,
'LEFT': 37,
'UP': 38,
'RIGHT': 39,
'DOWN': 40
});
scope.onButtonLoad = function () {
var rb = element.find('input[type="radio"]').last();
radioButtons.push(rb[0]);
rb.on('keydown', onKeyDown);
rb.on('click', onClick);
if (this && this.c && angular.isDefined(this.c.value))
valueToRadioButtonMap[this.c.value] = rb[0];
}
scope.getTemplateUrl = function () {
return field.choice_direction === 'across' || field.type == 'numericscale' ? 'sp_element_radio_across.xml' : 'sp_element_radio_down.xml';
}
scope.fieldValue = function (newValue, displayValue) {
if (angular.isDefined(newValue)) {
g_form.setValue(field.name, newValue, displayValue);
if (newValue !== field.value && valueToRadioButtonMap.hasOwnProperty(field.value))
setChecked(valueToRadioButtonMap[field.value]);
}
return field.value;
};
initializeValue();
g_form.$private.events.on('change', function (fieldName, oldValue, newValue) {
if (fieldName == field.name && newValue !== oldValue)
getSelectedValueInChoices();
else if (fieldName == field.dependentField) {
field.dependentValue = newValue;
refreshChoiceList();
} else if (typeof field.variable_name !== 'undefined' && field.reference_qual && isRefQualElement(field, fieldName))
refreshReferenceChoices();
});
function getSelectedValueInChoices() {
var choice;
(Array.isArray(field.choices)) && field.choices.some(function (c) {
if (field.value == c.value) {
choice = c;
return choice;
}
});
if (g_choices_show_missing && !choice && field.value !== "") {
choice = {
value: field.value,
label: field.displayValue || field.value
};
field.choices.push(choice);
}
return choice;
}
function refreshChoiceList() {
var params = {};
params.table = g_form.getTableName();
params.field = field.name;
params.sysparm_dependent_value = field.dependentValue;
params.sysparm_type = 'choice_list_data';
var url = spUtil.getURL(params);
return $http.get(url).success(function(data) {
field.choices = [];
angular.forEach(data.items, function(item) {
field.choices.push(item);
});
selectValueOrNone();
});
}
function selectValueOrNone() {
var hasSelectedValue = false;
angular.forEach(field.choices, function(c) {
if (field.value == c.value) {
hasSelectedValue = true;
}
});
if (!hasSelectedValue && field.value && field.dependentField) {
var choice = getSelectedValueInChoices();
if (choice) {
g_form.setValue(field.name, choice.value, choice.label);
refreshChoiceList();
return;
}
}
if (!hasSelectedValue && field.choices.length > 0)
g_form.setValue(field.name, field.choices[0].value, field.choices[0].label);
}
function initializeValue() {
var isFieldValueInChoiceList = field.choices.some(function(choice) {
return (field.value == choice.value);
});
if (!isFieldValueInChoiceList)
getSelectedValueInChoices();
}
function refreshReferenceChoices() {
var params = {};
params['qualifier'] = field.reference_qual;
params['table'] = field.lookup_table;
params['sysparm_include_variables'] = true;
params['variable_ids'] = field.sys_id;
var getFieldSequence = g_form.$private.options('getFieldSequence');
if (getFieldSequence) {
params['variable_sequence1'] = getFieldSequence();
}
var itemSysId = g_form.$private.options('itemSysId');
params['sysparm_id'] = itemSysId;
params['sysparm_query_refs'] = false;
var getFieldParams = g_form.$private.options('getFieldParams');
if (getFieldParams) {
angular.extend(params, getFieldParams());
}
params.sysparm_type = 'sp_ref_list_data';
var url = spUtil.getURL({ sysparm_type: 'sp_ref_list_data' });
return $http.post(url, params).then(function (response) {
if (!response.data)
return;
field.choices = [];
angular.forEach(response.data.items, function (item) {
item.label = item.$$displayValue;
item.value = item.sys_id;
field.choices.push(item);
});
if (field.choices.length === 0)
g_form.clearValue(scope.field.name);
else
selectValueOrNone();
});
}
if (typeof field.variable_name !== 'undefined' && field.reference_qual && shouldRefreshChoicesOnLoad())
refreshReferenceChoices();
function shouldRefreshChoicesOnLoad() {
var refQualElements = getRefQualElements(field);
for (var i = 0; i < refQualElements.length; i++) {
var dependentFieldName = refQualElements[i];
if(!dependentFieldName)
continue;
var dependentFieldObj = g_form.$private.getField(dependentFieldName);
if (dependentFieldObj && dependentFieldObj.value != dependentFieldObj.originalValue) {
return true;
}
}
return false;
}
function firstRadioButton() {
if (radioButtons == null)
return null;
return radioButtons[0];
};
function lastRadioButton() {
if (radioButtons == null)
return null;
return radioButtons[radioButtons.length - 1];
};
function onKeyDown() {
var flag = false;
switch (event.keyCode) {
case keyCode.SPACE:
case keyCode.RETURN:
setChecked(this);
flag = true;
break;
case keyCode.UP:
case keyCode.LEFT:
setCheckedToPreviousItem(this);
flag = true;
break;
case keyCode.DOWN:
case keyCode.RIGHT:
setCheckedToNextItem(this);
flag = true;
break;
default:
break;
}
if (flag) {
event.stopPropagation();
event.preventDefault();
}
}
function setChecked(currentItem) {
if (currentItem !== null) {
currentItem.click();
currentItem.focus();
}
};
function onClick() {
for (var i = 0; i < radioButtons.length; i++) {
radioButtons[i].setAttribute('aria-checked', false);
radioButtons[i].setAttribute('tabindex', -1);
}
this.setAttribute('aria-checked', true);
this.setAttribute('tabindex', 0);
};
function setCheckedToPreviousItem(currentItem) {
if (currentItem.$$hashKey === firstRadioButton().$$hashKey) {
setChecked(lastRadioButton());
} else {
var currentIndex = getCurrentIndex(currentItem);
if (currentIndex > 0)
setChecked(radioButtons[currentIndex - 1]);
}
};
function setCheckedToNextItem(currentItem) {
if (currentItem.$$hashKey === lastRadioButton().$$hashKey) {
setChecked(firstRadioButton());
} else {
var currentIndex = getCurrentIndex(currentItem);
if (currentIndex > -1)
setChecked(radioButtons[currentIndex + 1]);
}
};
function getCurrentIndex(currentItem) {
var index = -1;
radioButtons.some(function(el, i) {
if (el.$$hashKey === currentItem.$$hashKey) {
index = i;
return true;
}
});
return index;
}
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spCLink.js */
angular.module('sn.$sp').directive('spCLink', function (i18n) {
return {
restrict: 'E',
scope: {
rectangle: '=',
target: '@',
table: '=',
id: '=',
query: '='
},
replace: true,
template: '<span class="sp-convenience-link-wrapper" ng-if="display()"><a href="{{href}}" target="_blank" class="sp-convenience-link">{{getText()}}</a></span>',
link : function(scope, element, attrs, controller) {
scope.display = function() {
return scope.href && window.NOW.sp_debug;
}
var href = '';
if (scope.target) {
var target = scope.target;
if (target == 'form')
href = scope.table + '.do?sys_id=' + scope.id;
if (target == 'kb_article')
href = 'kb_view.do?sysparm_article=' + scope.id;
if (target == 'sc_cat_item')
href = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + scope.id +'&sysparm_catalog_view=catalog_default';
if (target == 'list') {
scope.$watch(function() {
return scope.table + " | " + scope.query;
}, function(newValue, oldValue) {
if (newValue != oldValue)
scope.href = scope.table +'_list.do?sysparm_query=' + scope.query;
})
href = scope.table +'_list.do?sysparm_query=' + scope.query;
}
}
scope.href = href;
scope.getText = function() {
return i18n.getMessage('Open');
}
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spDatePicker.js */
angular.module('sn.$sp').directive('spDatePicker', function (spConf, $rootScope, $document, $window, spAriaUtil, i18n, spDatePickerUtil, select2EventBroker, spUtil) {
var dateFormat = g_user_date_format || spConf.SYS_DATE_FORMAT;
var dateTimeFormat = g_user_date_time_format || spConf.SYS_TIME_FORMAT;
var keyMap = {
ArrowLeft: {date: 'decrementDays', time: null},
Left: {date: 'decrementDays', time: null},
ArrowRight: {date: 'incrementDays', time: null},
Right: {date: 'incrementDays', time: null},
ArrowUp: {date: 'decrementWeeks', time: 'incrementMinutes'},
Up: {date: 'decrementWeeks', time: 'incrementMinutes'},
ArrowDown: {date: 'incrementWeeks', time: 'decrementMinutes'},
Down: {date: 'incrementWeeks', time: 'decrementMinutes'},
AltUp: 'toggleDateTimePicker',
AltArrowUp: 'toggleDateTimePicker',
AltDown: 'toggleDateTimePicker',
AltArrowDown: 'toggleDateTimePicker',
PageUp: {date: 'decrementMonths', time: 'incrementHours'},
PageDown: {date: 'incrementMonths', time: 'decrementHours'},
AltPageUp: {date: 'decrementYears', time: null},
AltPageDown: {date: 'incrementYears' ,time: null},
Home: {date: 'startOfCurrentMonth', time: null},
End: {date: 'endOfCurrentMonth', time: null}
};
var TOGGLE_DATETIME_PICKER = "toggleDateTimePicker";
var DECREMENT_MINUTES = "decrementMinutes";
var oldDateValue, oldInputValue;
const ACTIVE_DAY = '.datepicker-days .day.active div';
const ACTIVE_MONTH = '.datepicker-months span.active', MONTH_ELEMENTS = '.datepicker-months .month';
const ACTIVE_YEAR = '.datepicker-years span.active';
var translations = [];
var iconAriaLabel;
i18n.getMessages(["Date in format", "Use format", "Entered date not valid. Enter date in format", "Show Calendar for {0}", "Toggle date time picker", "month", "year",
"decade", "Toggle", "Previous", "Next", "increment Minutes", "increment Hours", "decrement Minutes", "decrement Hours", "{0} hours. hour picker", "{0} minutes. minute picker", "{0} minutes", "{0} hours"], function(msgs){
translations = msgs;
});
var isChrome = $window.navigator.userAgent.indexOf("Chrome") > -1;
var isSafari = !isChrome && $window.navigator.userAgent.indexOf("Safari") > -1;
var enableDateTranslation = $window.NOW.sp.enableDateTranslation;
function setDisabledFields(picker) {
var showCalenderType = spDatePickerUtil.calendarShowType(picker);
var ariaDisabledFields = picker.widget.find('.datepicker-'+ showCalenderType + " [aria-disabled='true']");
var disabledFields = picker.widget.find('.datepicker-' + showCalenderType + ' .disabled');
if (ariaDisabledFields.length)
ariaDisabledFields.removeAttr('aria-disabled');
if (disabledFields.length)
disabledFields.attr('aria-disabled','true');
}
function onShowDatePicker(picker) {
setArialabels(picker);
setShowDatePickerFocus(picker, picker.date, "open");
repositionDatePickerModal(picker);
setDisabledFields(picker);
if (spDatePickerUtil.datePickerShowType(picker) == 'date')
picker.options.pickTime ? picker.widget.find('.picker-switch.accordion-toggle .flex-row').removeClass('cancelok-hidden') : picker.widget.find('.datepicker').next().removeClass('cancelok-hidden');
picker.element.find('button').addClass('calendarbutton-pressed');
}
function repositionDatePickerModal(picker) {
var mediaQuery = window.matchMedia('(max-width: 767px)');
picker.widget[0].style.height = "";
if (mediaQuery.matches && !spUtil.isMobile()) {
picker.widget[0].classList.add('reposition');
var widgetOuterHeight = picker.widget.outerHeight();
picker.widget[0].style.top = ((window.pageYOffset + widgetOuterHeight/20)/window.innerHeight)*100 + '%';
picker.widget[0].style.left = ((window.innerWidth/2 - picker.widget.outerWidth()/2)/window.innerWidth)*100 + '%';
if (window.innerHeight < widgetOuterHeight && picker.element.parents().hasClass('modal-body')) {
picker.widget[0].style.height = (window.innerHeight*.8) + "px";
picker.widget[0].style.overflowY = "auto";
}
} else
picker.widget[0].classList.remove('reposition');
}
function attachKeyboardEvent(picker) {
picker.widget.on('keydown', $.proxy(onKeydownEvt, this, picker));
picker.widget.on('keyup', $.proxy(onKeyupEvt, this, picker));
picker.widget.on('click', '.datepicker *', $.proxy(onClickEvt, this, picker));
}
function detachKeyboardEvent(picker) {
picker.widget.off('keydown');
picker.widget.off('keyup');
picker.widget.off('click','.datepicker *');
}
function onKeyupEvt(picker, e) {
e.stopPropagation();
e.preventDefault();
}
function onDpToggle(picker, e, openMessage) {
var toggleElement = setToggleElementArialabel(picker);
if (openMessage) {
setArialabel(toggleElement, openMessage + " " + toggleElement.getAttribute('aria-label'));
}
toggleElement.blur();
setTimeout(function() {
toggleElement.focus();
}, 150);
}
function onClickEvt(picker, e) {
var calendarShowType = spDatePickerUtil.calendarShowType(picker),
toggleText = calendarShowType == 'years' ? translations['decade'] : (calendarShowType == 'months' ? translations['year'] : translations['month']),
pickerSwitchAriaLabel = calendarShowType == 'years' ? picker.widget.find('.datepicker-years .picker-switch').html() : picker.widget.find('.datepicker-'+ calendarShowType +' .picker-switch').html() + '. ' + translations['Toggle'] + ' ' + toggleText;
if ($(e.target).is('.day div,.day')) {
setTimeout(function() {
setShowDatePickerFocus(picker, picker.date, "click");
}, 200);
} else if ($(e.target).is(MONTH_ELEMENTS)) {
picker.options.pickTime ? picker.widget.find('.picker-switch.accordion-toggle .flex-row').removeClass('cancelok-hidden') : picker.widget.find('.datepicker').next().removeClass('cancelok-hidden');
picker.widget.find('.datepicker-' + calendarShowType + ' .picker-switch').attr('aria-label', pickerSwitchAriaLabel);
setMonthDayYearArialabel(picker);
setDisabledFields(picker);
} else if ($(e.target).hasClass('picker-switch')) {
picker.options.pickTime ? picker.widget.find('.picker-switch.accordion-toggle .flex-row').addClass('cancelok-hidden') : picker.widget.find('.datepicker').next().addClass('cancelok-hidden');
picker.widget.find('.datepicker-' + calendarShowType + ' .picker-switch').attr('aria-label', pickerSwitchAriaLabel);
setDisabledFields(picker);
} else if ($(e.target).is('.prev,.next,.year')) {
picker.widget.find('.datepicker-' + calendarShowType + ' .picker-switch').attr('aria-label', pickerSwitchAriaLabel);
setDisabledFields(picker);
}
setDayMonthYearArrowElementsArialabel(picker);
}
function setArialabels(picker) {
setMonthDayYearArialabel(picker);
setDayMonthYearArrowElementsArialabel(picker);
if (picker.options.pickTime) {
setToggleElementArialabel(picker);
setTimeArrowElementsArialabel(picker);
setHourMinuteArialabel(picker);
setHourMinutePickersAriaLabel(picker, 'both');
}
}
function setHourMinuteArialabel(picker) {
var minutes = picker.widget.find('.timepicker .minute'),
hours = picker.widget.find('.timepicker .hour');
$(minutes).each(function(index, minute) {
$(minute).attr({
tabindex: '0',
role: 'button',
'aria-label': i18n.format(translations['{0} minutes'], parseInt($(minute).text()))
});
});
$(hours).each(function(index, hour) {
$(hour).attr({
tabindex: '0',
role: 'button',
'aria-label': i18n.format(translations['{0} hours'], parseInt($(hour).text()))
});
});
}
function setHourMinutePickersAriaLabel(picker, flag) {
switch(flag) {
case 'hour':
case 'both':
var hourPicker = picker.widget.find('.timepicker [data-action="showHours"]'),
hourPickerAriaLabel = i18n.format(translations['{0} hours. hour picker'], parseInt(hourPicker.text()));
hourPicker.attr({
tabindex: '0',
role: 'button',
'aria-label': hourPickerAriaLabel
});
if(flag == 'hour')
break;
case 'minute':
var minutePicker = picker.widget.find('.timepicker [data-action="showMinutes"]'),
minutePickerAriaLabel = i18n.format(translations['{0} minutes. minute picker'], parseInt(minutePicker.text()));
minutePicker.attr({
tabindex: '0',
role: 'button',
'aria-label': minutePickerAriaLabel
});
}
}
function setMonthDayYearArialabel(picker) {
if(isSafari) return;
var dates = picker.widget.find('.datepicker .day'),
months = picker.widget.find('.datepicker .month'),
currentDate = moment(picker.date);
$(dates).each(function(index, date) {
var clone = currentDate.clone(),
div = $(date).find('div')[0];
if($(date).hasClass("old")) {
clone.subtract("1", "month");
} else if ($(date).hasClass("new")) {
clone.add("1", "month");
}
clone.date(div.innerHTML);
var dateText = spDatePickerUtil.formattedDate(picker, clone);
div.setAttribute('aria-label', dateText);
});
$(months).each(function(index, month) {
var clone = currentDate.clone(), format = 'MMMM', monthAriaLabel;
clone.month(month.innerHTML);
if (enableDateTranslation) {
monthAriaLabel = moment(clone).format(format);
} else {
monthAriaLabel = moment(clone).locale("en").format(format);
}
month.setAttribute('aria-label', monthAriaLabel);
});
}
function setDayMonthYearArrowElementsArialabel(picker) {
setDayMonthYearArrowElementArialabel(picker, 'days', translations['month']);
setDayMonthYearArrowElementArialabel(picker, 'months', translations['year']);
setDayMonthYearArrowElementArialabel(picker, 'years', translations['decade']);
}
function setDayMonthYearArrowElementArialabel(picker, calendarShowType, toggleText) {
var pickerSwitchAriaLabel = calendarShowType == 'years' ? picker.widget.find('.datepicker-years .picker-switch').html() : picker.widget.find('.datepicker-'+ calendarShowType +' .picker-switch').html() + '. ' + translations['Toggle'] + ' ' + toggleText;
picker.widget.find('.datepicker-' + calendarShowType + ' .prev').attr({'role' : 'button', 'tabindex' : '0', 'title' : translations['Previous'] + ' ' + toggleText,'data-toggle' : 'tooltip','data-placement':'top', 'data-container':'body', 'aria-label' : translations['Previous'] + ' ' + toggleText});
picker.widget.find('.datepicker-' + calendarShowType + ' .next').attr({'role' : 'button', 'tabindex' : '0', 'title' : translations['Next'] + ' ' + toggleText,'data-toggle' : 'tooltip','data-placement':'top', 'data-container':'body', 'aria-label' : translations['Next'] + ' ' + toggleText});
picker.widget.find('.datepicker-' + calendarShowType + ' .picker-switch').attr({'role' : 'button', 'tabindex' : '0', 'aria-label' : pickerSwitchAriaLabel});
}
function setTimeArrowElementsArialabel(picker) {
setTimeArrowElementArialabel(picker, 'increment Minutes');
setTimeArrowElementArialabel(picker, 'decrement Minutes');
setTimeArrowElementArialabel(picker, 'increment Hours');
setTimeArrowElementArialabel(picker, 'decrement Hours');
}
function setTimeArrowElementArialabel(picker, action) {
var arrowElement = picker.widget.find('.timepicker [data-action=' + action.replace(/\s/g, '') + ']');
if (arrowElement.length > 0) {
setArialabel(arrowElement[0], translations[action]);
if (action === 'increment Minutes' || action === 'increment Hours')
setTooltip(arrowElement[0], translations[action], 'top');
else
setTooltip(arrowElement[0], translations[action], 'bottom');
}
}
function setHideDatePickerFocus(picker) {
var calendarButtonElement = picker.element.find('button');
var closeMessage = picker.options.pickTime ? i18n.getMessage('Date time picker is closed.') : i18n.getMessage('Date picker is closed.');
if(calendarButtonElement.length > 0) {
setArialabel(calendarButtonElement[0], closeMessage + ". " + iconAriaLabel);
calendarButtonElement[0].focus();
setTimeout(function() {
setArialabel(calendarButtonElement[0], iconAriaLabel);
}, 3000);
}
}
function setHideDatePickerFocusPrev(picker) {
var previousElement = picker.element.prev();
if (previousElement.length > 0) {
previousElement[0].focus();
}
}
function setToggleElementArialabel(picker) {
var showType = spDatePickerUtil.datePickerShowType(picker),
toggleElement = picker.widget.find('.accordion-toggle a');
if (toggleElement[0])
toggleElement.attr('title', translations['Toggle date time picker']);
setArialabel(toggleElement[0], showTypeMessage(picker) + i18n.getMessage("Toggle date time picker"));
return toggleElement[0];
}
function showTypeMessage(picker) {
return (spDatePickerUtil.datePickerShowType(picker) == 'date') ? i18n.getMessage('Showing date picker.') : i18n.getMessage('Showing date time picker.');
}
function setFocusOnTab(picker) {
var activeEl, calendarShowType = spDatePickerUtil.calendarShowType(picker);
switch(calendarShowType) {
case 'days':
if (picker.widget.find(ACTIVE_DAY).length == 0)
picker.setDate(moment(picker.date).year(picker.widget.find('.datepicker-days .picker-switch').html().slice(-4)).month(picker.widget.find('.datepicker-days .picker-switch').html().slice(0,-5)).date(1));
activeEl = ACTIVE_DAY;
break;
case 'months':
if (picker.widget.find(ACTIVE_MONTH).length == 0)
picker.setDate(moment(picker.date).year(picker.widget.find('.datepicker-months .picker-switch').html()).month(0));
activeEl = ACTIVE_MONTH;
break;
case 'years':
if (picker.widget.find(ACTIVE_YEAR).length == 0)
picker.setDate(moment(picker.date).year(picker.widget.find('.datepicker-years .picker-switch').html().slice(0,4)));
activeEl = ACTIVE_YEAR;
break;
}
picker.widget.find(activeEl).attr({tabindex:'-1',role: 'button'}).focus();
}
function setShowDatePickerFocus(picker, date, action) {
var showType = spDatePickerUtil.datePickerShowType(picker),
formattedDate = spDatePickerUtil.formattedDate(picker, date),
openMessage = getOpenMessage(picker),
calendarShowType = spDatePickerUtil.calendarShowType(picker);
if (action == 'toggleDateTimePicker') {
if (showType == 'date' && calendarShowType == 'days')
picker.widget.find('.picker-switch.accordion-toggle .flex-row').removeClass('cancelok-hidden');
else
picker.widget.find('.picker-switch.accordion-toggle .flex-row').addClass('cancelok-hidden');
}
if (!action || action.indexOf("toggleDateTimePicker") !== -1) {
return;
}
if (showType === "date") {
var dayElement = picker.widget.find('.datepicker-days td.active div');
if (dayElement.length > 0) {
var label = formattedDate;
if (action === "open") {
label = openMessage  + (picker.options.pickTime ? showTypeMessage(picker) : "") + label;
setArialabel(dayElement[0], label);
} else {
if(!isSafari) {
setArialabel(dayElement[0], label);
}
}
dayElement[0].blur();
setTimeout(function() {
dayElement[0].focus();
}, 50);
}
}
if (showType === "time") {
if(action === "open") {
onDpToggle(picker, null, openMessage);
} else if (action === "togglePeriod") {
var togglePeriodElement = picker.widget.find('.timepicker [data-action=' + action + ']');
setArialabel(togglePeriodElement[0], action + " " + togglePeriodElement[0].innerText);
togglePeriodElement[0].blur();
setTimeout(function() {
togglePeriodElement[0].focus();
}, 100);
} else if (action === "selectHour") {
var showHoursEl = picker.widget.find('.timepicker [data-action="showHours"]');
showHoursEl.focus();
setHourMinutePickersAriaLabel(picker, 'hour');
} else if (action === "selectMinute") {
var showMinutesEl = picker.widget.find('.timepicker [data-action="showMinutes"]');
showMinutesEl.focus();
setHourMinutePickersAriaLabel(picker, 'minute');
} else if (action === "showHours") {
var togglePickerEl = picker.widget.find('[data-action="toggleDateTimePicker"]');
togglePickerEl.focus();
spAriaUtil.sendLiveMessage(i18n.getMessage('hour picker opened'), 'status')
} else if (action === "showMinutes") {
var togglePickerEl = picker.widget.find('[data-action="toggleDateTimePicker"]');
togglePickerEl.focus();
spAriaUtil.sendLiveMessage(i18n.getMessage('minute picker opened'), 'status');
} else {
var arrowElement = picker.widget.find('.timepicker [data-action=' + action + ']');
setArialabel(arrowElement[0], action + " " + (isSafari ? "" : formattedDate));
arrowElement[0].blur();
setTimeout(function() {
arrowElement[0].focus();
}, 100);
setHourMinutePickersAriaLabel(picker, 'both');
}
}
}
function getOpenMessage(picker) {
return picker.options.pickTime ? i18n.getMessage('Date time picker is opened.') : i18n.getMessage('Date picker is opened.');
}
function setArialabel(element, label) {
if (element) {
element.setAttribute('aria-label', label);
}
}
function setTooltip(element, label, position) {
if (element) {
element.setAttribute('data-toggle', 'tooltip');
element.setAttribute('title', label);
element.setAttribute('data-placement', position ? position : 'top');
}
}
function onDpAction(e) {
setShowDatePickerFocus(e.picker, e.date, e.action)
}
function onDpChangeAria(e, picker, element) {
if(isSafari) {
var el = element.find('.form-control');
el[0].setAttribute('aria-label', spDatePickerUtil.formattedDayTime(picker, e.date));
}
if (e.date.month() !== e.oldDate.month() || e.date.year() !== e.oldDate.year()) {
setMonthDayYearArialabel(picker);
setDayMonthYearArrowElementsArialabel(picker);
}
}
function hidePicker(picker) {
var input = spDatePickerUtil.getSPDateickerInput(picker);
if (input && (input.val() === '' || input.parent('.has-error').length)) {
picker.setDate(enableDateTranslation ? moment().format(picker.format) : moment().locale("en").format(picker.format));
}
picker.hide();
setHideDatePickerFocus(picker);
}
function setTimeArrowElementFocus(picker, action) {
var arrowElement = picker.widget.find('.timepicker [data-action=' + action + ']');
if (arrowElement[0])
arrowElement[0].focus();
}
function cancelDatePickerValue(picker) {
picker.setDate(oldDateValue);
picker.hide();
setHideDatePickerFocus(picker);
if (oldInputValue == '')
spDatePickerUtil.getSPDateickerInput(picker).val('');
}
function onKeydownEvt(picker, e) {
var showType = spDatePickerUtil.datePickerShowType(picker);
var calendarShowType = spDatePickerUtil.calendarShowType(picker);
var amPmCheck = picker.widget.find('.timepicker [data-action="togglePeriod"]').length ? true : false;
if (e.keyCode === 9) {
if (showType === "date") {
var datePickerfocusableEls = window.tabbable(picker.widget[0]);
var firstFocusableEl = datePickerfocusableEls[0],
nextButtonEl = datePickerfocusableEls[2],
cancelOrTimeButtonEl = datePickerfocusableEls[3],
lastFocusableEl = datePickerfocusableEls[datePickerfocusableEls.length - 1],
dmyEl = calendarShowType == 'days' ? '.datepicker-days td.day div' : '.datepicker-' + calendarShowType + ' span.' + calendarShowType.slice(0,-1);
if (e.shiftKey) {
if (document.activeElement === firstFocusableEl) {
if (!picker.options.pickTime && calendarShowType != 'days')
setFocusOnTab(picker);
else
lastFocusableEl.focus();
e.stopPropagation();
e.preventDefault();
} else if (document.activeElement === cancelOrTimeButtonEl) {
setFocusOnTab(picker);
e.stopPropagation();
e.preventDefault();
} else if ($(e.target).is(dmyEl)) {
nextButtonEl.focus();
e.stopPropagation();
e.preventDefault();
}
} else {
if (document.activeElement === nextButtonEl) {
setFocusOnTab(picker);
e.stopPropagation();
e.preventDefault();
} else if (document.activeElement === lastFocusableEl) {
firstFocusableEl.focus();
e.stopPropagation();
e.preventDefault();
} else if ($(e.target).is(dmyEl)) {
if (!picker.options.pickTime && calendarShowType != 'days')
firstFocusableEl.focus();
else
cancelOrTimeButtonEl.focus();
e.stopPropagation();
e.preventDefault();
}
}
}
if(showType === "time") {
if(picker.widget.find('.timepicker-picker')[0].style.display === 'none'){
var timePickerfocusableEls = window.tabbable(picker.widget[0]);
var firstFocusableElem = timePickerfocusableEls[0],
lastFocusableElem = timePickerfocusableEls[timePickerfocusableEls.length - 1];
if (event.which === 9) {
if (event.shiftKey) {
if (document.activeElement === firstFocusableElem) {
lastFocusableElem.focus();
event.preventDefault();
event.stopPropagation();
}
} else {
if (document.activeElement === lastFocusableElem){
firstFocusableElem.focus();
event.preventDefault();
event.stopPropagation();
}
}
}
return ;
}
if(e.shiftKey) {
e.stopPropagation();
e.preventDefault();
if(($(e.target).parent().hasClass('accordion-toggle') && !amPmCheck) || $(e.target).attr('data-action') === 'togglePeriod') {
setTimeArrowElementFocus(picker, DECREMENT_MINUTES);
} else if($(e.target).attr('data-action') === 'incrementHours') {
var toggleElement = picker.widget.find('.accordion-toggle a');
toggleElement[0].focus();
} else if ($(e.target).attr('data-action') === 'incrementMinutes') {
setTimeArrowElementFocus(picker, 'decrementHours');
} else if ($(e.target).attr('data-action') === 'decrementHours') {
setTimeArrowElementFocus(picker, 'showHours');
} else if ($(e.target).attr('data-action') === 'showHours') {
setTimeArrowElementFocus(picker, 'incrementHours');
} else if($(e.target).attr('data-action') === 'decrementMinutes') {
setTimeArrowElementFocus(picker, 'showMinutes');
} else if($(e.target).attr('data-action') === 'showMinutes') {
setTimeArrowElementFocus(picker, 'incrementMinutes');
} else if($(e.target).parent().hasClass('accordion-toggle')) {
setTimeArrowElementFocus(picker, 'togglePeriod');
}
} else {
if(($(e.target).attr('data-action') === DECREMENT_MINUTES && !amPmCheck) || $(e.target).attr('data-action') === 'togglePeriod') {
e.stopPropagation();
e.preventDefault();
picker.widget.find("[data-action=" + TOGGLE_DATETIME_PICKER + "]").focus();
} else {
e.stopPropagation();
e.preventDefault();
if($(e.target).parent().hasClass('accordion-toggle')) {
setTimeArrowElementFocus(picker, 'incrementHours');
} else if($(e.target).attr('data-action') === 'incrementHours') {
setTimeArrowElementFocus(picker, 'showHours');
} else if($(e.target).attr('data-action') === 'showHours') {
setTimeArrowElementFocus(picker, 'decrementHours');
} else if ($(e.target).attr('data-action') === 'decrementHours') {
setTimeArrowElementFocus(picker, 'incrementMinutes');
} else if ($(e.target).attr('data-action') === 'incrementMinutes') {
setTimeArrowElementFocus(picker, 'showMinutes');
} else if ($(e.target).attr('data-action') === 'showMinutes') {
setTimeArrowElementFocus(picker, 'decrementMinutes');
} else if ($(e.target).attr('data-action') === 'decrementMinutes') {
setTimeArrowElementFocus(picker, 'togglePeriod');
}
}
}
}
return;
}
if (e.keyCode === 13 && $(e.target).attr("data-action")) {
if($(e.target).attr("data-action") !== 'showHours' && $(e.target).attr("data-action") !== 'showMinutes')
return;
}
var arrowKeys = [37,38,39,40];
if (arrowKeys.indexOf(e.keyCode) != -1 && calendarShowType != 'days') {
e.stopPropagation();
e.preventDefault();
var clone = moment(picker.date).clone();
if (e.keyCode == 37) {
clone.subtract('1', calendarShowType.slice(0,-1));
} else if (e.keyCode == 38) {
clone.subtract('4', calendarShowType.slice(0,-1));
} else if (e.keyCode == 39) {
clone.add('1', calendarShowType.slice(0,-1));
} else if (e.keyCode == 40) {
clone.add('4', calendarShowType.slice(0,-1));
}
if (calendarShowType ==  'months')
var prev = picker.date.year();
picker.setDate(clone);
picker.widget.find('.month,.year').attr({'tabindex':'-1', 'role': 'button'});
picker.widget.find('.datepicker-' + calendarShowType +' .active').focus();
if (calendarShowType != 'months' || prev != picker.date.year())
setDisabledFields(picker);
return;
}
e.stopPropagation();
e.preventDefault();
if (e.keyCode === 13) {
$(e.target).click();
if ($(e.target).hasClass('picker-switch')) {
calendarShowType = spDatePickerUtil.calendarShowType(picker);
picker.widget.find('.datepicker-' + calendarShowType + ' .picker-switch').attr({tabindex:'0',role:'button'}).focus();
} else if ($(e.target).is('.month, .year')) {
if ($(e.target).is('.month')) {
var dmyElement = picker.widget.find(ACTIVE_DAY).length ? picker.widget.find(ACTIVE_DAY) : picker.widget.find('.datepicker-days .day:not(.old) div').first();
dmyElement.focus();
} else {
var dmyElement = picker.widget.find(ACTIVE_MONTH).length ? picker.widget.find(ACTIVE_MONTH) : picker.widget.find(MONTH_ELEMENTS).first();
$(dmyElement).attr({tabindex: '-1',role: 'button'});
dmyElement.focus();
}
} else {
$(e.target).blur();
setTimeout(function() {
$(e.target).focus();
}, 100);
}
} else if (e.keyCode === 32) {
setTimeout(function() {
hidePicker(picker);
}, 200);
} else if (e.keyCode === 27) {
cancelDatePickerValue(picker);
} else  {
var maybeAltHandler = e.altKey && keyMap["Alt" + e.key],
action = maybeAltHandler || keyMap[e.key];
if(action && action instanceof Object) {
action = action[showType];
}
if(action) {
if(showType === "time" && action.indexOf("toggle") === -1) {
var arrowElement = picker.widget.find('.timepicker [data-action=' + action + ']');
$(arrowElement[0]).trigger('click');
} else {
var actionEvent = jQuery.Event("doAction", {action: action});
picker.widget.trigger(actionEvent);
setDisabledFields(picker);
}
}
}
if (maybeAltHandler && (e.keyCode === 38 || e.keyCode === 40)) {
var switchMessage = (spDatePickerUtil.datePickerShowType(picker) == 'date') ? i18n.getMessage('Switching to date picker.') : i18n.getMessage('Switching to date time picker.');
spAriaUtil.sendLiveMessage(switchMessage);
}
}
if ($rootScope.user && $rootScope.user.date_format)
dateFormat = $rootScope.user.date_format;
if ($rootScope.user && $rootScope.user.date_time_format)
dateTimeFormat = $rootScope.user.date_time_format;
return {
template:
'<div ng-class="{\'sp-date-input-group\': snDisabled, \'input-group\': !snDisabled, \'has-error\': field.isInvalidDateFormat || field.isInvalid}" style="width: 100%;" role="presentation">' +
'<input id="sp_formfield_{{::field.name}}" aria-live="{{::live}}" aria-hidden="true" aria-label="{{::field.label}} {{formattedDateAria}}" type="text" name="{{field.name}}" class="form-control" placeholder="{{field.placeholder || (!g_accessibility ? format: \'\')}}" title="{{g_accessibility ? translations[\'Date in format\'] + \' \': \'\'}}{{g_accessibility ? format : \'\'}}" data-placement="top" data-toggle="{{g_accessibility ? \'tooltip\' : undefined}}" ng-model="formattedDate" ng-model-options="{updateOn: \'blur\', getterSetter: true}" ng-readonly="snDisabled" aria-required="{{field.isMandatory()}}" aria-invalid="{{field.isInvalidDateFormat}}"/>' +
'<span class="input-group-btn" ng-hide="snDisabled">' +
'<input type="hidden" class="datepickerinput" ng-model="formattedDate" ng-readonly="true" />' +
'<button class="btn btn-default" type="button" role="button" title="{{::iconAriaLabel}}" aria-label="{{::iconAriaLabel}}" data-toggle="tooltip" data-placement="top" data-container="section.page">' +
'<glyph sn-char="calendar" />' +
'</button>' +
'</span>' +
'<span ng-if="field.isInvalidDateFormat" class="sp-date-format-info" style="display:table-row;" aria-hidden="true">{{translations[\'Date in format\']}} {{format}}</span>'+
'</div>',
restrict: 'E',
replace: true,
require: '?ngModel',
scope: {
field: '=',
snDisabled: '=',
snIncludeTime: '=',
snChange: '&',
snMaxDate: '=',
snMinDate: '='
},
controller: function($scope) {
$scope.live = isSafari ? "polite" : "off";
},
link: function(scope, element, attrs, ngModel) {
scope.g_accessibility = spAriaUtil.isAccessibilityEnabled();
iconAriaLabel = i18n.format(translations['Show Calendar for {0}'], scope.field.label);
scope.iconAriaLabel = iconAriaLabel;
var includeTime = scope.snIncludeTime;
var format, isUserEnteredValue = false, initDateTimePicker = true;
var dpValueTouched;
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
format = includeTime ? dateTimeFormat.trim() : dateFormat.trim();
format = format.replace(/y/g, 'Y').replace(/d/g, 'D').replace(/a/g, 'A');
scope.format = format;
var config = {
keepInvalid: true,
pickTime: scope.snIncludeTime === true,
format: scope.format,
locale: spUtil.localeMap[g_lang],
language: spUtil.localeMap[g_lang],
maxDate: scope.snMaxDate,
minDate: scope.snMinDate
};
var dp = element.find('.input-group-btn').datetimepicker(config).on('dp.change', onDpChange);
if (scope.snIncludeTime === true)
$(element.find('.input-group-btn')).data("DateTimePicker").initial_value = scope.field.value;
if (isIE11) {
angular.element('body').on('click', function (e) {
var target = e.target;
var el = angular.element(target);
if ((document.activeElement !== target) && el.hasClass('form-control'))
target.focus();
});
}
element.find('.form-control').on('blur', function (e) {
var value = e.target.value;
setFieldValue('newValue', value);
}).on('keyup', function (e) {
if (e.keyCode === 13) {
var value = e.target.value;
setFieldValue('newValue', value);
} else {
isUserEnteredValue = true;
}
}).on('focus', function (e) {
e.target.removeAttribute('aria-hidden');
});
function validate(formattedDate) {
scope.field.isInvalidDateFormat = false;
scope.field.isInvalid = false;
return spDatePickerUtil.validate(dp, format, formattedDate, isUserEnteredValue, function(error){
if(error){
spAriaUtil.sendLiveMessage(scope.translations["Entered date not valid. Enter date in format"] + " " + format);
scope.field.isInvalidDateFormat = true;
if(g_datepicker_validation_enable)
scope.field.isInvalid = true;
}
});
}
function closeOnTouch(evt) {
if (!jQuery.contains(dp.data('DateTimePicker').widget[0], evt.target)) {
dp.data('DateTimePicker').hide();
}
}
function bindTouchClose() {
oldDateValue = dp.data('DateTimePicker').date.clone(), oldInputValue = spDatePickerUtil.getSPDateickerInput(dp.data('DateTimePicker')).val();
var el = element.find('.form-control');
el[0].removeAttribute('aria-hidden');
if(initDateTimePicker) {
initDateTimePicker = false;
var picker = dp.data('DateTimePicker');
attachKeyboardEvent(picker);
picker.widget.find('table.table-condensed').attr('role', 'presentation');
if (picker.options.pickTime)
picker.widget.find('.picker-switch.accordion-toggle').append('<div class="flex-row cancelok-datetime"><button class="btn cancel">' + i18n.getMessage('Cancel') + '</button><button class="btn ok">' + i18n.getMessage('OK') + '</button></div>');
else
picker.widget.append('<div class="flex-row cancelok-date"><button class="btn cancel">' + i18n.getMessage('Cancel') + '</button><button class="btn ok">' + i18n.getMessage('OK') + '</button></div>');
picker.widget.find('.cancel').on('click', function(e) {
e.stopPropagation();
cancelDatePickerValue(picker);
});
picker.widget.find('.ok').on('click', function(e) {
e.stopPropagation();
hidePicker(picker);
});
}
$document.on('touchstart', closeOnTouch);
attachOnscrollEvent();
onShowDatePicker(dp.data('DateTimePicker'));
}
function unBindTouchClose() {
dp.data('DateTimePicker').element.find('button').removeClass('calendarbutton-pressed');
$document.off('touchstart', closeOnTouch);
detachOnscrollEvent();
}
function detachOnscrollEvent () {
var scrollContainer = $('.sp-scroll');
if(scrollContainer) {
$(scrollContainer[0]).off( "scroll" )
}
var containers = $('.sp-row-content > div .panel .panel-body');
if(containers) {
for (var i = 0; i < containers.length; i++) {
$(containers[i]).off( "scroll" )
}
}
}
function attachOnscrollEvent() {
var lazyPlace = _.debounce(onscrollEvt, 100);
var scrollContainer = $('.sp-scroll');
if(scrollContainer) {
$(scrollContainer[0]).scroll(lazyPlace.bind(null, scrollContainer[0]));
}
var containers = $('.sp-row-content > div .panel .panel-body');
if(containers) {
for (var i = 0; i < containers.length; i++) {
$(containers[i]).scroll(lazyPlace.bind(null, containers[i]));
}
}
}
function onscrollEvt(container) {
var picker = dp.data('DateTimePicker');
if(isElementInViewport(picker.element, container)) {
picker.place(container);
} else {
picker.hide();
}
}
function isElementInViewport(el, scrollContainer) {
if (typeof jQuery === "function" && el instanceof jQuery) {
el = el[0];
}
var rect = el.getBoundingClientRect(),
scrollContainerRect = scrollContainer.getBoundingClientRect();
return (
rect.top >= scrollContainerRect.top &&
rect.left >= scrollContainerRect.left &&
rect.bottom <= scrollContainerRect.bottom &&
rect.right <= scrollContainerRect.right
);
}
dp.on('dp.show', bindTouchClose).on('dp.hide', unBindTouchClose);
dp.on('dp.action', function(e) {
onDpAction(e);
});
dp.on('dp.toggle', function(e) {
onDpToggle(dp.data('DateTimePicker'), e);
});
dp.on('dp.hide', function (e) {
if (ngModel) {
setFieldValue('newValue', scope.field.stagedValue);
}
})
scope.$on('sp.spFormField.unFocus', function() {
validate(scope.field.value);
});
function onDpChange(e) {
isUserEnteredValue = false;
var elem = $(e.target);
if (elem.data("DateTimePicker").initial_value === "" && !dpValueTouched)
reInitializeTime(e, elem);
var translatedDate = enableDateTranslation ? e.date.format(format) : e.date.locale("en").format(format);
scope.formattedDate(translatedDate);
scope.formattedDateAria = spDatePickerUtil.formattedDate(dp.data('DateTimePicker'), e.date);
if (!scope.$root.$$phase)
scope.$apply();
onDpChangeAria(e, dp.data('DateTimePicker'), element);
}
function reInitializeTime(e, elem) {
var now = moment();
e.date.set({
hour: now.get('hour'),
minute: now.get('minute'),
second: now.get('second')
});
elem.data("DateTimePicker").initial_value = null;
}
function setFieldValue(key, value) {
if (scope.snChange) {
var change = {};
change[key] = value;
scope.snChange(change);
}
}
if (ngModel) {
ngModel.$parsers.push(validate);
ngModel.$render = function() {
var formattedDate = ngModel.$viewValue;
if (formattedDate && formattedDate !== null && formattedDate !== '') {
dpValueTouched = true;
if (!spDatePickerUtil.isValidDate(formattedDate, format)) {
var validFormattedDate = null;
if (enableDateTranslation) {
validFormattedDate = moment(formattedDate, format, true).format(format)
} else {
validFormattedDate = moment(formattedDate, format, true).locale("en").format(format);
}
if(validFormattedDate !== "Invalid date") {
formattedDate = validFormattedDate;
}
}
}
validate(formattedDate);
};
scope.formattedDate = function (formattedValue) {
if (angular.isDefined(formattedValue)) {
dpValueTouched = true;
ngModel.$setViewValue(formattedValue);
setFieldValue('stagedValue', formattedValue);
}
var formattedDate = ngModel.$viewValue;
if (formattedDate && formattedDate !== null && formattedDate !== '') {
if(!spDatePickerUtil.isValidDate(formattedDate, format)) {
var validFormattedDate = null;
if (enableDateTranslation) {
validFormattedDate = moment(formattedDate, format, true).format(format)
} else {
validFormattedDate = moment(formattedDate, format, true).locale("en").format(format);
}
if(validFormattedDate !== "Invalid date") {
formattedDate = validFormattedDate;
}
}
} else {
scope.formattedDateAria = '';
}
return formattedDate;
};
} else {
scope.formattedDate = function (formattedValue) {
if (angular.isDefined(formattedValue)) {
scope.field.value = validate(formattedValue);
setFieldValue('newValue', formattedValue);
}
return scope.field.value;
};
scope.$watch('field.value', function(newValue, oldValue){
if (newValue != oldValue)
validate(newValue);
});
}
var select2Unsubscribe = select2EventBroker.subscribeSelect2Opening(function() {
var picker = dp.data('DateTimePicker');
if(picker && $(picker.widget[0]).is(":visible"))
picker.hide();
})
scope.$on('$destroy', function() {
dp.off('dp.change', onDpChange);
if (dp.data('DateTimePicker')) {
unBindTouchClose();
select2Unsubscribe();
detachKeyboardEvent(dp.data('DateTimePicker'));
}
dp.data('DateTimePicker').hide();
});
scope.translations = translations;
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spDatePickerUtil.js */
angular.module('sn.$sp').factory('spDatePickerUtil', function (spAriaUtil, $window) {
var enableDateTranslation = $window.NOW.sp.enableDateTranslation;
var service = {
isValidDate: isValidDate,
validate: validate,
getSPDateickerInput: getSPDateickerInput,
formattedDate: formattedDate,
formattedDayTime: formattedDayTime,
datePickerActionType: datePickerActionType,
datePickerShowType: datePickerShowType,
calendarShowType: calendarShowType
};
function getSPDateickerInput (picker){
var input;
if (picker.isInput) {
return picker.element;
}
input = picker.element.find('.datepickerinput');
if (input.size() === 0) {
input = picker.element.find('input');
}
else if (!input.is('input')) {
throw new Error('CSS class "datepickerinput" cannot be applied to non input element');
}
return input.parent().prev();
}
function formattedDate(picker, date) {
var format = "DD MMMM YYYY",
formattedDate = null,
a = "",
s = "";
if(picker.options.pickTime) {
if(picker.options.format.indexOf("h") !== -1) {
a = " A";
}
if (picker.options.format.indexOf("s") !== -1) {
s = ":ss";
}
format += (a ? " hh" : " HH") + ":mm" + s + a;
}
format += " dddd";
if (enableDateTranslation) {
formattedDate = moment(date).format(format);
} else {
formattedDate = moment(date).locale("en").format(format);
}
return formattedDate;
}
function formattedDayTime(picker, date) {
var format = "",
formattedDate = null,
a = "";
if(picker.options.pickTime) {
if(picker.options.format.indexOf("h") !== -1) {
a = "A";
}
format += a;
}
format += " dddd";
if (enableDateTranslation) {
formattedDate = moment(date).format(format);
} else {
formattedDate = moment(date).locale("en").format(format);
}
return formattedDate;
}
function datePickerActionType(action) {
if (action.indexOf("Hours") !== -1) {
return "hour";
}
return "minute";
}
function datePickerShowType(picker) {
if(!picker.options.pickTime) {
return "date";
}
if(!picker.options.pickDate) {
return "time";
}
var $this = $(picker.widget.find('.accordion-toggle')[0]);
return $this.find('.glyphicon-calendar').length !== 0 ? "time" :"date";
}
function calendarShowType(picker) {
if (picker.widget.find('.datepicker-days').css('display') == 'block')
return "days";
if (picker.widget.find('.datepicker-months').css('display') == 'block')
return "months";
if (picker.widget.find('.datepicker-years').css('display') == 'block')
return "years";
}
function isValidDate(value, format){
if (value === '')
return true;
if (!enableDateTranslation) {
moment.locale("en");
}
if ((typeof format == "string") && (format.indexOf("z") !== -1)) {
return moment(value, format).isValid();
}
return moment(value, format, true).isValid();
}
function validate(dp, format, formattedDate, isUserEnteredValue, cb) {
if (formattedDate == null || formattedDate == '') {
dp.data('DateTimePicker').setValue(new Date());
return '';
}
if (service.isValidDate(formattedDate, format)) {
if (enableDateTranslation) {
formattedDate = moment(formattedDate, format).format(format);
} else {
formattedDate = moment(formattedDate, format).locale("en").format(format);
}
dp.data('DateTimePicker').setDate(moment(formattedDate, format));
cb()
}
else if (service.isValidDate(formattedDate, moment.ISO_8601)) {
var date;
if (isUserEnteredValue)
date = moment(formattedDate).clone();
else
date = moment.utc(formattedDate).clone();
dp.data('DateTimePicker').setDate(date);
if (enableDateTranslation) {
formattedDate = date.format(format);
} else {
formattedDate = date.locale("en").format(format);
}
cb()
}
else {
cb(true);
}
return formattedDate;
}
return service;
})
.run(function($rootScope){
if (typeof moment !== "undefined" && typeof moment.tz !== "undefined") {
var startOfWeek = parseInt(g_date_picker_first_day_of_week);
var updateStartOfWeek = function(){
if (moment.localeData()._week.dow != startOfWeek) {
moment.updateLocale(g_lang, {
week: {
dow: startOfWeek
}
});
}
};
if (isNaN(startOfWeek) || startOfWeek < 1) {
startOfWeek = 0;
} else if (startOfWeek > 7){
startOfWeek = 6;
} else {
startOfWeek = startOfWeek - 1;
}
if (g_lang == 'en')
updateStartOfWeek();
$rootScope.$on('sp.date.depsLoaded', function() {
updateStartOfWeek();
});
moment.tz.setDefault(g_tz);
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spDropdownTree.js */
angular.module('sn.$sp').directive('spDropdownTree', function ($rootScope) {
return {
restrict: 'E',
scope: {items: '='},
replace: true,
template: '<ul class="dropdown-menu">' +
'<li ng-repeat="mi in items" style="min-width: 20em;" ng-init="mi.unique_number = mi.number +\'_\'+ $index" ng-class="{\'dropdown-submenu\': mi.type == \'menu\', \'dropdown-menu-line\':$index < items.length - 1}" ng-include="getURL()" role="presentation">' +
'</ul>',
link : function(scope, element, attrs, controller) {
scope.getURL = function() {
return 'spDropdownTreeTemplate';
}
scope.collapse = function() {
$rootScope.$emit('sp-navbar-collapse');
}
}
}
});
(function($) {
$("body").on( "click", "a.menu_trigger", function(e) {
var current = $(this).next();
var grandparent = $(this).parent().parent();
if ($(this).hasClass('left-caret') || $(this).hasClass('right-caret'))
$(this).toggleClass('right-caret left-caret');
grandparent.find('.left-caret').not(this).toggleClass('right-caret left-caret');
current.toggle();
$(".dropdown-menu").each(function(i, elem) {
var elemClosest = $(elem).closest('.dropdown');
var currentClosest = current.closest('.dropdown');
if (!elem.contains(current[0]) && elem != current[0] && (!currentClosest.length || !elemClosest.length || elemClosest[0] == currentClosest[0]))
$(elem).hide();
})
e.stopPropagation();
});
$("body").on( "click", "a:not(.menu_trigger)", function() {
var root=$(this).closest('.dropdown');
root.find('.left-caret').toggleClass('right-caret left-caret');
});
})(jQuery);
;
/*! RESOURCE: /scripts/app.$sp/factory.spMacro.js */
angular.module('sn.$sp').factory("spMacro", function($log) {
"use strict";
return function($scope, dataPrototype, inputMap, keepFields) {
var gf = $scope.page.g_form;
if (!gf) {
$log.warn('GlideForm not set for widget: '+$scope.widget.name);
return;
}
var map = createMap();
function createMap() {
var names = gf.getFieldNames();
var fields = [];
names.forEach(function (name) {
fields.push(gf.getField(name));
})
var map = {};
angular.forEach(inputMap, function(value, key) {
fields.forEach(function(field) {
if (field.variable_name == value) {
map[key] = field.name;
if (!keepFields)
gf.setDisplay(field.name, false);
}
})
})
angular.forEach(dataPrototype, function(value, key){
if (map[key])
return;
fields.forEach(function(field) {
if (field.variable_name == key) {
map[key] = field.name;
if (!keepFields)
gf.setDisplay(field.name, false);
}
})
})
return map;
}
return {
getMap: function() {
return map;
},
onChange: function(newV, oldV) {
if (!angular.isDefined(newV))
return;
angular.forEach(newV, function(value, key) {
if (newV[key] == oldV[key])
return;
var n = map[key];
gf.setValue(n, newV[key]);
})
}
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/factory.spModelUtil.js */
angular.module('sn.$sp').factory('spModelUtil', function(glideFormFieldFactory) {
'use strict';
function extendField(field) {
var glideField = glideFormFieldFactory.create(field);
field.isReadonly = glideField.isReadonly;
field.isMandatory = glideField.isMandatory;
field.isVisible = glideField.isVisible;
field.mandatory_filled = function(){ return glideFormFieldFactory.hasValue(field, field.stagedValue); }
field.stagedValue = field.value;
}
function extendFields(fields) {
for(var f in fields) {
extendField(fields[f]);
}
}
return {
extendField: extendField,
extendFields: extendFields
};
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spUIActionFactory.js */
angular.module('sn.$sp').factory('spUIActionFactory', function($http, $rootScope) {
'use strict';
var _er = {};
return {
create: function (uiActions, options, encodedRecord) {
var attachmentGUID = options && options.attachmentGUID;
if (attachmentGUID)
_er[attachmentGUID] = encodedRecord;
return new GlideUIActions(uiActions, options);
},
executeUIAction: executeDesktopUIAction
};
function GlideUIActions(uiActions, options) {
if (!uiActions) {
throw 'uiActions must be provided';
}
var _uiActionsById = {};
var _uiActions = [];
options = options || {};
uiActions.forEach(function(uiAction) {
var action = new GlideUIAction(
uiAction.action_name,
uiAction.sys_id,
uiAction.name,
options.uiActionNotifier,
options.attachmentGUID
);
_uiActionsById[action.getSysId()] = action;
_uiActions.push(action);
});
this.getActions = function() {
return _uiActions;
};
this.getAction = function(sysId) {
return _uiActionsById[sysId];
};
this.getActionByName = function(name) {
var foundAction;
_uiActions.forEach(function(action) {
if (foundAction) {
return;
}
if (name === action.getName()) {
foundAction = action;
}
});
if (!foundAction) {
name = name.toLowerCase();
_uiActions.forEach(function(action) {
if (foundAction) {
return;
}
if (name === (action.getDisplayName() || '').toLowerCase()) {
foundAction = action;
}
});
}
if (!foundAction)
foundAction = this.getAction(name);
return foundAction;
};
}
function GlideUIAction(name, sysId, displayName, uiActionNotifier, attachmentGUID) {
var _inProgress = false;
var _name = name;
var _displayName = displayName;
var _sysId = sysId;
var _notifier = uiActionNotifier;
this.getSysId = function() {
return _sysId;
};
this.getName = function() {
return _name;
};
this.getDisplayName = function() {
return _displayName;
};
this.execute = function(g_form) {
_inProgress = true;
var formData = {};
var fieldNames = g_form.getFieldNames();
fieldNames.forEach(function(name) {
formData[name] = g_form.getField(name);
});
if (attachmentGUID)
formData._attachmentGUID = attachmentGUID;
var $execute = executeDesktopUIAction(
this.getSysId(),
g_form.getTableName(),
g_form.getSysId(),
formData
).finally(function() {
_inProgress = false;
});
_notifier(this.getName(), $execute);
return $execute;
};
}
function executeDesktopUIAction(actionSysId, tableName, recordSysId, formData) {
var attachmentGUID = formData._attachmentGUID;
if (_er[attachmentGUID])
formData['encoded_record'] = _er[attachmentGUID];
var req = {
method: "POST",
url: "/api/now/sp/uiaction/" + actionSysId,
headers: {'Accept': 'application/json', 'x-portal': $rootScope.portal_id},
data: {
table: tableName,
recordID: recordSysId,
data: formData
}
};
return $http(req).then(qs, qe);
function qs(response) {
var r = response.data.result;
if (r && r.$$uiNotification)
$rootScope.$broadcast("$$uiNotification", r.$$uiNotification);
return r;
}
function qe(error) {
console.log("Error " + error.status + " " + error.statusText);
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spGlyphPicker.js */
angular.module('sn.$sp').directive('spGlyphPicker', function($rootScope, i18n) {
return {
template:
'<span class="glyph-picker-container">' +
'<button ng-show="!disabled()" class="btn btn-default iconpicker" data-iconset="fontawesome" data-icon="fa-{{field.value}}" id="sp_formfield_{{::field.name}}" aria-label="{{::label}}" tabindex="0"></button>' +
'<div ng-show="disabled()" class="fa fa-{{field.value}} glyph-picker-disabled"></div>' +
'</span>',
restrict: 'E',
replace: true,
scope: {field: '=', snOnChange: '&', snOnBlur: '&', snDisabled: '&'},
link: function(scope, element, attrs, controller) {
scope.disabled = function() {
if (typeof scope.snDisabled() == "undefined")
return false;
return scope.snDisabled();
}
var button = element.find('button');
button.on('click', function(e) {
var describedByAttr = this.attributes['aria-describedby'];
if (describedByAttr && describedByAttr.value.startsWith("popover")) {
e.stopImmediatePropagation();
}
});
button.iconpicker({
cols: 6,
rows: 6,
placement: 'right',
iconset: 'fontawesome'
});
scope.label = i18n.getMessage('Pick a Glyph');
scope.transferIcon = function() {
if(scope.field) {
button.iconpicker('setIcon', 'fa-' + scope.field.value);
}
}
scope.$watch(function() {
return scope.field ? scope.field.value : null;
}, function(newValue, oldValue) {
if (newValue != oldValue)
scope.transferIcon();
})
scope.transferIcon();
button.on('change', function(e) {
scope.field.value = e.icon.replace(/^fa-/, '');
if (!$rootScope.$$phase)
$rootScope.$digest();
scope.snOnChange();
})
button.on('change', function(e) {
scope.snOnBlur();
})
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spColorPicker.js */
angular.module('sn.$sp').directive('spColorPicker', function() {
return {
template: '<div class="input-group" role="presentation">' +
'<input id="sp_formfield_{{::field.name}}" class="form-control" name="{{field.name}}" value="{{field.value}}" placeholder="{{field.placeholder}}" autocomplete="off" ng-readonly="snDisabled" />' +
'<input type="text" class="btn input-group-btn" name="color_picker_{{field.name}}" ng-disabled="snDisabled" />' +
'</div>',
restrict: 'E',
replace: true,
scope: {
field: '=',
getGlideForm: '&glideForm',
snChange: "&",
snDisabled: "="
},
link: function(scope, element, attrs, controller) {
var field = scope.field;
var initialColor;
var g_form = scope.getGlideForm();
function setValue(newVal) {
if (!scope.snDisabled)
scope.snChange({newValue: newVal});
}
scope.$evalAsync(function(){ init(); });
element.on('$destroy', function() {
scope.picker.spectrum("destroy");
});
function init() {
var $input = element.find('input[name="' + field.name + '"]');
var $picker = element.find('input[name="color_picker_' + field.name + '"]');
scope.picker = $picker;
$picker.spectrum({
color: field.value,
showInitial: true,
showButtons: false,
showInput: true,
showSelectionPalette: false,
preferredFormat: "hex",
showPalette: true,
hideAfterPaletteSelect:true,
replacerClassName: "input-group-btn",
palette: [["#000000", "#ffffff", "#343d47", "#485563", "#81878e", "#bdc0c4", "#e6e8ea"],
["#e7e9eb", "#6d79eb", "#8784db", "#b1afdb", "#278efc", "#83bfff", "#c0dcfa"],
["#289fdb", "#97e0fc", "#caeefc", "#71e279", "#6edb8f", "#9adbad", "#fcc742"],
["#ffe366", "#fff1b2", "#fc8a3d", "#ffc266", "#ffe0b2", "#f95050", "#ff7b65"],
["#ffbeb2", "#f95070", "#ff93a2", "#ffc1ca", "#cddc39", "#e6ee9c", "#f9fbe7"]],
show: function(color) {
initialColor = color.toHexString();
},
hide: function(color) {
var newVal = color.toHexString();
if (initialColor != newVal) {
setValue(newVal);
}
},
move: function(color) {
var newVal = color.toHexString();
setValue(newVal);
},
change: function(color) {
var newVal = color.toHexString();
setValue(newVal);
}
});
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
if (propertyName == "readonly")
$picker.spectrum(g_form.isReadOnly(field.name) ? "disable" : "enable");
});
$input.on("focus", function() {
var el = angular.element(this);
initialColor = el.val();
});
$input.on("blur", function() {
var el = angular.element(this);
var newVal = el.val();
if (initialColor != newVal) {
$picker.spectrum("set", newVal);
setValue(newVal);
}
});
}
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spReferenceField.js */
angular.module('sn.$sp').directive('spReferenceField', function($rootScope, $injector, spUtil, $uibModal, $http, spAriaUtil, i18n) {
'use strict';
return {
restrict: 'E',
replace: true,
templateUrl: 'sp_reference_field.xml',
controller: function($scope) {
var unregister;
var opened = false;
$scope.openReference = function(field, view) {
var data = {table: field.refTable, sys_id: field.value, view: view, isPopup: true};
if (angular.isDefined(field.reference_key))
data[field.reference_key] = field.value;
else
data.sys_id = field.value;
if (unregister)
unregister();
unregister = $rootScope.$on('$sp.openReference', function(evt, data) {
if (opened)
return;
opened = true;
unregister();
unregister = null;
if (!evt.defaultPrevented && evt.targetScope === $scope)
showForm(data);
});
$scope.$emit('$sp.openReference', data);
};
$scope.$on("$destroy", function() {
if (unregister)
unregister();
opened = false;
});
function showForm(data) {
var url = spUtil.getWidgetURL("widget-form");
var req = {
method : 'POST',
url : url,
headers : spUtil.getHeaders(),
data : data
}
$http(req).then(qs, qe);
function qs(response) {
var r = response.data.result;
showModal(r);
}
function qe(error) {
console.error("Error " + error.status + " " + error.statusText);
opened = false;
}
}
function showModal(form) {
var opts = {
size : 'lg',
templateUrl : 'sp_form_modal',
controller : ModalInstanceCtrl,
resolve : {}
};
opts.resolve.item = function() {
return angular.copy({
form : form
});
};
var modalInstance = $uibModal.open(opts);
var pageRoot = angular.element('.sp-page-root');
function setModalAriaAttrs(modal) {
modal.attr('aria-label', modal.find('.panel-title').html());
modal.attr('aria-modal', 'true');
}
function getHighestModal() {
var highestModal, maxz;
if ($('.modal.in').length > 0) {
$('.modal.in').each(function(){
var zindex = $(this).css('z-index');
if (!highestModal || maxz < zindex) {
highestModal = this;
maxz = zindex;
}
});
}
return highestModal;
}
modalInstance.rendered.then(function() {
var $uibModalStack = $injector.get('$uibModalStack');
var modalObj = $uibModalStack.getTop();
var modal = modalObj.value.modalDomEl;
var highestModal = getHighestModal();
if (highestModal)
highestModal.setAttribute('aria-hidden', 'true');
setModalAriaAttrs(modal);
pageRoot.attr('aria-hidden', 'true');
});
modalInstance.closed.then(function(){
var highestModal = getHighestModal();
if (highestModal)
highestModal.setAttribute('aria-hidden', 'false');
});
modalInstance.result.then(function() {}, function() {
spAriaUtil.sendLiveMessage($scope.exitMsg);
});
$scope.$on("$destroy", function() {
modalInstance.close();
});
var unregister = $scope.$on('sp.form.record.updated', function(evt, fields, savedFormSysId) {
if (form.data.sys_id !== savedFormSysId)
return;
unregister();
unregister = null;
modalInstance.close();
if (evt.stopPropagation)
evt.stopPropagation();
evt.preventDefault();
});
}
function ModalInstanceCtrl($scope, $uibModalInstance, item) {
$scope.item = item;
$scope.closeWindowMsg = i18n.getMessage('Close Window');
$scope.ok = function() {
$uibModalInstance.close();
};
$scope.$on('modal.closing', function() {
var pageRoot = angular.element('.sp-page-root');
if ($('.modal.in').length == 1)
pageRoot.attr('aria-hidden', 'false');
opened = false;
});
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel');
};
}
},
link: function(scope, element) {
i18n.getMessage("Closing modal page", function(msg){
scope.exitMsg = msg;
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spCssEditor.js */
angular.module('sn.$sp').directive('spCssEditor', function($timeout) {
return {
template:
'<textarea ng-model="v" name="{{::field.name}}" style="width: 100%; min-height: 2em;" rows="1" wrap="soft" data-length="{{::dataLength}}" data-charlimit="false">' +
'</textarea>',
restrict: 'E',
replace: true,
require: '^ngModel',
scope: {
field: '=',
dataLength: '@',
snDisabled: '=?',
snChange: '&',
snBlur: '&',
getGlideForm: '&glideForm'
},
link: function(scope, element, attrs, ctrl) {
$timeout(function() {
var g_form;
var field = scope.field;
if (typeof attrs.glideForm != "undefined") {
g_form = scope.getGlideForm();
}
element[0].value = field.value;
element[0].id = "sp_formfield_" + field.name;
var cmi = CodeMirror.fromTextArea(element[0], {
mode: "text/x-less",
lineWrapping: false,
readOnly: scope.snDisabled === true,
viewportMargin: Infinity,
lineNumbers: true,
tabSize: 2,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
});
$("#sp_formfield_" + field.name).next().find("textarea").attr({
role: "textbox",
"aria-multiline": "true",
"aria-label": scope.field.label
});
var extraKeys =  {
"Ctrl-M" : function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc" : function(cm) {
if (cm.getOption("fullScreen"))
cm.setOption("fullScreen", false);
}
}
cmi.addKeyMap(extraKeys);
cmi.on('change', function(cm) {
if (typeof field.stagedValue != "undefined") {
field.stagedValue = cm.getValue();
ctrl.$setViewValue(field.stagedValue);
} else {
field.value = cm.getValue();
ctrl.$setViewValue(field.value);
}
if (angular.isDefined(scope.snChange))
scope.snChange();
});
cmi.on('blur', function() {
if (angular.isDefined(scope.snBlur))
scope.snBlur();
});
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attrs.ngChange);
});
if (g_form) {
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
if (propertyName == "readonly") {
var isReadOnly = g_form.isReadOnly(fieldName);
cmi.setOption('readOnly', isReadOnly);
var cmEl = cmi.getWrapperElement();
jQuery(cmEl).css("background-color", isReadOnly ? "#eee" : "");
}
g_form.$private.events.on('change', function(fieldName, oldValue, newValue) {
if (fieldName != field.name)
return;
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(newValue);
});
});
} else {
scope.$watch(function() {
return field.value;
}, function(newValue, oldValue) {
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(field.value);
});
scope.$watch('snDisabled', function(newValue) {
if (angular.isDefined(newValue)) {
cmi.setOption('readOnly', newValue);
}
});
}
});
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spTinymceEditor.js */
angular.module('sn.$sp').directive('spTinymceEditor', function(getTemplateUrl, snAttachmentHandler, $timeout, i18n, spAriaUtil, $rootScope, spUtil, $sce) {
return {
templateUrl: getTemplateUrl('sp_tinymce_editor.xml'),
restrict: 'E',
replace: true,
scope: {
model: '=ngModel',
field: '=?',
options: '=ngModelOptions',
snBlur: '&',
snDisabled: '=?',
getGlideForm: '&glideForm',
ngChange: '&',
attachmentGuid: '=?',
recordTableName: '=?',
textId: '@?',
autoFocus: '@?'
},
controller: function($scope, $element, $attrs) {
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
$scope.accessibilityEnabled = spAriaUtil.g_accessibility === "true";
$scope.onChangeModel = function () {
$timeout (function () {
$scope.ngChange();
});
}
$scope.trustedHTML = function(html) {
return $sce.trustAsHtml(html);
};
$scope.options = $scope.options || {};
var thisEditor = {};
var g_form;
var field;
if (typeof $attrs.glideForm != "undefined") {
g_form = $scope.getGlideForm();
}
if (typeof $attrs.field != "undefined") {
field = $scope.field;
}
var guID = new Date().valueOf();
$scope.textareaId = ($scope.textId ? $scope.textId.replace('.', '-') : 'ui-tinymce-') + guID;
var tinyMceSettings = tinyMCE && tinyMCE.DOM && tinyMCE.DOM.settings;
if (tinyMceSettings) {
tinyMceSettings.lastTinyMceId = $scope.textareaId;
tinyMceSettings.onSetAttrib = function(args) {
var elem = $(args.attrElm);
if (args.attrName === 'src' && elem.is('iframe') && args.attrValue.indexOf('javascript') > -1)
elem.removeAttr('src');
}
}
var langs = 'cs,de,en,es,fi,fr,he,it,ja,ko,nl,pl,pt,ru,zh,zt';
var userLanguage = g_lang;
if (!userLanguage || langs.indexOf(userLanguage) == -1)
userLanguage = g_system_lang;
if (!userLanguage || langs.indexOf(userLanguage) == -1)
userLanguage = 'en';
var setMode = function() {
var isReadOnly = g_form ? g_form.isReadOnly(field.name) : ($scope.field.sys_readonly || false);
var isMandatory = $scope.field.isMandatory ? $scope.field.isMandatory() : ($scope.field.mandatory || false);
var body = thisEditor.getDoc().body;
body.style.backgroundColor = isReadOnly ? "#eeeeee" : "#fff";
var doc = thisEditor.getDoc();
doc.documentElement.style.height = '90%';
doc.body.style.height = '90%';
$timeout(function(i18n) {
body.setAttribute('contenteditable', !isReadOnly);
body.setAttribute('aria-label', $scope.field.label);
body.setAttribute('aria-required', isMandatory);
}, 1000);
}
var updateMode = function() {
if (typeof thisEditor.setMode == "function") {
if (thisEditor.getContainer()) {
setMode();
}
} else {
$timeout(updateMode, 10);
}
}
var removeScriptHost = true;
if (typeof g_tinymce_remove_script_host !== "undefined")
removeScriptHost = g_tinymce_remove_script_host;
var convertURLs = false;
if (typeof g_tinymce_convert_urls !== "undefined")
convertURLs = g_tinymce_convert_urls;
var relativeURLs = true;
if (typeof g_tinymce_relative_urls !== "undefined")
relativeURLs = g_tinymce_relative_urls;
function getTableAndSysId() {
var result = {};
var form = $scope.getGlideForm();
if (form) {
var tableName = form.getTableName();
var sysId = form.getSysId();
if (tableName) {
result.table = tableName;
result.sys_id = sysId > -1 ? sysId : $scope.attachmentGuid;
} else {
result.table = form.recordTableName;
result.sys_id = $scope.attachmentGuid || sysId;
}
} else {
result.table = $scope.recordTableName;
result.sys_id = $scope.attachmentGuid;
}
return result;
}
function update() {
$scope.$applyAsync(function () {
var rawValue = thisEditor.getContent({format: 'raw'});
var textContent = thisEditor.getContent({format: 'text'}).trim();
var htmlRegex = /(iframe|img)/i;
var content = (textContent || rawValue.match(htmlRegex)) ? rawValue : textContent;
if (isIE11 && content.indexOf("src=\"blob:") !== -1)
content = thisEditor.getContent();
$scope.model = content;
if ($scope.field) {
$scope.field.value = $scope.field.stagedValue = content;
}
});
}
function getMinHeight() {
var textarea = document.createElement('textarea');
$(textarea).attr("rows", $element.find("textarea").attr("rows")).css('visibility', 'hidden');
document.body.appendChild(textarea);
var height = textarea.offsetHeight + 0;
document.body.removeChild(textarea);
return height;
}
var toolbar = ["undo redo","formatselect","bold italic","alignleft aligncenter alignright alignjustify","bullist numlist outdent indent","link unlink","image","codesample code"];
$scope.tinyMCEOptions = {
skin: 'lightgray',
theme : 'modern',
menubar: false,
language: userLanguage,
remove_script_host: removeScriptHost,
convert_urls: convertURLs,
relative_urls: relativeURLs,
statusbar: true,
elementpath: false,
plugins: "codesample lists code link",
lists_indent_on_tab: false,
toolbar: toolbar.join(" | "),
paste_data_images: true,
browser_spellcheck: true,
external_plugins: {
powerpaste: '/scripts/tinymce4_4_3/plugins/powerpaste/plugin.min.js?sysparm_substitute=false'
},
setup: function(ed) {
thisEditor = ed;
ed.on('init', function() {
if (tinyMceSettings && ed.id === tinyMceSettings.lastTinyMceId) {
delete tinyMceSettings.onSetAttrib;
delete tinyMceSettings.lastTinyMceId;
}
var minHeight = tinyMceSettings.min_height || 100;
var isVisible = $scope.field.isVisible ? $scope.field.isVisible() : $scope.field.visible;
if (!isVisible && ed.iframeElement.style.height == (minHeight + "px") && minHeight < getMinHeight())
ed.iframeElement.style.height = getMinHeight() + "px";
setMode();
});
ed.addCommand('imageUpload', function (ui, v) {
$scope.clickAttachment();
});
ed.addButton('image', {
icon: 'image',
tooltip: 'Insert image',
onclick: function(e) {
ed.execCommand('imageUpload');
},
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
});
ed.on('blur', function() {
update();
if (angular.isDefined($scope.snBlur))
$scope.snBlur();
});
ed.on('ProgressState', function(e) {
$rootScope.$emit('$sp.html.editor.progress', e);
});
},
images_upload_handler: function(blobInfo, success, failure) {
var blob = blobInfo.blob();
var fileName = blobInfo.filename();
blob.name = "Pasted image" + fileName.substr(fileName.lastIndexOf("."));
var data = getTableAndSysId();
if (data.table && data.sys_id) {
thisEditor.setProgressState(true);
snAttachmentHandler.create(data.table, data.sys_id).uploadAttachment(blob, null, {}).then(function (response) {
success("/sys_attachment.do?sys_id=" + response.sys_id);
update();
thisEditor.setProgressState(false);
});
} else {
console.warn("GlideForm or table and record id is not provided");
failure();
}
}
};
if ($scope.autoFocus == 'true')
$scope.tinyMCEOptions.auto_focus = $scope.textareaId;
if (spUtil.isMobile()) {
$scope.tinyMCEOptions.toolbar = _.pull(toolbar, 'image').join(' | ');
}
$scope.attachFiles = function(result) {
var data = getTableAndSysId();
if (data.table && data.sys_id && result.files.length) {
thisEditor.setProgressState(true);
snAttachmentHandler.create(data.table, data.sys_id).uploadAttachment(result.files[0], null, {}).then(function(response) {
var args = tinymce.extend({}, {
src : encodeURI("/sys_attachment.do?sys_id=" + response.sys_id),
style: "max-width: 100%; max-height: 480px;"
});
update();
thisEditor.setProgressState(false);
thisEditor.execCommand('mceInsertContent', false, thisEditor.dom.createHTML('img', args), {skip_undo : 1});
});
}
};
if (g_form && field) {
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
updateMode();
});
updateMode();
} else if (typeof $attrs.snDisabled != "undefined") {
$scope.$watch('snDisabled', function(newValue) {
if (angular.isDefined(newValue) && typeof thisEditor.setMode == "function") {
if (thisEditor.getContainer())
thisEditor.setMode(newValue ? 'readonly' : 'design');
else {
thisEditor.on('init', function() {
thisEditor.setMode(newValue ? 'readonly' : 'design');
});
}
}
});
}
}, link: function(scope, element, attrs) {
scope.attrs = attrs;
scope.clickAttachment = function() {
element.find("input").click();
};
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spHTMLEditor.js */
angular.module('sn.$sp').directive('spHtmlEditor', function($timeout) {
return {
template: '<textarea class="CodeMirror" name="{{::field.name}}" ng-model="v" style="width: 100%;" data-length="{{ ::dataLength }}" data-charlimit="false"></textarea>',
restrict: 'E',
require: '^ngModel',
replace: true,
scope: {
field: '=',
dataLength: '@',
rows: '@',
snDisabled: '=?',
snChange: '&',
snBlur: '&',
getGlideForm: '&glideForm'
},
link: function(scope, element, attrs, ctrl) {
$timeout(function() {
var g_form;
var field = scope.field;
if (typeof attrs.glideForm != "undefined") {
g_form = scope.getGlideForm();
}
element[0].value = field.value;
element[0].id = "sp_formfield_" + field.name;
var cmi = CodeMirror.fromTextArea(element[0], {
mode: "htmlmixed",
lineWrapping: false,
readOnly: scope.snDisabled === true,
viewportMargin: Infinity,
lineNumbers: true,
autoCloseTags: true,
tabSize: 2,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
});
$("#sp_formfield_" + field.name).next().find("textarea").attr({
role: "textbox",
"aria-multiline": "true",
"aria-label": scope.field.label
});
var extraKeys =  {
"Ctrl-M" : function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc" : function(cm) {
if (cm.getOption("fullScreen"))
cm.setOption("fullScreen", false);
}
}
cmi.addKeyMap(extraKeys);
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attrs.ngChange);
});
cmi.on('change', function(cm) {
if (typeof field.stagedValue != "undefined") {
field.stagedValue = cm.getValue();
ctrl.$setViewValue(field.stagedValue);
} else {
field.value = cm.getValue();
ctrl.$setViewValue(field.value);
}
if (angular.isDefined(scope.snChange))
scope.snChange();
});
cmi.on('blur', function() {
if (angular.isDefined(scope.snBlur))
scope.snBlur();
});
if (g_form) {
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
if (propertyName == "readonly") {
var isReadOnly = g_form.isReadOnly(fieldName);
cmi.setOption('readOnly', isReadOnly);
var cmEl = cmi.getWrapperElement();
jQuery(cmEl).css("background-color", isReadOnly ? "#eee" : "");
}
g_form.$private.events.on('change', function(fieldName, oldValue, newValue) {
if (fieldName != field.name)
return;
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(newValue);
});
});
} else {
scope.$watch(function() {
return field.value;
}, function(newValue, oldValue) {
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(field.value);
});
scope.$watch('snDisabled', function(newValue) {
if (angular.isDefined(newValue)) {
cmi.setOption('readOnly', newValue);
}
});
}
});
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spHtmlContent.js */
angular.module('sn.$sp').directive('spHtmlContent', function($sce, $compile) {
return {
template: '<p ng-bind-html="trustAsHtml(model)"></p>',
restrict: 'E',
replace: true,
scope: {
model:'='
},
link: function(scope, element, attrs, controller) {
scope.trustAsHtml = $sce.trustAsHtml;
scope.$watch('model', function() {
Prism.highlightAll();
element.find('img').each(function(index, el) {
if (!el.hasAttribute('role') && !el.getAttribute('alt'))
el.setAttribute('role', 'presentation');
});
})
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spCodeMirror.js */
angular.module('sn.$sp').directive('spCodeMirror', function($timeout) {
return {
template:
'<textarea class="CodeMirror" name="{{::field.name}}" ng-model="v" style="width: 100%;" data-length="{{ ::dataLength }}" data-charlimit="false">' +
'</textarea>',
restrict: 'E',
replace: true,
require: '^ngModel',
scope: {
field: '=',
mode: '@',
dataLength: '@',
snDisabled: '=?',
snChange: '&',
snBlur: '&',
getGlideForm: '&glideForm',
id: '@?'
},
link: function(scope, element, attrs, ctrl) {
$timeout(function() {
var g_form;
var field = scope.field;
if (typeof attrs.glideForm != "undefined") {
g_form = scope.getGlideForm();
}
element[0].value = field.value;
element[0].id = scope.id;
var cmi = CodeMirror.fromTextArea(element[0], {
mode: scope.mode,
lineWrapping: false,
readOnly: scope.snDisabled === true,
viewportMargin: Infinity,
tabSize: 2,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
});
element.next().find("textarea").attr("aria-label", field.label);
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attrs.ngChange);
});
cmi.on('change', function(cm) {
if (typeof field.stagedValue != "undefined") {
field.stagedValue = cm.getValue();
ctrl.$setViewValue(field.stagedValue);
} else {
field.value = cm.getValue();
ctrl.$setViewValue(field.value);
}
if (angular.isDefined(scope.snChange))
scope.snChange();
});
cmi.on('blur', function() {
if (angular.isDefined(scope.snBlur))
scope.snBlur();
});
if (g_form) {
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
if (propertyName == "readonly") {
var isReadOnly = g_form.isReadOnly(fieldName);
cmi.setOption('readOnly', isReadOnly);
var cmEl = cmi.getWrapperElement();
jQuery(cmEl).css("background-color", isReadOnly ? "#eee" : "");
}
g_form.$private.events.on('change', function(fieldName, oldValue, newValue) {
if (fieldName != field.name)
return;
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(newValue);
});
});
} else {
scope.$watch(function() {
return field.value;
}, function(newValue, oldValue) {
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(field.value);
});
scope.$watch('snDisabled', function(newValue) {
if (angular.isDefined(newValue)) {
cmi.setOption('readOnly', newValue);
}
});
}
});
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spScriptEditor.js */
angular.module('sn.$sp').directive('spScriptEditor', function($rootScope, $http, spCodeEditorAutocomplete, defaultJSAutocomplete, $timeout) {
return {
template:
'<textarea class="CodeMirror" name="{{::field.name}}" ng-model="v" style="width: 100%;" data-length="{{::dataLength}}" data-charlimit="false">' +
'</textarea>',
restrict: 'E',
require: '^ngModel',
replace: true,
scope: {
field: '=',
dataLength: '@',
options: '@?',
snDisabled: '=?',
snChange: '&',
snBlur: '&',
getGlideForm: '&glideForm',
id: '@?'
},
link: function(scope, element, attrs, ctrl) {
$timeout(function() {
var g_form;
var field = scope.field;
if (typeof attrs.glideForm != "undefined") {
g_form = scope.getGlideForm();
}
element[0].value = field.value;
element[0].id = scope.id;
var cmi = initializeCodeMirror(element[0]);
var server;
spCodeEditorAutocomplete.getConfig('sp_widget', field.name)
.then(setupTernServer);
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attrs.ngChange);
});
cmi.on('change', function(cm) {
if (typeof field.stagedValue != "undefined") {
field.stagedValue = cm.getValue();
ctrl.$setViewValue(field.stagedValue);
} else {
field.value = cm.getValue();
ctrl.$setViewValue(field.value);
}
if (angular.isDefined(scope.snChange))
scope.snChange();
});
cmi.on('blur', function() {
if (angular.isDefined(scope.snBlur))
scope.snBlur();
});
if (g_form) {
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName) {
if (fieldName != field.name)
return;
if (propertyName == "readonly") {
var isReadOnly = g_form.isReadOnly(fieldName);
cmi.setOption('readOnly', isReadOnly);
var cmEl = cmi.getWrapperElement();
jQuery(cmEl).css("background-color", isReadOnly ? "#eee" : "");
}
g_form.$private.events.on('change', function(fieldName, oldValue, newValue) {
if (fieldName != field.name)
return;
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(newValue);
});
});
} else {
scope.$watch(function() {
return field.value;
}, function(newValue, oldValue) {
if (newValue != oldValue && !cmi.hasFocus())
cmi.getDoc().setValue(field.value);
});
scope.$watch('snDisabled', function(newValue) {
if (angular.isDefined(newValue)) {
cmi.setOption('readOnly', newValue);
}
});
}
cmi.on("keyup", function (cm, event) {
var keyCode = ('which' in event) ? event.which : event.keyCode;
var ternTooltip = document.getElementsByClassName('CodeMirror-Tern-tooltip')[0];
if (keyCode == 190)
if(event.shiftKey)
return;
else
server.complete(cmi, server);
if (keyCode == 57 && window.event.shiftKey && ternTooltip)
angular.element(ternTooltip).show();
if (keyCode == 27 && ternTooltip) {
angular.element(ternTooltip).hide();
}
});
cmi.on("startCompletion", function(cm) {
var completion = cm.state.completionActive;
completion.options.completeSingle = false;
var pick = completion.pick;
completion.pick = function (data, i) {
var completion = data.list[i];
CodeMirror.signal(cm, "codemirror_hint_pick", {data: completion, editor: cm});
pick.apply(this, arguments);
}
});
cmi.on("codemirror_hint_pick", function(i) {
var data = i.data.data;
var editor = i.editor;
var cur = editor.getCursor();
var token = data.type;
if (token && token.indexOf('fn(') != -1) {
if (editor.getTokenAt({ch: cur.ch + 1, line: cur.line}).string != '(') {
editor.replaceRange('()', {
line: cur.line,
ch: cur.ch
}, {
line: cur.line,
ch: cur.ch
});
if (token && token.substr(0, 4) !== 'fn()' && angular.element('div.CodeMirror-Tern-tooltip')[0]) {
editor.execCommand('goCharLeft');
setTimeout(function () {
var ternTooltip = document.getElementsByClassName('CodeMirror-Tern-tooltip')[0];
if(ternTooltip) {
angular.element(ternTooltip).show();
}
}, 100)
}
}
else if (token && token.substr(0, 4) !== 'fn()')
editor.execCommand('goCharRight');
}
});
function initializeCodeMirror(elem) {
var options = {
mode: "javascript",
lineNumbers: true,
lineWrapping: false,
readOnly: scope.snDisabled === true,
viewportMargin: Infinity,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-lint-markers", "CodeMirror-foldgutter"],
lint: {
asi: true
},
indentWithTabs: true,
indentUnit: 2,
tabSize: 2,
matchBrackets: true,
autoCloseBrackets: true,
theme: "snc"
};
if (scope.options) {
Object.keys(scope.options).forEach(function(key) {
options[key] = scope.options[key];
});
}
var cm = CodeMirror.fromTextArea(elem, options);
$("#sp_formfield_" + field.name).next().find("textarea").attr({
role: "textbox",
"aria-multiline": "true",
"aria-label": scope.field.label
});
return cm;
}
function setupTernServer(data) {
var plugins = {};
if (field.name === "client_script")
plugins = {
"angular": "./"
};
server = new CodeMirror.TernServer({
defs: [data, defaultJSAutocomplete],
plugins: plugins
});
cmi.setOption("extraKeys", {
"Ctrl-Space": function(cm) { server.complete(cm); },
"Ctrl-I": function(cm) { server.showType(cm); },
"Ctrl-O": function(cm) { server.showDocs(cm); },
"Alt-.": function(cm) { server.jumpToDef(cm); },
"Alt-,": function(cm) { server.jumpBack(cm); },
"Ctrl-Q": function(cm) { server.rename(cm); },
"Ctrl-.": function(cm) { server.selectName(cm); }
});
var extraKeys =  {
"Ctrl-M" : function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc" : function(cm) {
if (cm.getOption("fullScreen"))
cm.setOption("fullScreen", false);
}
}
cmi.addKeyMap(extraKeys);
cmi.on("cursorActivity", function(cm) { server.updateArgHints(cm); });
}
});
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spScroll.js */
angular.module('sn.$sp').directive('spScroll', function() {
function scrollTo(el, options) {
var offset = $(options.offset).height() || 0;
$(el).animate({
scrollTop : $(options.selector).offset().top - offset - 10
}, options.time);
}
function link($scope, el) {
$scope.$on('$sp.scroll', function(e, options) {
if (options.selector) {
return scrollTo(el, options);
}
$(el).scrollTop(options.position || 0);
});
};
return {
restrict: 'C',
link: link
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spEditableField.js */
angular.module('sn.$sp').directive('spEditableField', function(glideFormFactory, $http, spUtil, spModelUtil, $timeout, i18n, spAriaUtil) {
return {
restrict: 'E',
templateUrl: 'sp_editable_field.xml',
scope: {
fieldModel: "=",
table: "@",
tableId: "=",
block: "=?",
editableByUser: "=",
onChange: "=?",
onSubmit: "=?",
asyncSubmitValidation: "=?"
},
transclude: true,
replace: true,
controller: function($scope) {
var REST_API_PATH = "/api/now/v2/table/";
var fieldSavedMsg = i18n.getMessage('{0} saved');
var g_form;
this.createShadowModel = function() {
spModelUtil.extendField($scope.fieldModel);
$scope.shadowModel = angular.copy($scope.fieldModel);
$scope.shadowModel.table = $scope.table;
$scope.shadowModel.sys_id = $scope.tableId;
$scope.blockDisplay = $scope.block ? {display: 'block'} : {};
$scope.editable = !$scope.shadowModel.readonly && $scope.editableByUser;
$scope.fieldID = $scope.table + "-" + $scope.shadowModel.name.replace('.', '_dot_') + "-" + $scope.tableId;
initGlideForm();
};
this.createShadowModel();
$scope.getGlideForm = function() {
return g_form;
};
$scope.saveForm = function() {
if (g_form)
g_form.submit();
if (angular.isDefined($scope.asyncSubmitValidation)) {
$scope.asyncSubmitValidation(g_form, $scope.shadowModel).then(function(result) {
if (result)
completeSave();
});
}
};
function completeSave() {
var url = REST_API_PATH + $scope.table + "/" + $scope.tableId + "?sysparm_display_value=all&sysparm_fields=" + $scope.shadowModel.name;
if ($scope.shadowModel.type === "password" || $scope.shadowModel.type === "password2")
url += "&sysparm_input_display_value=true";
var data = {};
data[$scope.shadowModel.name] = $scope.shadowModel.value;
$http.put(url, data).success(function (data) {
if (data.result)
updateFieldModel(data.result);
$scope.closePopover();
}).error(function (reason) {
console.log("Field update failure", reason);
spUtil.retrieveSessionMessages();
});
}
$scope.checkNullChoiceOverride = function() {
if ($scope.fieldModel.type != "choice")
return;
if ($scope.fieldModel.value || $scope.fieldModel.displayValue)
return;
var choices = $scope.fieldModel.choices || [];
for (var i = 0; i < choices.length; i++) {
if (choices[i].value == "") {
$scope.fieldModel.displayValue = choices[i].label;
return;
}
}
}
function updateFieldModel(record) {
if (record && $scope.fieldModel.name in record) {
var updated = record[$scope.fieldModel.name];
$scope.fieldModel.value = updated.value;
$scope.fieldModel.displayValue = updated.display_value;
$scope.checkNullChoiceOverride();
spAriaUtil.sendLiveMessage(spUtil.format(fieldSavedMsg, {'0': $scope.fieldModel.label || ''}));
}
}
function initGlideForm() {
if (g_form)
g_form.$private.events.cleanup();
var uiMessageHandler = function(g_form, type, message) {
switch (type) {
case 'infoMessage':
spUtil.addInfoMessage(message);
break;
case 'errorMessage':
spUtil.addErrorMessage(message);
break;
case 'clearMessages':
spUtil.clearMessages();
break;
default:
return false;
}
};
g_form = glideFormFactory.create($scope, $scope.table, $scope.tableId, [$scope.shadowModel], null, {uiMessageHandler: uiMessageHandler});
$scope.$emit("spEditableField.gForm.initialized", g_form, $scope.shadowModel);
if (angular.isDefined($scope.onChange))
g_form.$private.events.on("change", function(fieldName, oldValue, newValue){ return $scope.onChange.call($scope.onChange, g_form, $scope.shadowModel, oldValue, newValue); });
if (angular.isDefined($scope.onSubmit))
g_form.$private.events.on("submit", function(){ return $scope.onSubmit.call($scope.onSubmit, g_form, $scope.shadowModel); });
if (!angular.isDefined($scope.asyncSubmitValidation)) {
g_form.$private.events.on('submitted', function() {
completeSave();
});
}
}
},
link: function(scope, el, attrs, ctrl) {
var returnFocus = true;
scope.checkNullChoiceOverride();
scope.closePopover = function() {
if (scope.shadowModel.popoverIsOpen)
ctrl.createShadowModel();
scope.shadowModel.popoverIsOpen = false;
if (returnFocus) {
var trigger = el[0].querySelector('.popover-trigger-' + scope.fieldID);
trigger.focus();
}
$('body').off('keydown', executeEventHandlers);
$('body').off('click', closePopoverOnOutsideClick);
}
scope.toggleClick = function($event) {
if($event.type === "click") {
scope.togglePopover($event);
}
}
scope.toggleKeydown = function($event) {
if(($event.which === 13 || $event.which === 32)) {
scope.togglePopover($event);
$event.preventDefault();
$event.stopPropagation();
}
}
scope.togglePopover = function(evt) {
scope.shadowModel.popoverIsOpen = !scope.shadowModel.popoverIsOpen;
scope.shadowModel.value = scope.shadowModel.stagedValue = scope.fieldModel.value;
scope.shadowModel.displayValue = scope.fieldModel.displayValue;
$timeout(function() {
var popOverElem = el.parent().find(".popover")[0];
if (popOverElem) {
popOverElem.setAttribute('role', 'dialog');
popOverElem.setAttribute('aria-label', scope.shadowModel.label);
}
}, 0);
var triggerEl = el.parent().find('.bs-popover')[0];
if (triggerEl) {
var expanded = triggerEl.getAttribute("aria-expanded");
triggerEl.setAttribute('aria-expanded' , (expanded === 'true') ? false : true);
}
if (scope.shadowModel.popoverIsOpen) {
returnFocus = true;
$('body').on('keydown', executeEventHandlers);
$('body').on('click', closePopoverOnOutsideClick);
}
}
function swapFocusableEls(domFocusableElems, clearElemIndex, selectionElemIndex) {
var elem = domFocusableElems[clearElemIndex];
domFocusableElems[clearElemIndex] = domFocusableElems[selectionElemIndex];
domFocusableElems[selectionElemIndex] = elem;
return domFocusableElems;
}
function executeEventHandlers(event){
trapKeyboardFocus(event);
closePopoverOnEscape(event);
}
function trapKeyboardFocus(event) {
if (!scope.shadowModel.popoverIsOpen)
return;
var isModalElement = $(event.target).closest('.modal')[0];
if (isModalElement)
return;
var domFocusableEls = window.tabbable(el[0].querySelector('[uib-popover-template-popup]'));
if (!domFocusableEls.length)
return;
var selectionElem = el.find(".select2-focusser")[0];
var clearElem = el.find(".select2-search-choice-close")[0];
var selectionElemIndex = domFocusableEls.indexOf(selectionElem);
var clearElemIndex = domFocusableEls.indexOf(clearElem);
var focusableEls = [];
var currentFocusableElemIndex ,firstFocusableEl ,lastFocusableEl;
if (clearElemIndex !== -1)
focusableEls = swapFocusableEls(domFocusableEls, clearElemIndex, selectionElemIndex);
else
focusableEls = domFocusableEls.slice();
currentFocusableElemIndex = focusableEls.indexOf(document.activeElement);
firstFocusableEl = focusableEls[0];
lastFocusableEl = focusableEls[focusableEls.length - 1];
if (currentFocusableElemIndex == -1)
return;
if (event.which === 9) {
if (event.shiftKey) {
if (document.activeElement === firstFocusableEl)
lastFocusableEl.focus();
else if (focusableEls[currentFocusableElemIndex - 1])
focusableEls[currentFocusableElemIndex - 1].focus();
} else {
if (document.activeElement === lastFocusableEl)
firstFocusableEl.focus();
else if (focusableEls[currentFocusableElemIndex + 1])
focusableEls[currentFocusableElemIndex + 1].focus();
}
event.preventDefault();
event.stopPropagation();
}
}
function isModalLaunchedFromPopOver() {
var modal = $('.modal.in');
return (modal.length && !modal.find('.sp-editable-field .popover').length);
}
function isTooltipContainedInPopOver() {
return ($('[uib-popover-template-popup]').find('.tooltip.in').length);
}
function closePopoverOnEscape(event){
if(event.which === 27 && !isModalLaunchedFromPopOver() && !isTooltipContainedInPopOver())
closePopover();
}
function closePopover(){
scope.$evalAsync('closePopover()');
}
function closePopoverOnOutsideClick(event) {
var $et = $(event.target);
var closeButton = $et.attr('ng-click') && $et.attr('ng-click') === 'closePopover()';
var saveButton = $et.attr('ng-click') && $et.attr('ng-click') === 'saveForm()';
if (closeButton || saveButton)
return;
if (!($et.closest(".popover-" + scope.fieldID).length || $et.closest(".popover-trigger-" + scope.fieldID).length) &&
!$et.closest("[uib-popover-template-popup]").length && $et.attr("uib-popover-template-popup") !== "" &&
!isModalLaunchedFromPopOver()) {
returnFocus = false;
scope.$evalAsync('closePopover()');
}
}
scope.$on("$destroy", function() {
$('body').off('keydown', executeEventHandlers);
$('body').off('click', closePopoverOnOutsideClick);
});
scope.$on('sp.spFormField.rendered', function(e, element, input) {
var parent = input.parent();
var select2Input = parent[0].querySelector('.select2-container input');
$timeout(function() {
if (select2Input)
select2Input.focus();
else
input.focus();
}, 0, false);
});
}
}
});
angular.module('sn.$sp').directive('spEditableField2', function(glideFormFactory, $http, spUtil, spModelUtil) {
return {
restrict: 'E',
templateUrl: 'sp_editable_field2.xml',
scope: {
fieldModel: "=",
table: "@",
tableId: "=",
block: "=?",
editableByUser: "=",
onChange: "=?",
onSubmit: "=?",
label: "@?"
},
transclude: true,
replace: true,
controller: function($scope) {
var REST_API_PATH = "/api/now/v2/table/";
var g_form;
$scope.fieldModel = $scope.fieldModel || {};
if (angular.isDefined($scope.label))
$scope.fieldModel.label = $scope.label;
$scope.editable = !$scope.fieldModel.readonly && $scope.editableByUser;
$scope.fieldID = $scope.table + "-" + $scope.fieldModel.name + "-" + $scope.tableId;
initGlideForm();
$scope.getGlideForm = function() {
return g_form;
};
$scope.$on('sp.spEditableField.save', function(e, fieldModel){
if (fieldModel == $scope.fieldModel)
$scope.saveForm();
});
$scope.saveForm = function() {
if (g_form)
g_form.submit();
};
function completeSave() {
var url = REST_API_PATH + $scope.table + "/" + $scope.tableId + "?sysparm_fields=" + $scope.fieldModel.name;
var data = {};
data[$scope.fieldModel.name] = $scope.fieldModel.value;
$http.put(url, data)
.success(function (data) {
console.log("Field update successful", data);
})
.error(function (reason) {
console.log("Field update failure", reason);
spUtil.retrieveSessionMessages();
});
}
function initGlideForm() {
if (g_form)
g_form.$private.events.cleanup();
var uiMessageHandler = function(g_form, type, message) {
switch (type) {
case 'addInfoMessage':
spUtil.addInfoMessage(message);
break;
case 'addErrorMessage':
spUtil.addErrorMessage(message);
break;
case 'clearMessages':
break;
default:
}
};
spModelUtil.extendField($scope.fieldModel);
g_form = glideFormFactory.create($scope, $scope.table, $scope.tableId, [$scope.fieldModel], null, {uiMessageHandler: uiMessageHandler});
$scope.$emit("spEditableField.gForm.initialized", g_form, $scope.fieldModel);
if (angular.isDefined($scope.onChange)) {
g_form.$private.events.on("change", function(fieldName, oldValue, newValue) {
return $scope.onChange.call($scope.onChange, g_form, $scope.fieldModel, oldValue, newValue);
});
}
if (angular.isDefined($scope.onSubmit))
g_form.$private.events.on("submit", function(){ return $scope.onSubmit.call($scope.onSubmit, g_form); });
g_form.$private.events.on('submitted', function() {
completeSave();
});
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spFieldListElement.js */
angular.module('sn.$sp').directive('snFieldListElement', function ($http, $sanitize, i18n, $filter, nowServer, $timeout) {
"use strict";
return {
restrict: 'E',
replace: true,
scope: {
field: '=',
snChange: '&',
getGlideForm: '&glideForm',
snDisabled: '='
},
template: '<input type="text" ng-disabled="snDisabled" class="input-field-min-width" name="{{::field.name}}" ng-model="field.value" id="sp_formfield_{{::field.name}}"/>',
controller: function($scope){
$scope.table = $scope.field.ed.dependent_value;
$timeout(function() {
$scope.$watch('field.dependentValue', function(newVal, oldVal){
$scope.table = $scope.field.dependentValue;
if (!angular.isDefined(newVal))
return;
if (newVal == oldVal)
return;
if (newVal != oldVal)
console.log("Should have changed tables to " + newVal);
var src = nowServer.getURL('table_fields', 'exclude_formatters=true&fd_table=' + newVal);
$http.post(src).success(function(response) {
$scope.field.choices = response;
if ($scope.field.ed.dependent_value)
$scope.field.value = $scope.field.displayValue = '';
});
});
});
},
link: function(scope, element) {
var orderBy = $filter('orderBy');
var isExecuting = false;
var fieldCache = {};
var data = [];
var term = "";
var initTimeout = null;
var value = scope.field.value;
var oldValue = scope.field.value;
var $select;
var previousScrollTop;
var currentTable = '';
var remove = i18n.getMessage("Remove");
function getRemoveItem(label){ return jQuery("<span class='sr-only' />").text(remove + " " + label); };
var select2Helpers = {
query: function(q){
term = q.term;
if (!currentTable)
currentTable = scope.table;
if (data.length == 0 || currentTable != scope.table) {
getFieldsForTable(scope.table, function(tableName, fields) {
data = fields;
filterData(q);
currentTable = scope.table;
});
} else
filterData(q);
},
initSelection: function(elem, callback) {
if (scope.field.displayValue) {
var items = [];
var values = scope.field.value.split(',');
var displayValues = scope.field.displayValue.split(',');
for (var i = 0; i < values.length; i++)
items.push({id: values[i], text: displayValues[i]});
callback(items);
} else
callback([]);
},
formatResult: function(item) {
var row = item.text;
if (item.reference && !item.children)
row += "<span style='float: right' class='expand fa fa-chevron-right' data-id='"+ item.id +"' data-reference='"+ item.reference +"'></span>";
return row;
},
formatSelectionCssClass: function(item, el) {
var anchorEl = el.parent().find("a");
anchorEl.removeAttr("tabindex");
anchorEl.addClass("fa fa-times");
anchorEl.append(getRemoveItem(item.text));
}
};
var config = {
containerCssClass : 'select2-reference ng-form-element',
placeholder : '    ',
formatSearching: '',
allowClear: true,
query: select2Helpers.query,
initSelection: select2Helpers.initSelection,
formatResult: select2Helpers.formatResult,
formatSelectionCssClass: select2Helpers.formatSelectionCssClass,
closeOnSelect: false,
multiple: true
};
function filterData(q) {
var r = {results: []};
for (var c in data) {
var row = data[c];
if (q.term.length == 0 || row.text.toUpperCase().indexOf(q.term.toUpperCase()) >= 0 || row.id.toUpperCase().indexOf(q.term.toUpperCase()) >= 0 )
r.results.push(row);
}
q.callback(r);
}
function init() {
scope.$evalAsync(function() {
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
i18n.getMessage('No matches found', function(msg) {
config.formatNoMatches = function() {
return msg;
};
});
i18n.getMessage('Loading more results...', function(msg) {
config.formatLoadMore = function(pageNumber) {
return msg;
};
});
element.css("opacity", 1);
element.select2("destroy");
$select = element.select2(config);
$select.bind("select2-open", onDropdownShow);
$select.bind("select2-close", onDropdownClose);
$select.bind("select2-selecting", onSelecting);
$select.bind("select2-removing", onRemoving);
$select.bind("change", onChange);
$select.bind("select2-loaded", onResultsLoaded);
var sortable = new Sortable($select.select2("container").find("ul.select2-choices").get(0), {
onStart: function(){
$select.select2("onSortStart");
},
onEnd: function(){
$select.select2("onSortEnd");
}
});
});
}
function expandHandler(e) {
e.preventDefault();
e.stopPropagation();
if (e.type == 'click') {
var $el = angular.element(this);
previousScrollTop = $el.parents('ul.select2-results').scrollTop();
var d = $el.data();
var targetRow = getDataRowByFieldName(d.id);
getFieldsForTable(d.reference, function(tableName, refFields){
for (var i=0; i<refFields.length; i++)
refFields[i].id = d.id + '.' + refFields[i].id;
targetRow.children = refFields;
$select.select2("search", term);
});
}
};
function getDataRowByFieldName(fieldName){
var fieldNames = fieldName.split('.');
var row = getDataRowByFieldNamePart(fieldNames[0], data);
if (fieldNames.length > 1)
for (var i = 1; i < fieldNames.length; i++)
row = getDataRowByFieldNamePart(fieldNames[i], row.children);
return row;
}
function getDataRowByFieldNamePart(fieldNamePart, fieldArr){
for (var i = 0; i<fieldArr.length; i++)
if (fieldArr[i].fieldName == fieldNamePart) return fieldArr[i];
}
function getFieldsForTable(tableName, callback){
if (tableName in fieldCache) {
var fields = getOrderedFieldsFromCache(tableName);
callback.call(this, tableName, fields);
return;
}
$http.get('/api/now/ui/meta/' + tableName).then(function(r) {
var fields = [];
if (r.data && r.data.result && r.data.result.columns) {
fieldCache[tableName] = r.data.result.columns;
fields = getOrderedFieldsFromCache(tableName);
}
callback.call(this, tableName, fields);
});
function getOrderedFieldsFromCache(tableName){
var col, cols = [], fields = fieldCache[tableName];
for (var c in fields) {
col = fields[c];
cols.push({fieldName: col.name, id: col.name, text: col.label, reference: col.reference});
}
return orderBy(cols, 'text', false);
}
}
function onResultsLoaded() {
if (!previousScrollTop)
return;
scope.$evalAsync(function(){
angular.element('ul.select2-results').scrollTop(previousScrollTop);
previousScrollTop = null;
});
}
function onDropdownShow() {
angular.element('ul.select2-results').on('mousedown click mouseup', 'span.expand', expandHandler);
}
function onDropdownClose() {
angular.element('ul.select2-results').off('mousedown click mouseup', 'span.expand', expandHandler);
}
function onChange(e) {
if (scope.field.displayValue != scope.field.value) {
var actualValue = scope.field.value;
var values = [] ;
setValue(values, e);
var values = actualValue.split(',');
setValue(values, e);
} else
setValue(e.val, e);
}
function onSelecting(e) {
var selectedItem = e.choice;
if (selectedItem['id'] != '') {
var values = scope.field.value == '' ? [] : scope.field.value.split(',');
values.push(selectedItem['id']);
setValue(values, e);
}
}
function onRemoving(e) {
var removed = e.choice;
var values = scope.field.value.split(',');
for (var i = values.length-1; i>=0; i--){
if (removed['id'] == values[i]) {
values.splice(i, 1);
break;
}
}
setValue(values, e);
}
function setValue(values, e) {
isExecuting = true;
oldValue = scope.field.value;
scope.field.value = scope.field.displayValue = values.join(',');
e.preventDefault();
$select.select2('val', scope.field.value.split(','));
scope.$apply(function() {
if (scope.snChange)
scope.snChange({
field: scope.field,
newValue: scope.field.value,
displayValue: scope.field.displayValue,
oldValue: oldValue
});
isExecuting = false;
});
}
scope.$watch("field.value", function(newValue) {
if (isExecuting) return;
if (angular.isDefined(newValue) && $select) {
$select.select2('val', newValue.split(',')).select2('close');
}
});
init();
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spReferenceElement.js */
angular.module('sn.$sp').directive('spReferenceElement', function ($http, spUtil, filterExpressionParser, escapeHtml, i18n, md5, spIs, spAriaUtil, select2EventBroker, spAriaFocusManager) {
"use strict";
var defaultPlaceholder = '    ';
return {
restrict: 'E',
replace: true,
scope: {
ed: "=?",
field: "=",
refTable: "=?",
refId: "=?",
snOptions: "=?",
snOnBlur: "&",
snOnClose: "&",
minimumInputLength : "@",
snDisabled: "=",
dropdownCssClass: "@",
formatResultCssClass: "&",
displayColumn: "@",
recordValues: '&',
getGlideForm: '&glideForm',
domain: "@",
snSelectWidth: '@',
labelId: '@?'
},
template: '<input type="text" id="sp_formfield_{{::field.name}}" name="{{::field.name}}" ng-disabled="snDisabled" class="input-field-min-width" aria-hidden="true" />',
link: function(scope, element, attrs, ctrl) {
scope.cacheData = {};
scope.ed = scope.ed || scope.field.ed;
scope.selectWidth = scope.snSelectWidth || '100%';
element.css("opacity", 0);
var isOpen = false;
var fireReadyEvent = true;
var g_form;
var field = scope.field;
var isMultiple = scope.snOptions && scope.snOptions.multiple === true;
if (angular.isDefined(scope.getGlideForm))
g_form = scope.getGlideForm();
var tableAttributes = field.table_attributes || {};
var fieldAttributes = {};
if (field.attributes && typeof scope.ed.attributes == 'undefined')
if (Array.isArray(field.attributes))
fieldAttributes = field.attributes;
else
fieldAttributes = spUtil.parseAttributes(field.attributes);
else
fieldAttributes = spUtil.parseAttributes(scope.ed.attributes);
var refOrderBy = getFieldOrTableAttribute("ref_ac_order_by");
var columnsSearch = getFieldOrTableAttribute("ref_ac_columns_search") == "true";
var displayColumns = getFieldOrTableAttribute("ref_ac_columns");
var refAutoCompleter = getFieldOrTableAttribute("ref_auto_completer") || "AJAXReferenceCompleter";
function getFieldOrTableAttribute(name) {
if (angular.isDefined(fieldAttributes[name]))
return fieldAttributes[name];
if (angular.isDefined(tableAttributes[name]))
return tableAttributes[name];
return "";
}
function getPlaceholder() {
var ph = defaultPlaceholder;
if (field.placeholder) {
ph = field.placeholder;
}
if (scope.snOptions && scope.snOptions.placeholder) {
ph = scope.snOptions.placeholder;
}
return ph;
}
var s2Helpers = {
formatSelection: function(item) {
return escapeHtml(getDisplayValue(item));
},
formatSelectionCssClass: function(item, el) {
var anchorEl = el.parent().find("a");
anchorEl.removeAttr("tabindex");
anchorEl.addClass("fa fa-times");
var ariaLabel = i18n.getMessage("Remove {0} from {1}").withValues([getDisplayValue(item), field.label]);
anchorEl.attr("aria-label", ariaLabel);
},
formatResult: function(item) {
var displayValues = getDisplayValues(item);
if (displayValues.length == 1)
return escapeHtml(displayValues[0]);
if (displayValues.length > 1) {
var width = 100 / displayValues.length;
var markup = "";
for (var i = 0; i < displayValues.length; i++)
markup += "<div style='width: " + width + "%;display: inline-block;word-wrap:break-word;vertical-align:top' class='select2-result-cell'>" + escapeHtml(displayValues[i])  + "</div>";
return markup;
}
return "";
},
search: function(queryParams) {
var key = md5(JSON.stringify(queryParams.data));
var cachedResponse = scope.cacheData[key];
if (cachedResponse)
return queryParams.success(cachedResponse);
var url = spUtil.getURL({sysparm_type: 'sp_ref_list_data', sysparm_cancelable:true});
return $http.post(url, queryParams.data).then(function(response){
if (response.data && response.data.items) {
scope.cacheData[key] = response;
queryParams.success(response);
}
});
},
initSelection: function(elem, callback) {
if (field.displayValue) {
if (isMultiple) {
var isPricingField = field._pricing && field._pricing.pricing_implications === true;
var items = [];
var values = typeof field.value === 'string' ? field.value.split(',') : field.value;
var displayValues = field.display_value_list;
var priceValues = [];
if (isPricingField)
priceValues = field.price_value_list;
if (Array.isArray(field.displayValue)) {
displayValues.length = 0;
for (var i in field.displayValue)
displayValues[i] = field.displayValue[i];
field.displayValue = displayValues.join(g_glide_list_separator);
} else if (values.length == 1) {
displayValues.length = 0;
displayValues[0] = field.displayValue;
} else if (field.displayValue != displayValues.join(g_glide_list_separator)) {
displayValues.length = 0;
var split = field.displayValue.split(',');
for (var i in split)
displayValues[i] = split[i];
}
for(var i=0; i < values.length; i++) {
if (isPricingField) {
items.push({
sys_id: values[i],
name: displayValues[i],
pricing: priceValues[i]
});
} else {
items.push({
sys_id: values[i],
name: displayValues[i]
});
}
}
callback(items);
}
else {
callback({
sys_id: field.value,
name: field.displayValue
});
}
} else
callback([]);
},
onSelecting: function(e) {
var selectedItem = e.choice;
if ('sys_id' in selectedItem) {
var values = typeof field.value === 'string' ? (field.value === '' ? [] : field.value.split(',')) : field.value;
var displayValues = field.display_value_list;
var priceValues = field.price_value_list;
values.push(selectedItem.sys_id);
displayValues.push(getDisplayValue(selectedItem));
if (field['_cat_variable'] === true && field._pricing && field._pricing.pricing_implications === true) {
var priceSelected = getPriceValue(selectedItem);
updatePrice(priceSelected, true);
if (priceValues)
priceValues.push(priceSelected);
}
g_form.setValue(field.name, values.join(','), displayValues);
e.preventDefault();
element.select2('val', values).select2('close');
element.parent().find(".select2-input").removeAttr("aria-activedescendant");
element.parent().find(".select2-choices input[role='combobox']").focus();
}
},
onRemoving: function(e) {
var removed = e.choice;
var values = typeof field.value === 'string' ? field.value.split(',') : field.value;
var displayValues = field.display_value_list;
var priceValues = field.price_value_list;
for(var i = values.length-1; i>=0; i--){
if (removed.sys_id == values[i]) {
values.splice(i, 1);
displayValues.splice(i, 1);
if (field['_cat_variable'] === true && field._pricing && field._pricing.pricing_implications === true) {
if (priceValues && priceValues.length > i) {
var priceRemoved = priceValues[i];
updatePrice(priceRemoved, false);
priceValues.splice(i,1);
}
}
break;
}
}
g_form.setValue(field.name, values.join(','), displayValues);
e.preventDefault();
element.select2('val', values);
if (displayValues.length === 0) {
element.parent().find(".select2-input").trigger('keyup');
setAccessiblePlaceholder();
}
},
select2Change: function(e) {
e.stopImmediatePropagation();
if (e.added) {
var selectedItem = e.added;
var value = selectedItem.ref_key_value || selectedItem.sys_id;
var displayValue = value ? getDisplayValue(selectedItem) : '';
if (field['_cat_variable'] === true && ('price' in selectedItem || 'recurring_price' in selectedItem))
setPrice(selectedItem.price, selectedItem.recurring_price);
g_form.setValue(field.name, value, displayValue);
field.refTable = field.ed.reference;
} else if (e.removed) {
if (field['_cat_variable'] === true)
setPrice(0, 0);
g_form.clearValue(field.name);
}
if (e.type == 'select2-removed')
$(e.currentTarget).parent().find('.select2-focusser').focus();
setAccessiblePlaceholder();
},
onOpening: function(e) {
select2EventBroker.publishSelect2Opening();
}
};
var lookupMsg = jQuery("<span class='sr-only' />");
lookupMsg.text(i18n.getMessage("Lookup using list"));
function setAccessiblePlaceholder() {
if (!field.value && getPlaceholder() === defaultPlaceholder)
element.parent().find('.select2-chosen').append(lookupMsg);
if (defaultPlaceholder !== getPlaceholder())
element.parent().find('.select2-input').attr('placeholder', getPlaceholder());
}
function clearPlaceholder() {
element.parent().find('.select2-input').attr('placeholder', '');
}
var config = {
width : scope.selectWidth,
placeholder : getPlaceholder(),
minimumInputLength: scope.minimumInputLength ? parseInt(scope.minimumInputLength, 10) : 0,
containerCssClass : 'select2-reference ng-form-element',
formatSearching: '',
allowClear: attrs.allowClear !== 'false',
id: function(item) {
return item.sys_id;
},
sortResults: (scope.snOptions && scope.snOptions.sortResults) ? scope.snOptions.sortResults : undefined,
ajax: {
quietMillis: NOW.ac_wait_time,
data: function(filterText, page) {
var filterExpression = filterExpressionParser.parse(filterText, scope.ed.defaultOperator);
var q = '';
var columnsToSearch = getReferenceColumnsToSearch();
var queryArr = [];
var query;
var notNullRequired = (filterText === "");
columnsToSearch.forEach(function(colToSearch) {
query = "";
if (field.ed.queryString)
query += field.ed.queryString + '^';
query += colToSearch + filterExpression.operator + filterExpression.filterText;
if (notNullRequired && (!g_sort_elements_by_session_language || g_lang === 'en'))
query += '^' + colToSearch + 'ISNOTEMPTY';
query += getExcludedValues();
queryArr.push(query);
});
q += queryArr.join("^NQ");
if (refOrderBy) {
var orderByArr = refOrderBy.split(";");
for (var i = 0; i < orderByArr.length; i++)
q += "^ORDERBY" + orderByArr[i].trim();
}
q += "^EQ";
var params = {
start: (scope.pageSize * (page - 1)),
count: scope.pageSize,
sysparm_target_table: scope.refTable,
sysparm_target_sys_id: scope.refId,
sysparm_target_field: field.name,
table: scope.ed.reference,
qualifier: scope.ed.qualifier,
data_adapter: scope.ed.data_adapter,
attributes: scope.ed.attributes,
dependent_field: scope.ed.dependent_field,
dependent_table: scope.ed.dependent_table,
dependent_value: scope.ed.dependent_value,
p: scope.ed.reference,
q: q,
r: scope.ed.qualifier
};
if (displayColumns)
params.required_fields = displayColumns.split(";").join(":");
if (scope.domain) {
params.sysparm_domain = scope.domain;
}
if (angular.isDefined(field) && field['_cat_variable'] === true) {
delete params['sysparm_target_table'];
params['sysparm_include_variables'] = true;
params['variable_ids'] = field.sys_id;
var getFieldSequence = g_form.$private.options('getFieldSequence');
if (getFieldSequence) {
params['variable_sequence1'] = getFieldSequence();
}
var itemSysId = g_form.$private.options('itemSysId');
params['sysparm_id'] = itemSysId;
params['sysparm_query_refs'] = false;
var getFieldParams = g_form.$private.options('getFieldParams');
if (getFieldParams) {
angular.extend(params, getFieldParams());
}
}
if (scope.recordValues)
params.sysparm_record_values = scope.recordValues();
var encodedRecord = g_form.getEncodedRecord && g_form.getEncodedRecord();
if (encodedRecord)
params.sysparm_encoded_record = encodedRecord;
return params;
},
results: function(data, page) {
return ctrl.filterResults(data, page, scope.pageSize);
},
transport: s2Helpers.search
},
formatSelection: s2Helpers.formatSelection,
formatSelectionCssClass: s2Helpers.formatSelectionCssClass,
formatResult: s2Helpers.formatResult,
initSelection: s2Helpers.initSelection,
dropdownCssClass: attrs.dropdownCssClass,
formatResultCssClass: scope.formatResultCssClass || null,
multiple: isMultiple
};
if (isMultiple && scope.ed.reference == "sys_user" && !scope.field._cat_variable) {
config.createSearchChoice = function (term) {
if (spIs.an.email(term)) {
return {
email: term,
name: term,
user_name: term,
sys_id: term
};
}
};
}
if (scope.snOptions && scope.snOptions.width) {
config.width = scope.snOptions.width;
}
function getReferenceColumnsToSearch() {
var colNames = ['name'];
if (columnsSearch && displayColumns) {
colNames = displayColumns.split(';');
if (scope.ed.searchField)
colNames.push(scope.ed.searchField);
}
else if (scope.ed.searchField)
colNames = [scope.ed.searchField];
else if (refOrderBy)
colNames = [refOrderBy];
return colNames.filter(onlyUnique);
}
function getExcludedValues () {
if (scope.ed.excludeValues && scope.ed.excludeValues != '') {
return '^sys_idNOT IN' + scope.ed.excludeValues;
}
return '';
}
function init() {
scope.$evalAsync(function() {
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
i18n.getMessage('No matches found', function(msg) {
config.formatNoMatches = function() {
return msg;
};
});
i18n.getMessage('Loading more results...', function(msg) {
config.formatLoadMore = function(pageNumber) {
return msg;
};
});
element.css("opacity", 1);
element.select2("destroy");
var select2 = element.select2(config);
element.select2('val', typeof field.value === 'string' ? field.value.split(',') : field.value);
if (!isMultiple && spAriaUtil.g_accessibility == 'true') {
var closeButton = element.parent().find('.select2-search-choice-close');
closeButton.attr('aria-label', i18n.getMessage('Clear'));
closeButton.attr('tabindex', 0);
closeButton.attr('role', 'button');
closeButton.on('keydown', function(e) {
if (e.which === 13 || e.which === 32)
element.select2('val', '', true);
});
}
if (isMultiple){
element.bind("select2-selecting", s2Helpers.onSelecting);
element.bind("select2-removing", s2Helpers.onRemoving);
element.parent().on('keyup', '.select2-search-choice-close', function(evt){
if(evt.which === 32) {
evt.stopImmediatePropagation();
evt.target.click();
}
});
} else {
element.bind("change select2-removed", s2Helpers.select2Change);
}
element.bind("select2-opening", s2Helpers.onOpening);
element.bind("select2-blur", function() {
scope.$evalAsync(function() {
scope.snOnBlur();
if (field.value === '')
return;
var values = typeof field.value === 'string' ? field.value.split(',') : field.value;
var displayValues = field.display_value_list;
g_form.setValue(field.name, values.join(','), displayValues);
});
});
element.bind("select2-open", function(){
if (element.data('select2').search.val() === " ")
element.select2("search", "");
isOpen = true;
if (isMultiple) {
element.parent().find(".select2-choices input[role='combobox']").attr("aria-expanded", isOpen);
setAccessiblePlaceholder();
}
else
element.parent().find(".select2-focusser").attr("aria-expanded", isOpen);
});
element.bind("select2-close", function(){
isOpen = false;
if (isMultiple) {
element.parent().find(".select2-choices input[role='combobox']").attr("aria-expanded", isOpen);
clearPlaceholder();
}
else
element.parent().find(".select2-focusser").attr("aria-expanded", isOpen);
});
if (fireReadyEvent) {
scope.$emit('select2.ready', element);
fireReadyEvent = false;
}
if (!isMultiple
|| (isMultiple && field.display_value_list && field.display_value_list.length === 0))
setAccessiblePlaceholder();
element.parent().find(".select2-input").attr("autocomplete", "off");
if (isMultiple) {
element.parent().find(".select2-input")
.on('focus', function(e) {
var length = element.parent().find(".select2-search-choice-close.fa.fa-times").length;
if (length > 0) {
var ariaLiveMessage;
if (length === 1)
ariaLiveMessage = i18n.getMessage("1 item selected");
else
ariaLiveMessage = i18n.format(i18n.getMessage("{0} items selected"), length);
spAriaUtil.sendLiveMessage(ariaLiveMessage, "status");
}
})
.parent().attr("aria-hidden", "true");
}
$(element).on("select2.disabled.toggle",function(element){
spAriaFocusManager.enableFocusOnDisabledSelect2(element);
});
var select2Results = element.parent().find('ul.select2-results');
if (isMultiple) {
var select2ComboBox = element.parent().find(".select2-choices input[role='combobox']");
element.parent().find('ul.select2-choices').removeAttr('role');
select2ComboBox.attr('aria-expanded', isOpen);
select2ComboBox.attr('aria-owns', select2Results.attr('id'));
var select2Choices = element.parent().find('.select2-choices');
select2Choices.addClass('form-control');
} else {
var select2Focusser = element.parent().find('.select2-focusser');
select2Focusser.removeAttr('aria-labelledby');
select2Focusser.attr('aria-label', getAriaLabel());
select2Focusser.attr('aria-required', field.isMandatory());
select2Focusser.attr('aria-expanded', isOpen);
select2Focusser.attr('aria-owns', select2Results.attr('id'));
}
select2Results.attr('aria-label', field.label);
var select2Choice = element.parent().find(".select2-choice");
var select2ChoiceClose = element.parent().find(".select2-search-choice-close");
select2Choice.attr("aria-hidden", "true");
select2ChoiceClose.on('focus blur', function(e) {
if (e.type === 'focus')
select2Choice.attr('aria-hidden', 'false');
else {
setTimeout(function () {
select2Choice.attr('aria-hidden', 'true');
}, 50);
}
});
select2Choice.addClass('form-control');
element.parent().find(".select2-focusser").on("keydown", function(e) {
if (e.which === 40 || e.which === 38)
element.select2('open');
});
if (!isMultiple) {
element.on("click",  function(e) {
var selectionElem = element.parent().find(".select2-focusser")[0];
if(selectionElem && selectionElem.getAttribute("tabindex") === "-1")
selectionElem.removeAttribute("tabindex");
});
function swapFocusableEls(domFocusableElems, clearElemIndex, selectionElemIndex) {
var elem = domFocusableElems[clearElemIndex];
domFocusableElems[clearElemIndex] = domFocusableElems[selectionElemIndex];
domFocusableElems[selectionElemIndex] = elem;
return domFocusableElems;
}
var referenceContainer = element.parent().parent();
referenceContainer.on("keydown", function(e) {
var isPopoverContent = $(e.target).closest('.popover-content')[0];
if(isPopoverContent)
return;
var selectionElem = element.parent().find(".select2-focusser")[0];
if (selectionElem)
selectionElem.removeAttribute("tabindex");
var domFocusableEls = window.tabbable(referenceContainer[0]);
if (!domFocusableEls.length)
return;
var clearElem = element.parent().find(".select2-search-choice-close")[0];
var selectionElemIndex = domFocusableEls.indexOf(selectionElem);
var clearElemIndex = domFocusableEls.indexOf(clearElem);
if (clearElemIndex === -1 )
return;
var customFocusableEls = swapFocusableEls(domFocusableEls, clearElemIndex, selectionElemIndex);
var currentFocusableElemIndex = customFocusableEls.indexOf(document.activeElement);
var firstFocusableEl = customFocusableEls[0];
if (currentFocusableElemIndex == -1)
return;
if (document.activeElement === clearElem && !e.shiftKey)
selectionElem.setAttribute("tabindex" , "-1");
if (e.which === 9) {
if (e.shiftKey) {
if (document.activeElement === firstFocusableEl)
return;
else if (customFocusableEls[currentFocusableElemIndex - 1])
customFocusableEls[currentFocusableElemIndex - 1].focus();
} else {
if (document.activeElement === clearElem)
return;
else if (customFocusableEls[currentFocusableElemIndex + 1])
customFocusableEls[currentFocusableElemIndex + 1].focus();
}
event.preventDefault();
event.stopPropagation();
}
});
}
var el = element.parent().find(".select2-focusser")[0];
if(el) {
var currentBindings = $._data(el, 'events')["keydown"];
if ($.isArray(currentBindings))
currentBindings.unshift(currentBindings.pop());
}
});
}
function getAriaLabel() {
var label = "";
label += field.label;
if (field.displayValue) {
label += (" " + field.displayValue);
}
return label;
}
function getDisplayValue(selectedItem) {
var displayValue = '';
if (selectedItem && (selectedItem.ref_key_value || selectedItem.sys_id)) {
if (scope.displayColumn && typeof selectedItem[scope.displayColumn] != "undefined")
displayValue = selectedItem[scope.displayColumn];
else if (selectedItem.$$displayValue)
displayValue = selectedItem.$$displayValue;
else if (selectedItem.name)
displayValue = selectedItem.name;
else if (selectedItem.title)
displayValue = selectedItem.title;
}
return displayValue;
}
function getPriceValue(selectedItem) {
var priceValue = {};
if (selectedItem && selectedItem.sys_id) {
priceValue.price = selectedItem.price ? selectedItem.price : 0.0;
priceValue.recurring_price = selectedItem.recurring_price ? selectedItem.recurring_price : 0.0;
}
return priceValue;
}
function getDisplayValues(selectedItem) {
var displayValues = [];
if (selectedItem && selectedItem.sys_id) {
displayValues.push(getDisplayValue(selectedItem));
}
if (displayColumns && refAutoCompleter === "AJAXTableCompleter") {
var columns = displayColumns.split(";");
var defaultDisplayColumn = selectedItem && selectedItem.$$displayField;
for (var i = 0; i < columns.length; i++) {
if (defaultDisplayColumn === columns[i])
continue;
var column = columns[i];
displayValues.push(selectedItem[column] ? selectedItem[column] : "");
}
}
return displayValues;
}
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function setPrice(p, rp) {
field.price = p;
field.recurring_price = rp;
}
function updatePrice(priceToUpdate, add) {
field.price = Number(field.price);
field.recurring_price = Number(field.recurring_price);
if(!field.price) {
field.price = 0.0;
}
if(!field.recurring_price)
field.recurring_price = 0.0;
if (add == true) {
field.price += Number(priceToUpdate.price);
field.recurring_price += Number(priceToUpdate.recurring_price);
} else {
field.price -= Number(priceToUpdate.price);
field.recurring_price -= Number(priceToUpdate.recurring_price);
}
}
g_form.$private.events.on("change", function(fieldName, oldValue, value) {
if (fieldName == field.name) {
if (value == "" && field.display_value_list) {
field.display_value_list.length = 0;
if (field.price_value_list)
field.price_value_list.length = 0;
}
if (isMultiple && field.display_value_list && field.display_value_list.length > 0)
clearPlaceholder();
if (!isMultiple && !oldValue && value) {
var ariaLiveMessage = i18n.format("To preview {0} details go back to preview button" , field.displayValue);
spAriaUtil.sendLiveMessage(ariaLiveMessage);
}
element.select2("val", typeof value == 'string' ? value.split(',') : value);
element.parent().find(".select2-focusser").attr("aria-label", getAriaLabel());
element.parent().find(".select2-focusser").attr("aria-required", field.isMandatory());
}
});
scope.$on("snReferencePicker.activate", function(evt, parms) {
$scope.$evalAsync(function() {
element.select2("open");
})
});
scope.$on("select2.ready", function() {
if (scope.labelId && scope.field.type === 'reference' && spAriaUtil.g_accessibility == "true") {
element.parent().find(".select2-focusser").attr("aria-labelledby", scope.labelId);
}
});
init();
},
controller: function($scope, $rootScope) {
$scope.pageSize = NOW.ac_max_search_matches;
this.filterResults = function(data, page) {
return {
results: data.data.items,
more: (page * $scope.pageSize < data.data.total)
};
};
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spCurrencyElement.js */
angular.module('sn.$sp').directive('spCurrencyElement', function() {
return {
templateUrl: 'sp_element_currency.xml',
restrict: 'E',
replace: true,
scope: {
field: '=',
snBlur: '&',
snChange: '&',
'getGlideForm': '&glideForm'
},
controller: function($scope) {
var g_form = $scope.getGlideForm();
var field = $scope.field;
$scope.field.currencyValue = formatNumber(field.currencyValue);
g_form.$private.events.on("change", function(fieldName, oldValue, newValue) {
if (fieldName == field.name) {
if (newValue.indexOf(";") > 0) {
var v = newValue.split(";");
field.currencyCode = v[0];
field.currencyValue = formatNumber(v[1]);
} else
field.currencyValue = formatNumber(newValue);
}
});
$scope.formatValue = function(shouldSetValue) {
var v = field.currencyValue;
if (field.currencyValue != "")
v = field.currencyCode + ";" + field.currencyValue;
field.stagedValue = v;
$scope.snChange();
if (shouldSetValue)
$scope.snBlur();
}
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spDurationElement.js */
angular.module('sn.$sp').directive('spDurationElement', function (spLabelHelper, spAriaUtil, i18n) {
"use strict";
if (typeof moment.tz !== "undefined")
moment.tz.setDefault(g_tz);
function getVisibleUnits(attributes) {
var maxUnit = "days";
var o = {
days: ["days", "hours", "minutes", "seconds"],
hours: ["hours", "minutes", "seconds"],
minutes: ["minutes", "seconds"],
seconds: ["seconds"]
};
if (attributes && attributes.max_unit && attributes.max_unit in o)
maxUnit = attributes.max_unit;
return o[maxUnit];
}
function parseDurationToParts(value) {
var MS_IN_DAY = 86400000;
var parts = value.split(" ");
if (parts.length == 2) {
var times = parts[1].split(":");
for (var i = 0; i < times.length; i++)
parts[1 + i] = times[i];
var dateParts = parts[0].split("-");
if (dateParts.length == 3)
parts[0] = parseInt(Date.parse(dateParts[1]
+ '/' + dateParts[2] + '/'
+ dateParts[0] + ' 00:00:00 UTC'))
/ MS_IN_DAY;
}
return parts;
}
return {
restrict: 'E',
replace: true,
require: 'ngModel',
templateUrl: 'sp_element_duration.xml',
link: function(scope, element, attrs, ngModelCtrl) {
scope.field = scope.$eval(attrs.field);
scope.labelElement = element.find('legend');
scope.visibleUnits = getVisibleUnits(scope.field.attributes);
scope.field.mandatory_filled = function() {
if (!scope.field.stagedValue || scope.field.stagedValue == "1970-01-01 00:00:00")
return false;
return true;
}
scope.syncFieldAriaLabel = spLabelHelper.syncFieldAriaLabel;
scope.getFieldAriaLabel = spLabelHelper.getFieldAriaLabel;
scope.accessible = spAriaUtil.isAccessibilityEnabled();
ngModelCtrl.$formatters.push(function() {
if (!ngModelCtrl.$modelValue)
return { days: 0, hours: 0, minutes: 0, seconds: 0 };
var duration = parseDurationToParts(ngModelCtrl.$modelValue);
var d = duration[0];
var h = duration[1];
var m = duration[2];
var s = duration[3];
scope.field.value = d + " " + h + ":" + m +":" + s;
if (scope.visibleUnits[0] == "hours") {
h = +h + (d * 24) + '';
d = 0;
} else if (scope.visibleUnits[0] == "minutes") {
m = +m + (h * 60) + (d * 1440) + '';
d = h = 0;
} else if (scope.visibleUnits[0] == "seconds") {
s = +s + (m * 60) + (h * 3600) + (d * 86400) + '';
d = h = m = 0;
}
return {
days: d,
hours: h,
minutes: m,
seconds: s
};
});
ngModelCtrl.$render = function() {
scope.parts = ngModelCtrl.$viewValue;
};
ngModelCtrl.$parsers.push(function(model) {
var newValue = model.days + ' ' + massageFormat(model.hours) + ':' + massageFormat(model.minutes) + ':' + massageFormat(model.seconds);
return newValue;
});
function massageFormat(value) {
if  (!value)
value = '00';
else if (value.length == 1)
value = '0' + value;
return value;
};
scope.updateDuration = function() {
ngModelCtrl.$setViewValue(angular.copy(scope.parts));
};
scope.getGlideForm().$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (fieldName != scope.field.name)
return;
if (propertyName === 'readonly')
scope.syncFieldAriaLabel(scope);
});
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spEmailElement.js */
angular.module('sn.$sp').directive('spEmailElement', function(getTemplateUrl) {
"use strict";
return {
restrict : 'E',
templateUrl : 'sp_element_email.xml'
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spMaskElement.js */
angular.module('sn.$sp').directive('spMaskElement', function(i18n) {
"use strict";
return {
restrict : 'E',
scope : {
field: '=',
onChange: '&snChange',
onBlur: '&snBlur',
disabled: '=snDisabled',
placeholder: '=',
getGlideForm: '&glideForm'
},
templateUrl : 'sp_element_mask.xml',
controller: function($scope) {
var c = this;
var VALUE_MASK = '**********';
$scope.inputType = 'password';
$scope.toggleShowHide = i18n.getMessage('u_show');
if (!$scope.field.catalog_view_masked && $scope.field.stagedValue != '') {
$scope.field.stagedValue = VALUE_MASK;
}
$scope.modelValueChange = function() {
$scope.field._setFromModel = true;
$scope.getGlideForm().setValue($scope.field.name, $scope.field.stagedValue);
},
$scope.handleValueChanged = function() {
$scope.modelValueChange();
c.validate();
}
c.validate = function () {
if ($scope.field.stagedValue !== $scope.field.confirmPassword && $scope.field.useConfirmation == true)
$scope.field.isInvalid = true;
else
$scope.field.isInvalid = false;
$scope.onChange();
},
c.cleanData = function () {
if ($scope.field.stagedValue === VALUE_MASK) {
$scope.field.stagedValue = '';
$scope.field.confirmPassword = '';
}
},
c.togglePassword = function () {
if ($scope.inputType == 'password') {
$scope.toggleShowHide = i18n.getMessage('u_hide');
$scope.inputType = 'text';
}
else {
$scope.toggleShowHide = i18n.getMessage('u_show');
$scope.inputType = 'password';
}
}
},
controllerAs: 'c',
link: function(scope, elem, attrs) {
scope.field.isInvalid = false;
scope.field.confirmPassword = scope.field.stagedValue;
scope.reEnter = i18n.format(i18n.getMessage('Re-enter `{0}`'), scope.field.label);
scope.misMatch = i18n.getMessage('Confirmation must match');
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spHelpTag.js */
angular.module('sn.$sp').directive('spHelpTag', function($sce, i18n, spAriaUtil, spLabelHelper) {
'use strict';
return {
restrict : 'E',
templateUrl: 'sp_help_tag.xml',
scope: {
field: '='
},
controller : function($scope) {
$scope.trustedHTML = function(html) {
return $sce.trustAsHtml(html);
}
$scope.accessible = spAriaUtil.isAccessibilityEnabled();
$scope.getFieldAriaLabel = spLabelHelper.getFieldAriaLabel;
},
link : function(scope, element) {
scope.hideHelp = function() {
scope.field.expand_help = false;
element[0].firstElementChild.focus();
}
scope.getHelpAriaLabel = function() {
return i18n.format(i18n.getMessage('{h} for {f}'),
{f: scope.field.label,
h: scope.field.help_tag});
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spUrlElement.js */
angular.module('sn.$sp').directive('spUrlElement', function ($rootScope, i18n) {
return {
restrict: 'E',
replace: true,
templateUrl: 'sp_element_url.xml',
require: '?ngModel',
scope: {
field: '='
},
controller: function ($scope) {},
link: function ($scope, $element, $attrs) {
var unlockEmptyUrl = $attrs.unlockEmptyUrl;
var ref = "sp_formfield_" + $attrs.name;
var lockId = ref + "_lock";
var unlockId = ref + "_unlock";
var emptySpan = $element.find('[id*="empty_url"]');
var lockButton = $element.find('button[id*="_lock"]');
var unlockButton = $element.find('button[id*="_unlock"]');
if (!$scope.field.value && unlockEmptyUrl == "true") {
$(emptySpan).css('display', 'none');
$element.find('input').css('display', '');
$element.find('a').css('display', 'none');
lockButton.css('display', '');
unlockButton.css('display', 'none');
}
lockButton.on('click', function () {
lock(this, ref, ref, ref + "_link", ref, ref + "_link", true);
});
unlockButton.on('click', function () {
unlock(this, ref, ref, ref + "_link", ref, ref + "_link");
});
function lock(me, ref, edit_id, nonedit_id, current_value_id, update_id, keep_focus) {
if (!$scope.field.value)
$(emptySpan).css('display', '');
if (me)
me.style.display = "none";
var unlock = gel(ref + '_unlock');
unlock.style.display = "";
var edit_span = gel(edit_id);
edit_span.style.display = "none";
var nonedit_span = gel(nonedit_id);
nonedit_span.style.display = "inline-block";
var current_value = gel(current_value_id);
var the_value = current_value.value;
var update_element = gel(update_id);
if (update_element.href) {
update_element.href = the_value;
update_element.style.removeProperty('display');
}
update_element.innerHTML = htmlEscape(the_value);
if (keep_focus)
unlock.focus();
}
function unlock(me, ref, edit_id, nonedit_id) {
$(emptySpan).css('display', 'none');
if (me)
me.style.display = "none";
var unlock = gel(ref + '_lock');
if (unlock)
unlock.style.display = "inline-block";
var edit_span = gel(edit_id);
edit_span.style.display = "";
var nonedit_span = gel(nonedit_id);
nonedit_span.style.display = "none";
edit_span.focus();
}
function gel(id) {
if (typeof id != 'string')
return id;
return document.getElementById(id);
}
function htmlEscape(s) {
return s.replace(/&/g, "&amp;").replace(/'/g, "&#39;").replace(/"/g,
"&quot;").replace(/</g, "&#60;").replace(/>/g, "&#62;");
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spVariableAttachment.js */
angular.module('sn.$sp').directive('spVariableAttachment', function(spModal, getTemplateUrl, snAttachmentHandler, spScUtil, cabrillo, i18n, $http, spAriaUtil, $timeout) {
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl('sp_variable_attachment.xml'),
scope: {
field: '=?',
attachmentGuid : '=?',
gForm: '&'
},
controller: function($scope, $location) {
$scope.isNative = cabrillo.isNative();
$scope.uploading = false;
$scope.uploadAttachment = function() {
if ($scope.field.value && $scope.field.enableDeleteAttachment) {
if (!confirm(i18n.getMessage("Updating the attachment will delete the previous attachment permanently. Do you want to continue?")))
return;
}
cabrillo.attachments.addFile(
'ZZ_YY' + $scope.getRecordTableName(),
$scope.getRecordId(),
null,
null
).then(function(response) {
if (response) {
var file = {
name: response.file_name,
size: response.size_bytes
};
if ($scope.validateAttachment(file)) {
var previousValue = $scope.field.value;
$scope.field.state = response.state;
$scope.field.content_type = response.content_type;
$scope.field.file_name = response.file_name;
$scope.gForm().setValue($scope.field.name, response.sys_id, response.file_name);
if ($scope.field.enableDeleteAttachment)
$scope.updateAttachmentBackendValues(previousValue, response.sys_id, response.file_name);
}
}
}, function() {
$scope.uploading = false;
});
};
$scope.isItemView = function() {
return $scope.getRecordTableName() == 'sc_cart_item' && $location.$$search.edit != 'cart';
};
$scope.updateAttachmentBackendValues = function(previousValue, newValue, newDisplayValue) {
if (previousValue) {
$scope.deleteAttachmentAndUpdateOptions({
name: $scope.field.name,
value: previousValue,
newValue: newValue,
newDisplayValue: newDisplayValue,
isUpdate: true
});
} else if (!$scope.isItemView()) {
var variablesData = {};
variablesData[$scope.field.name] = $scope.gForm().getValue($scope.field.name);
spScUtil.saveVariables($scope.getRecordTableName(), $scope.getRecordId(), variablesData);
}
};
},
link: function(scope, element) {
var attachedMsg = i18n.getMessage('{0} Attached');
scope.onAttachmentSelect = function($files) {
if ($files.length == 0)
return;
var file = {
name : $files[0].name,
size : $files[0].size
};
if (scope.validateAttachment(file)) {
var previousValue = scope.field.value;
scope.uploading = true;
scope.field.isInvalid = true;
snAttachmentHandler.create('ZZ_YY' + scope.getRecordTableName(), scope.getRecordId()).uploadAttachment($files[0]).then(function(response) {
scope.uploading = false;
scope.field.state = response.state;
scope.field.content_type = response.content_type;
scope.field.file_name = response.file_name;
scope.gForm().setValue(scope.field.name, response.sys_id, response.file_name);
if (scope.field.enableDeleteAttachment)
scope.updateAttachmentBackendValues(previousValue, response.sys_id, response.file_name);
$timeout(function() {
spAriaUtil.sendLiveMessage(attachedMsg.withValues([response.file_name]));
}, 1000);
}, function(error) {
scope.uploading = false;
scope.field.isInvalid = false;
});
}
$files[0] = '';
}
scope.openAttachmentSelector = function($event) {
if (scope.uploading)
return;
if (scope.field.value && scope.field.enableDeleteAttachment) {
spModal.confirm(i18n.getMessage("Updating the attachment will delete the previous attachment permanently. Do you want to continue?")).then(function(confirmed) {
if (confirmed) {
$event.stopPropagation();
var input = element.find('input[type=file]');
input.click();
}
});
} else {
$event.stopPropagation();
var input = element.find('input[type=file]');
input.click();
}
}
scope.deleteAttachmentAndUpdateOptions = function(field) {
snAttachmentHandler.deleteAttachment(field.value).then(function() {
if (!field.isUpdate)
scope.gForm().setValue(field.name, field.newValue, field.newDisplayValue);
if (!scope.isItemView()) {
var variablesData = {};
variablesData[field.name] = field.newValue;
spScUtil.saveVariables(scope.getRecordTableName(), scope.getRecordId(), variablesData);
}
scope.setFocus('sp_formfield_' + field.name);
spAriaUtil.sendLiveMessage(i18n.getMessage('Attachment deleted successfully'));
}, function(error) {
console.log('Failed to delete Attachment', error);
});
}
scope.deleteAttachment = function() {
if (scope.field.enableDeleteAttachment) {
if (scope.isNative) {
if (confirm(i18n.getMessage("Delete Attachment?")))
scope.deleteAttachmentAndUpdateOptions({ name: scope.field.name, value: scope.field.value, newValue: '', newDisplayValue: '', isUpdate: false });
} else {
spModal.confirm(i18n.getMessage("Delete Attachment?")).then(function(confirmed) {
if (confirmed)
scope.deleteAttachmentAndUpdateOptions({ name: scope.field.name, value: scope.field.value, newValue: '', newDisplayValue: '', isUpdate: false });
});
}
} else {
scope.gForm().setValue(scope.field.name, '', '');
scope.setFocus('sp_formfield_' + scope.field.name);
spAriaUtil.sendLiveMessage(i18n.getMessage('Attachment deleted successfully'));
}
}
scope.scanAttachment = function() {
if (scope.field.state == 'not_available')
snAttachmentHandler.showMessage('error', i18n.getMessage('Upload file scan failed').withValues([scope.field.displayValue]));
else {
var dot = scope.field.displayValue.lastIndexOf('.') + 1;
var typeFromDisplayValue = scope.field.displayValue.substring(dot).toLowerCase();
var contentType = scope.field.content_type ? scope.field.content_type : typeFromDisplayValue;
var fileName = scope.field.file_name ? scope.field.file_name : scope.field.displayValue;
snAttachmentHandler.scanAttachment({ 'sys_id': scope.field.value, 'content_type': contentType, 'file_name': fileName });
}
}
scope.setFocus = function(id) {
var ele = document.getElementById(id);
if (ele)
ele.focus();
}
scope.setAriaLabel = function(ariaLabel) {
element.find("#sp_formfield_" + scope.field.name).attr("aria-label", ariaLabel);
}
scope.validateAttachment = function(file) {
var allowedExtensionArray = new Array();
if (scope.field.attributes.allowed_extensions)
allowedExtensionArray = scope.field.attributes.allowed_extensions.split(";");
var field = {
name : scope.field.name,
allowedExtensions: allowedExtensionArray,
allowedFileSize: scope.field.attributes.max_file_size
};
var result = validateAttachmentVariable(file, field);
scope.field.validated = true;
if (result == ATTACHMENT_SIZE_ERROR) {
var errMessage = i18n.format(i18n.getMessage("The size of the uploaded file cannot exceed {0} MB"), field.allowedFileSize);
scope.gForm().hideFieldMsg(field.name);
$timeout(function() {
scope.gForm().showFieldMsg(field.name, errMessage, "error");
}, 1000);
return false;
} else if (result == EXTENSION_ERROR) {
var errMessage = i18n.format(i18n.getMessage("The uploaded file type is not permitted; allowed types are {0}"), field.allowedExtensions.join(', '));
scope.gForm().hideFieldMsg(field.name);
$timeout(function() {
scope.gForm().showFieldMsg(field.name, errMessage, "error");
}, 1000);
return false;
}
return true;
}
scope.getRecordId = function() {
return scope.getRecordTableName() == 'sc_cart_item' ? scope.attachmentGuid : scope.field.recordSysId;
}
scope.getRecordTableName = function() {
return scope.field.recordTableName || scope.gForm().recordTableName;
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/directive.spCatalogVariable.js */
angular.module('sn.$sp').directive('spCatalogVariable', function(spSCConf) {
"use strict";
return {
restrict : 'E',
templateUrl : 'sp_catalog_variable.xml',
link: function(scope, element, attrs, ctrl) {
scope.spSCConf = spSCConf;
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/directive.spSCMultiRowElement.js */
angular.module('sn.$sp').directive('spScMultiRowElement', function($http, spModal, spUtil, i18n, $sce, spScUtil, cabrillo, spAriaUtil) {
"use strict";
function getEmbeddedWidgetOptions(action, data) {
var options = {
embeddedWidgetId: "sc-multi-row-active-row",
embeddedWidgetOptions : {
action : action,
source_table : "",
source_id : "",
row_data : {},
variable_set_id : "",
variable_set_name : "",
cat_item : "",
native_mobile: "",
parent: {}
},
backdrop: "static",
keyboard: false,
size: "lg",
modalLabel: data.modalLabel
};
for (var key in options.embeddedWidgetOptions) {
if (typeof data[key] != "undefined") {
options.embeddedWidgetOptions[key] = data[key];
}
}
return options;
}
function loadActiveRowWidget(action, data) {
return $http({
method: 'POST',
url: spUtil.getWidgetURL("widget-modal"),
headers: spUtil.getHeaders(),
data: getEmbeddedWidgetOptions(action, data)
});
}
function isValueEmpty(value) {
return typeof value == "undefined" || value == "";
}
var actions = {
ADD_ROW : "add",
UPDATE_ROW : "edit",
};
var catalogVariableTypes = {
CHECK_BOX : "7"
};
return {
restrict : "E",
templateUrl : "sp_element_sc_multi_row.xml",
controllerAs : "c",
scope : {
'field': "=",
'getGlideForm': '&glideForm',
'native': "=?",
'parentFields': "="
},
controller : function ($scope) {
var field = $scope.field;
var g_form = $scope.getGlideForm();
this.isMEE = cabrillo.isNative() && $scope.native;
var canAdd = true;
var parent = $scope.parentFields;
this.addButtonAriaLabel = i18n.format(i18n.getMessage("Do you want to add a row for {0}"), field.label);
function getActiveOptionsData() {
return {
variable_set_id : field.sys_id,
variable_set_name : field.name,
source_table : field.source_table,
source_id : field.source_id,
cat_item : field.cat_item,
native_mobile : cabrillo.isNative() && $scope.native,
parent: getParentValues(parent),
modalLabel: field.label
};
}
function getParentValues(parent) {
var fieldKeysToBeIncluded = ["value"];
var parentFields = {};
Object.keys(parent).forEach(function(fieldName) {
if (!fieldName)
return;
var fieldMap = {};
fieldKeysToBeIncluded.forEach(function(fieldKey) {
fieldMap[fieldKey] =  (parent[fieldName] && parent[fieldName][fieldKey]) ? parent[fieldName][fieldKey] : '';
})
parentFields[fieldName] = fieldMap;
})
return parentFields
}
$scope.$on("$sp.sc_multi_row.create_row", function(evt, fieldId, itemId) {
if (field.id == fieldId && field.cat_item == itemId)
$scope.c.createRow();
});
g_form.$private.events.on('change', function(fieldName, oldValue, newValue) {
if (fieldName !== field.name) {
return;
}
if (field.skipOnChangeUpdate) {
field.skipOnChangeUpdate = false;
return;
}
field._value = isValueEmpty(newValue) ? [] : JSON.parse(newValue);
if (field._value.length > 0)
refreshMultiRowDisplayValue();
else {
field.displayValue = [];
field._displayValue = "";
}
});
function refreshMultiRowDisplayValue() {
field._loadingData = true;
spScUtil.getDisplayValueForMultiRowSet(field.id, field.value).then(function(response){
if (!response.data)
return;
field.displayValue = response.data.result;
field._displayValue = JSON.parse(response.data.result);
field._loadingData = false;
});
}
function clearAllValue(){
$scope.getGlideForm().setValue(field.name, "", "");
$('#' + field.sys_id + '_add_row').focus().after(function() {
sendLiveMessage(i18n.getMessage("All rows have been deleted"), 500);
});
}
this.clearValue = function () {
var options = {
title: i18n.getMessage("Are you sure you want to delete all rows?"),
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0},
messageOnly: true,
buttons: [ {label: i18n.getMessage('Cancel'), primary: false},
{label: i18n.getMessage("Remove"), class : "btn-danger", primary: true}]
};
if (this.isMEE) {
if (confirm(options.title)) {
clearAllValue();
}
} else {
spModal.open(options).then(function (actionButton) {
if (!actionButton.primary)
return;
clearAllValue();
});
}
}
this.createRow = function (evt) {
var that = this;
var activeRowWidget;
canAdd = false;
loadActiveRowWidget(actions.ADD_ROW, getActiveOptionsData()).then(function (response) {
var activeRowWidget = response.data.result;
var unregisterCancel = $scope.$on("$sp.sc_multi_row_active_row.cancel", function (event, data) {
that.activeRow = "";
$('#' + field.sys_id + '_add_row').focus().after(function() {
sendLiveMessage(i18n.getMessage("New row not added"), 500);
});
});
var unregisterSave = $scope.$on("$sp.sc_multi_row_active_row.add", function (event, data) {
that.activeRow = "";
var newVal = angular.copy(field._value) || [];
var newDisplayVal = angular.copy(field._displayValue) || [];
newVal.push(data.value);
newDisplayVal.push(data.display_value);
field.validated = true;
$scope.getGlideForm().setValue(field.name, JSON.stringify(newVal), JSON.stringify(newDisplayVal));
$('#' + field.sys_id + '_add_row').focus().after(function() {
sendLiveMessage(i18n.getMessage("New row added"), 500);
});
});
activeRowWidget.options.afterClose = function () {
unregisterSave();
unregisterCancel();
}
that.activeRow = activeRowWidget;
canAdd = true;
});
}
this.updateRow = function (index) {
var that = this;
var activeRowWidget;
var options = getActiveOptionsData();
options.row_data = field._value[index];
loadActiveRowWidget(actions.UPDATE_ROW, options).then(function (response) {
var activeRowWidget = response.data.result;
var unregisterCancel = $scope.$on("$sp.sc_multi_row_active_row.cancel", function (event, data) {
that.activeRow = "";
sendLiveMessage(i18n.getMessage("Row not updated"), 0);
});
var unregister = $scope.$on("$sp.sc_multi_row_active_row.update", function (event, data) {
that.activeRow = "";
var newVal = angular.copy(field._value) || [];
var newDisplayVal = angular.copy(field._displayValue) || [];
newVal[index] = data.value;
newDisplayVal[index] = data.display_value;
field._value[index] = angular.copy(data.value);
field._displayValue[index] = angular.copy(data.display_value);
field.validated = true;
$scope.getGlideForm().setValue(field.name, JSON.stringify(newVal), JSON.stringify(newDisplayVal));
sendLiveMessage(i18n.getMessage("Row has been updated"), 0);
});
activeRowWidget.options.afterClose = function () {
unregister();
unregisterCancel();
};
that.activeRow = activeRowWidget;
});
}
function deleteSelectedRow(index) {
var newVal = angular.copy(field._value) || [];
var newDisplayVal = angular.copy(field._displayValue) || [];
newVal.splice(index, 1);
newDisplayVal.splice(index, 1);
field.validated = true;
if (newVal.length !== 0) {
$scope.getGlideForm().setValue(field.name, JSON.stringify(newVal), JSON.stringify(newDisplayVal));
var newFocusIdx = (index === newVal.length)? index - 1: index;
$('#remove-row-' + newFocusIdx).focus().after(function() {
sendLiveMessage(i18n.getMessage("Row has been deleted"), 500);
});
} else {
$scope.getGlideForm().setValue(field.name, "", "");
$('#' + field.sys_id + '_add_row').focus().after(function() {
sendLiveMessage(i18n.getMessage("Row has been deleted"), 500);
});
}
}
this.deleteRow = function (index) {
var options = {
title: i18n.getMessage("Are you sure you want to delete the row?"),
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0},
messageOnly : true,
buttons: [ {label: i18n.getMessage('Cancel'), primary: false},
{label: i18n.getMessage("Remove"), class : "btn-danger", primary: true}]
};
if (this.isMEE) {
if (confirm(options.title)) {
deleteSelectedRow(index);
}
} else {
spModal.open(options).then(function (actionButton) {
if (!actionButton.primary)
return;
deleteSelectedRow(index);
});
}
}
this.canDelete = function () {
return true;
}
this.canInsert = function () {
if (canAdd && (field._value.length < field.max_rows_size))
return true;
return false;
}
this.canClearValue = function () {
return this.canDelete() && field._value && field._value.length > 0;
}
this.getCellDisplayValue = function (displayValue, fieldType) {
if (fieldType == catalogVariableTypes.CHECK_BOX)
return "" + displayValue;
return $sce.trustAsHtml(displayValue);
}
function sendLiveMessage(message, timeout) {
if (!message)
return;
if (!timeout)
timeout = 0;
setTimeout(function() {
spAriaUtil.sendLiveMessage(message);
}, timeout);
}
},
link: function(scope, element, attrs, ctrl) {
var field = scope.field;
if (typeof field.value != "undefined" && Array.isArray(field.value))
field.value = JSON.stringify(field.value);
if (typeof field.displayValue != "undefined" && Array.isArray(field.displayValue))
field.displayValue = JSON.stringify(field.displayValue);
if (typeof field._value == "undefined")
field._value = isValueEmpty(field.value) ? [] : JSON.parse(field.value);
if (typeof field._displayValue == "undefined")
field._displayValue = isValueEmpty(field.displayValue) ? [] : JSON.parse(field.displayValue);
scope.field._loadingData = false;
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/directive.spSCRequestFor.js */
angular.module('sn.$sp').directive('spScRequestFor', function($rootScope, i18n) {
'use strict';
return {
restrict : 'E',
replace: true,
templateUrl:'sp_element_sc_request_for.xml',
scope: {
field: '=',
formModel: '=',
getGlideForm: '&glideForm',
},
controller: function($scope, $timeout) {
$scope.toggleUserSelect = function() {
if (!$scope.sn_sc_also_request_for.value || $scope.sn_sc_also_request_for.value.length == 0) {
$scope.showAlsoRequestFor = !$scope.showAlsoRequestFor;
$scope.showList = !$scope.showList;
}
else {
$scope.showList = !$scope.showList;
$scope.showLess = !$scope.showLess;
}
var alsoRequestForButton = document.getElementById("also_request_for_button");
if ($scope.showAlsoRequestFor) {
$timeout(function () {
if (alsoRequestForButton != null)
$scope.actions.isAlsoRequestForExpanded = true;
var alsoRequestForElement = document.getElementById("s2id_sp_formfield_sn_sc_also_request_for");
if (alsoRequestForElement != null) {
var inputElement = alsoRequestForElement.getElementsByClassName("select2-input");
if (inputElement.length > 0)
inputElement[0].focus();
}
}, 100);
} else {
if (alsoRequestForButton != null)
$scope.actions.isAlsoRequestForExpanded = false;
}
}
},
link: function ($scope) {
function init () {
$scope.sn_sc_also_request_for = {
ed: {
reference: $scope.field.ed.reference,
qualifier: $scope.field.ed.qualifier,
searchField: $scope.field.ed.searchField,
defaultOperator: $scope.field.ed.defaultOperator
},
value:[],
name:'sn_sc_also_request_for',
label:i18n.getMessage('Also request for'),
parent:$scope.field,
attributes: $scope.field.attributes,
placeholder: i18n.getMessage('Request for multiple users'),
_cat_variable:true,
isMandatory: function(){ return false;},
display_value_list: []
};
$scope.actions = {isAlsoRequestForExpanded: false};
}
$scope.alsoRequestForEnabled = function() {
return !$scope.formModel.native_mobile && !$scope.formModel.isCartItem && !$scope.formModel.hideAlsoRequestFor && $scope.field.also_request_for;
}
if ($scope.alsoRequestForEnabled())
init();
if ($scope.alsoRequestForEnabled()) {
$scope.getGlideForm().$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (type == 'FIELD' && fieldName == $scope.field.name && propertyName == 'readonly')
setReadonly(propertyValue);
});
}
function setReadonly(readonly) {
if (readonly) {
$scope.disabled = true;
if ($scope.sn_sc_also_request_for.value.length == 0) {
$scope.showAlsoRequestFor = false;
$scope.showList = false;
$scope.showLess = false;
}
else {
$scope.showLess = true;
$scope.showList = false;
}
return;
}
$scope.disabled = false;
if ($scope.sn_sc_also_request_for.value.length == 0)
return;
$scope.showLess = false;
$scope.showList = true;
}
if ($scope.getGlideForm().isReadOnly($scope.field.name) && $scope.alsoRequestForEnabled())
setReadonly(true);
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/directive.snSCAlsoRequestFor.js */
angular.module('sn.$sp').directive('snScAlsoRequestFor', function($http, spUtil, filterExpressionParser, escapeHtml, i18n, md5, spAriaUtil, select2EventBroker, spAriaFocusManager, spScUtil, spSCConf) {
'use strict';
return {
restrict: 'E',
replace: true,
scope: {
ed: "=?",
field: "=",
refTable: "=?",
refId: "=?",
snOptions: "=?",
requestedFor:"=?",
formatResultCssClass: "&",
displayColumn: "@",
recordValues: '&',
getGlideForm: '&glideForm',
domain: "@",
snSelectWidth: '@'
},
template: '<input type="text" id="sp_formfield_{{::field.name}}" name="{{::field.name}}" style="min-width: 150px;" aria-hidden="true" />',
controller: function($scope, $rootScope) {
$scope.pageSize = NOW.ac_max_search_matches;
this.filterResults = function(data, page) {
return {
results: data.data.items,
more: (page * $scope.pageSize < data.data.total)
};
};
this.handleServerValidation = function(itemId, field) {
if (field.parent) {
field.parent.also_request_for_Invalid = true;
field.parent.isServerValidationDone = false;
if (field.value == "") {
handleSuccess(field);
return;
}
if (field.value) {
spScUtil.validateDelegationForMultipleUsers(itemId, field.value.toString()).then(function() {
handleSuccess(field);
}, function(response) {
handleFailure(response,field);
});
}
}
}
function handleSuccess(field) {
field.parent.isServerValidationDone = true;
field.parent.also_request_for_Invalid = false;
clearValidationMessage(field);
$rootScope.$broadcast("$sp.service_catalog.form_validation_complete");
}
function handleFailure(response, field) {
field.parent.isServerValidationDone = true;
clearValidationMessage(field);
addValidationMessage(field, i18n.format(i18n.getMessage("Item is unavailable for {0}"),response.data.result.invalidUsers.join(', ')), 'error');
field.parent.also_request_for_Invalid = true;
$rootScope.$broadcast("$sp.service_catalog.form_validation_complete");
}
function clearValidationMessage(field) {
if (!Array.isArray(field.validationMessages))
return;
$scope.$evalAsync(field.validationMessages.shift());
}
function addValidationMessage(field, message) {
if (!field.validationMessages)
field.validationMessages = [];
$scope.$evalAsync(field.validationMessages.push({
message: message,
type: 'error'
}));
spAriaUtil.sendLiveMessage(message);
}
},
link: function(scope, element, attrs, ctrl) {
scope.cacheData = {};
scope.ed = scope.ed || scope.field.ed;
scope.selectWidth = scope.snSelectWidth || '100%';
element.css("opacity", 0);
var isOpen = false;
var fireReadyEvent = true;
var g_form;
var displayColumns;
var refAutoCompleter;
var refOrderBy;
var field = scope.field;
var isMultiple = true;
if (angular.isDefined(scope.getGlideForm))
g_form = scope.getGlideForm();
var fieldAttributes = {};
if (field.attributes && typeof scope.ed.attributes == 'undefined')
if (Array.isArray(field.attributes))
fieldAttributes = field.attributes;
else
fieldAttributes = spUtil.parseAttributes(field.attributes);
else
fieldAttributes = spUtil.parseAttributes(scope.ed.attributes);
if (angular.isDefined(fieldAttributes['ref_ac_columns']))
displayColumns = fieldAttributes['ref_ac_columns'];
if (angular.isDefined(fieldAttributes['ref_auto_completer']))
refAutoCompleter = fieldAttributes['ref_auto_completer'];
else
refAutoCompleter = "AJAXReferenceCompleter";
if (angular.isDefined(fieldAttributes['ref_ac_order_by']))
refOrderBy = fieldAttributes['ref_ac_order_by'];
var remove = i18n.getMessage("Remove");
function getRemoveItem(label){ return jQuery("<span class='sr-only' />").text(remove + " " + label); };
var s2Helpers = {
formatSelection: function(item) {
return escapeHtml(getDisplayValue(item));
},
formatSelectionCssClass: function(item, el) {
var parentEl = el.parent();
var anchorEl = parentEl.find("a");
anchorEl.removeAttr("tabindex");
anchorEl.addClass("fa fa-times");
anchorEl.append(getRemoveItem(getDisplayValue(item)));
},
formatResult: function(item) {
var displayValues = getDisplayValues(item);
if (displayValues.length == 1)
return escapeHtml(displayValues[0]);
if (displayValues.length > 1) {
var width = 100 / displayValues.length;
var markup = "";
for (var i = 0; i < displayValues.length; i++)
markup += "<div style='width: " + width + "%;display: inline-block;word-wrap:break-word;vertical-align:top' class='select2-result-cell'>" + escapeHtml(displayValues[i])  + "</div>";
return markup;
}
return "";
},
search: function(queryParams) {
var key = md5(JSON.stringify(queryParams.data));
var cachedResponse = scope.cacheData[key];
if (cachedResponse)
return queryParams.success(cachedResponse);
var url = spUtil.getURL({sysparm_type: 'sp_ref_list_data', sysparm_cancelable:true});
return $http.post(url, queryParams.data).then(function(response){
if (response.data && response.data.items) {
scope.cacheData[key] = response;
queryParams.success(response);
}
});
},
onSelecting: function(e) {
var selectedItem = e.choice;
if ('sys_id' in selectedItem) {
var values = field.value;
var displayValues = field.display_value_list;
values.push(selectedItem.sys_id);
displayValues.push(getDisplayValue(selectedItem));
setValue(values, displayValues);
element.parent().find(".select2-input").removeAttr("aria-activedescendant");
}
},
onRemoving: function(e) {
var removed = e.choice;
var values = field.value;
var displayValues = field.display_value_list;
for(var i = values.length-1; i>=0; i--){
if (removed.sys_id == values[i]) {
values.splice(i, 1);
displayValues.splice(i, 1);
break;
}
}
setValue(values, displayValues);
},
onOpening: function(e) {
select2EventBroker.publishSelect2Opening();
}
};
var config = {
width : scope.selectWidth,
placeholder : field.placeholder,
maximumSelectionSize : spSCConf.MAX_ALSO_REQUEST_FOR,
containerCssClass : 'select2-reference ng-form-element',
formatSearching: '',
allowClear: attrs.allowClear !== 'false',
id: function(item) {
return item.sys_id;
},
sortResults: (scope.snOptions && scope.snOptions.sortResults) ? scope.snOptions.sortResults : undefined,
ajax: {
quietMillis: NOW.ac_wait_time,
data: function(filterText, page) {
var filterExpression = filterExpressionParser.parse(filterText, scope.ed.defaultOperator);
var q = '';
var columnsToSearch = getReferenceColumnsToSearch();
var queryArr = [];
var query;
var notNullRequired = (filterText === "");
columnsToSearch.forEach(function(colToSearch) {
query = "";
if (field.ed.queryString)
query += field.ed.queryString + '^';
query += colToSearch + filterExpression.operator + filterExpression.filterText;
if (notNullRequired && (!g_sort_elements_by_session_language || g_lang === 'en'))
query += '^' + colToSearch + 'ISNOTEMPTY';
query += getExcludedValues();
queryArr.push(query);
});
q += queryArr.join("^NQ");
if (refOrderBy) {
var orderByArr = refOrderBy.split(";");
for (var i = 0; i < orderByArr.length; i++)
q += "^ORDERBY" + orderByArr[i].trim();
}
q += "^EQ";
var params = {
start: (scope.pageSize * (page - 1)),
count: scope.pageSize,
sysparm_target_table: scope.refTable,
sysparm_target_sys_id: scope.refId,
sysparm_target_field: field.parent ? field.parent.name : field.name,
table: scope.ed.reference,
qualifier: scope.ed.qualifier,
data_adapter: scope.ed.data_adapter,
attributes: scope.ed.attributes,
p: scope.ed.reference,
q: q,
r: scope.ed.qualifier
};
if (displayColumns)
params.required_fields = displayColumns.split(";").join(":");
if (scope.domain) {
params.sysparm_domain = scope.domain;
}
if (angular.isDefined(field) && field['_cat_variable'] === true) {
delete params['sysparm_target_table'];
params['sysparm_include_variables'] = true;
params['variable_ids'] = field.parent ? field.parent.sys_id : field.sys_id;
var getFieldSequence = g_form.$private.options('getFieldSequence');
if (getFieldSequence) {
params['variable_sequence1'] = getFieldSequence();
}
var itemSysId = g_form.$private.options('itemSysId');
params['sysparm_id'] = itemSysId;
params['sysparm_query_refs'] = false;
var getFieldParams = g_form.$private.options('getFieldParams');
if (getFieldParams) {
angular.extend(params, getFieldParams());
}
}
if (scope.recordValues)
params.sysparm_record_values = scope.recordValues();
var encodedRecord = g_form.getEncodedRecord && g_form.getEncodedRecord();
if (encodedRecord)
params.sysparm_encoded_record = encodedRecord;
return params;
},
results: function(data, page) {
return ctrl.filterResults(data, page, scope.pageSize);
},
transport: s2Helpers.search
},
formatSelection: s2Helpers.formatSelection,
formatSelectionCssClass: s2Helpers.formatSelectionCssClass,
formatResult: s2Helpers.formatResult,
formatResultCssClass: scope.formatResultCssClass || null,
multiple: isMultiple
};
function getExcludedValues () {
if (scope.requestedFor && scope.requestedFor != '')
return '^sys_idNOT IN' + scope.requestedFor;
return '';
}
function init() {
scope.$evalAsync(function() {
i18n.getMessage('Searching...', function(searchingMsg) {
config.formatSearching = function() {
return searchingMsg;
};
});
i18n.getMessage('No matches found', function(msg) {
config.formatNoMatches = function() {
return msg;
};
});
i18n.getMessage('Loading more results...', function(msg) {
config.formatLoadMore = function(pageNumber) {
return msg;
};
});
element.css("opacity", 1);
element.select2("destroy");
var select2 = element.select2(config);
element.bind("select2-selecting", s2Helpers.onSelecting);
element.bind("select2-removing", s2Helpers.onRemoving);
element.bind("select2-opening", s2Helpers.onOpening);
element.bind("select2-blur", function() {
scope.$evalAsync(function() {
var values = field.value;
var displayValues = field.display_value_list;
setValue(values, displayValues);
});
});
element.bind("select2-open", function(){
if (element.data('select2').search.val() === " ")
element.select2("search", "");
isOpen = true;
element.parent().find(".select2-choices input[role='combobox']").attr("aria-expanded", isOpen);
});
element.bind("select2-close", function(){
isOpen = false;
element.parent().find(".select2-choices input[role='combobox']").attr("aria-expanded", isOpen);
});
if (fireReadyEvent) {
scope.$emit('select2.ready', element);
fireReadyEvent = false;
}
element.parent().find(".select2-input").attr("autocomplete", "sp_formfield_"+field.name);
$(element).on("select2.disabled.toggle",function(element){
spAriaFocusManager.enableFocusOnDisabledSelect2(element);
});
element.parent().find('ul.select2-choices').removeAttr('role');
element.parent().find(".select2-choices input[role='combobox']").attr("aria-expanded", isOpen);
var select2Choice = element.parent().find(".select2-choice");
select2Choice.attr("aria-hidden", "true");
select2Choice.addClass('form-control');
element.parent().find(".select2-focusser").on("keydown", function(e) {
if (e.which === 40 || e.which === 38)
e.stopImmediatePropagation();
});
var el = element.parent().find(".select2-focusser")[0];
if(el) {
var currentBindings = $._data(el, 'events')["keydown"];
if ($.isArray(currentBindings))
currentBindings.unshift(currentBindings.pop());
}
});
};
if (scope.snOptions && scope.snOptions.width) {
config.width = scope.snOptions.width;
}
function setValue(values, displayValues) {
field.value = values;
field.display_value_list = displayValues;
field.parent.also_request_for_value = values.toString();
ctrl.handleServerValidation(g_form.getSysId(), field);
}
function getReferenceColumnsToSearch() {
var colNames = ['name'];
if (fieldAttributes['ref_ac_columns_search'] == 'true' && 'ref_ac_columns' in fieldAttributes && fieldAttributes['ref_ac_columns'] != '') {
colNames = fieldAttributes['ref_ac_columns'].split(';');
if (scope.ed.searchField)
colNames.push(scope.ed.searchField);
}
else if (scope.ed.searchField)
colNames = [scope.ed.searchField];
else if (fieldAttributes['ref_ac_order_by'])
colNames = [fieldAttributes['ref_ac_order_by']];
return colNames.filter(onlyUnique);
}
function getDisplayValue(selectedItem) {
var displayValue = '';
if (selectedItem && (selectedItem.ref_key_value || selectedItem.sys_id)) {
if (scope.displayColumn && typeof selectedItem[scope.displayColumn] != "undefined")
displayValue = selectedItem[scope.displayColumn];
else if (selectedItem.$$displayValue)
displayValue = selectedItem.$$displayValue;
else if (selectedItem.name)
displayValue = selectedItem.name;
else if (selectedItem.title)
displayValue = selectedItem.title;
}
return displayValue;
}
function getDisplayValues(selectedItem) {
var displayValues = [];
if (selectedItem && selectedItem.sys_id) {
displayValues.push(getDisplayValue(selectedItem));
}
if (displayColumns && refAutoCompleter === "AJAXTableCompleter") {
var columns = displayColumns.split(";");
var defaultDisplayColumn = selectedItem && selectedItem.$$displayField;
for (var i = 0; i < columns.length; i++) {
if (defaultDisplayColumn === columns[i])
continue;
var column = columns[i];
displayValues.push(selectedItem[column] ? selectedItem[column] : "");
}
}
return displayValues;
}
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
init();
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/service.spSCFieldPropertyDecorator.js */
angular.module('sn.$sp').factory('spSCFieldPropertyDecorator', function (snAttachmentHandler, spScUtil, spSCConf, glideFormFieldFactory, $rootScope, $http, i18n) {
var PROPERTY_CHANGE_FIELD = 'FIELD';
function isContainerType(field) {
return field.type == spSCConf.CONTAINER_START || field.type == spSCConf.CHECKBOX_CONTAINER;
}
function isCheckboxEmpty(value) {
return value == "false" || value == "";
}
return {
decorate : decorateCatalogFields
}
function decorateCatalogFields(fields, g_form) {
var _fields = fields;
_addValidationScript(fields, g_form);
_fields.forEach(function (field) {
if (!spScUtil.isCatalogVariable(field))
return;
field._visible = field.visible;
field._readonly = field.readonly;
field._mandatory = field.mandatory;
switch (field.type) {
case spSCConf.CONTAINER_START:
_overLoadContainerMandatoryProperty(field, g_form);
_overLoadContainerVisibleProperty(field, g_form);
_overLoadContainerValueProperty(field, g_form);
_overLoadContainerReadonlyProperty(field, g_form);
_overLoadContainerInvalidProperty(field, g_form);
return;
case spSCConf.CHECKBOX_CONTAINER:
_overLoadCheckboxContainerMandatoryProperty(field, g_form);
_overLoadCheckboxContainerVisibleProperty(field, g_form);
_overLoadCheckboxContainerReadonlyProperty(field, g_form);
_overLoadCheckboxContainerValueProperty(field, g_form);
_overLoadCheckboxContainerLabelProperty(field, g_form);
return;
case spSCConf.CHECKBOX:
_overLoadCheckboxMandatoryProperty(field, g_form);
_overLoadCheckboxVisibleProperty(field, g_form);
_overLoadCheckboxReadonlyProperty(field, g_form);
_overLoadCheckboxValueProperty(field, g_form);
return;
case spSCConf.LABEL:
case spSCConf.RICH_TEXT_LABEL:
_overLoadLabelMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
_overLoadLabelValueProperty(field, g_form);
return;
case spSCConf.MASKED:
_overLoadMaskedValueProperty(field, g_form);
_overLoadDefaultMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
return;
case spSCConf.BREAK:
_overLoadFormattersMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
return;
case spSCConf.HTML:
_overLoadHTMLReadOnlyProperty(field, g_form);
_overLoadDefaultMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
return;
case spSCConf.REFERENCE:
_overLoadInvalidProperty(field, g_form);
_overLoadDefaultMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
return;
case spSCConf.SC_ATTACHMENT:
_overLoadAttachmentValueProperty(field, g_form);
_overLoadDefaultMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
return;
case spSCConf.MULTI_ROW_TYPE:
_overLoadMultiRowValueProperty(field, g_form);
_overLoadDefaultMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
_overLoadDefaultReadOnlyProperty(field, g_form);
return;
case spSCConf.FORMATTER:
_overLoadFormattersMandatoryProperty(field, g_form);
_overLoadFormattersVisibleProperty(field, g_form);
return;
case spSCConf.STRING:
_overLoadInvalidProperty(field, g_form);
default:
_overLoadDefaultMandatoryProperty(field, g_form);
_overLoadDefaultVisibleProperty(field, g_form);
_overLoadDefaultReadOnlyProperty(field, g_form);
return;
}
});
function _getField(fieldName) {
for (var i = 0, iM = _fields.length; i < iM; i++) {
var field = _fields[i];
if (field.variable_name === fieldName || field.name === fieldName) {
return field;
}
}
return null;
}
function _isCheckboxGroupMandatorySatisfied(field) {
if (field.type !== spSCConf.CHECKBOX_CONTAINER)
return false;
for (var i=0; i<field._children.length; i++) {
var child = _getField(field._children[i]);
if (!isCheckboxEmpty(child.value))
return true;
}
return false;
}
function canHideOrDisableCheckbox(field) {
var parent = _getField(field._parent);
if (!parent._mandatory || _isCheckboxGroupMandatorySatisfied(parent))
return true;
var visibleEditableCheckboxes = parent._children
.map(_getField)
.filter(function (child) {
return child._visible && !child._readonly;
});
if (visibleEditableCheckboxes.length == 1)
return field !== visibleEditableCheckboxes[0];
return visibleEditableCheckboxes.length > 1;
}
function canHideOrDisable(field) {
if (isContainerType(field))
return canHideOrDisableContainer(field);
if (field.type == spSCConf.CHECKBOX) {
return canHideOrDisableCheckbox(field);
} else if (glideFormFieldFactory.isMandatory(field) && !glideFormFieldFactory.hasValue(field))
return false;
return true;
}
function canHideOrDisableCheckboxContainer(field) {
if (!field._mandatory || _isCheckboxGroupMandatorySatisfied(field))
return true;
return false;
}
function canHideOrDisableContainer(field) {
if (field.type == spSCConf.CHECKBOX_CONTAINER)
return canHideOrDisableCheckboxContainer(field);
for (var i=0; i<field._children.length; i++) {
if (!canHideOrDisable(_getField(field._children[i])))
return false;
}
return true;
}
function isServerValidationRequired(field) {
if (!field)
return false;
if(field.type == "string" && field.validate_regex)
return true;
else if(field.type == spSCConf.REFERENCE && field.is_requested_for && field.validate_on_change)
return true;
return false;
}
function handleServerValidation(field, sysId, value, validationFunc, errorMessage) {
field.isServerInvalid = false;
if (value) {
field.isServerInvalid = true;
field.isServerValidationDone = false;
validationFunc(sysId, value).then(function() {
handleSuccess(field);
}, function() {
handleFailure(field, errorMessage);
});
}
}
function handleSuccess(field) {
field.isServerValidationDone = true;
field.isServerInvalid = false;
$rootScope.$broadcast("$sp.service_catalog.form_validation_complete");
}
function handleFailure(field, errorMessage) {
field.isServerValidationDone = true;
field.isServerInvalid = true;
$rootScope.$broadcast("$sp.service_catalog.form_validation_complete");
if (g_form.hideFieldMsg)
g_form.hideFieldMsg(field.name);
if (g_form.showFieldMsg)
g_form.showFieldMsg(field.name, errorMessage, 'error');
}
function onChangeVariableValidation(fieldName, oldValue, newValue) {
if(fieldName.startsWith("IO:"))
return;
var field = g_form.getField(fieldName);
if (!isServerValidationRequired(field))
return;
if(field.validate_regex)
handleServerValidation(field, field.sys_id, newValue, spScUtil.validateRegex, field.validation_message);
else if(field.is_requested_for)
handleServerValidation(field, g_form.getSysId(), newValue, spScUtil.validateRequestedForAccess, i18n.getMessage("Item is unavailable for this user"));
}
function _addValidationScript (fields, g_form) {
g_form.$private.events.on('change', onChangeVariableValidation);
}
function _overLoadDefaultMandatoryProperty(field, g_form) {
Object.defineProperty(field, 'mandatory', {
set : function (isMandatory) {
if (field.sys_readonly)
return;
this._mandatory = isMandatory;
if (typeof this._parent != "undefined" && this._parent) {
walkToRootAndSetVisibility(g_form, _getField(this._parent), true);
}
},
get : function () {
return this._mandatory;
},
configurable: true
});
}
function _overLoadDefaultVisibleProperty(field, g_form) {
Object.defineProperty(field, 'visible', {
set : function (isVisible ) {
this._visible = isVisible;
if (typeof this._parent != 'undefined' && this._parent) {
walkToRootAndSetVisibility(g_form, _getField(this._parent), isVisible);
}
return;
},
get : function () {
return field._visible;
},
configurable: true
});
}
function walkToRootAndSetVisibility(g_form, field, isVisible) {
if (!isContainerType(field))
return;
if (!isVisible) {
for (var i = 0; i < field._children.length; i++) {
if (g_form.isVisible(field._children[i]))
return false;
}
field.visible = isVisible;
if (typeof field._parent == "string" && _getField(field._parent))
walkToRootAndSetVisibility(g_form, _getField(field._parent), isVisible)
field._cascade_hidden = true;
return;
} else {
if ((field._cascade_hidden || !canHideOrDisableContainer(field))) {
field._cascade_hidden = false;
field.visible = isVisible;
if (typeof field._parent == "string" && _getField(field._parent))
walkToRootAndSetVisibility(g_form, _getField(field._parent), isVisible)
}
}
}
function _overLoadContainerValueProperty(field, g_form) {
Object.defineProperty(field, "value", {
get : function () {
for (var i=0; i < this._children.length; i++) {
var child = _getField(this._children[i]);
if (glideFormFieldFactory.hasValue(child))
return "true";
}
return this.mandatory? "true" : "";
},
set : function (value) {
return;
},
configurable: true
});
}
function _overLoadContainerMandatoryProperty(field, g_form) {
Object.defineProperty(field, 'mandatory', {
set : function (isMandatory ) {
this._mandatory = isMandatory;
var canHideContainer = true;
for (var i=0; i<this._children.length; i++) {
var child = _getField(this._children[i]);
g_form.setMandatory(child.name, isMandatory);
canHideContainer = canHideContainer && canHideOrDisable(child);
}
if (isMandatory) {
if (!this._visible && canHideContainer) {
return;
}
if (typeof this._parent != 'undefined' && this._parent)
walkToRootAndSetVisibility(g_form, _getField(this._parent), true);
}
},
get : function () {
for (var i = 0; i < this._children.length; i++) {
var child = _getField(this._children[i]);
if (g_form.isMandatory(child.name))
return true;
}
return this._mandatory;
},
configurable: true
});
}
function _overLoadContainerVisibleProperty(field, g_form) {
Object.defineProperty(field, 'visible', {
set : function (isVisible ) {
if (isVisible) {
if (!this._visible && this._cascade_hidden) {
return;
}
} else {
if (!canHideOrDisableContainer(this)) {
return;
}
}
this._visible = isVisible;
this._cascade_hidden = false;
if (typeof this._parent != 'undefined' && this._parent)
walkToRootAndSetVisibility(g_form, _getField(this._parent), isVisible);
},
get : function () {
return field._visible;
},
configurable: true
});
}
function _overLoadContainerReadonlyProperty(field, g_form) {
Object.defineProperty(field, 'readonly', {
set : function (isReadonly ) {
for (var i=0; i < this._children.length; i++) {
var child = _getField(this._children[i]);
if (isContainerType(child) || !isReadonly || (isReadonly && canHideOrDisable(child))) {
if (child.sys_readonly)
continue;
child.readonly = isReadonly;
}
}
this._readonly = isReadonly;
},
get : function () {
return this._readonly;
},
configurable: true
});
}
function _overLoadContainerInvalidProperty(field, g_form) {
Object.defineProperty(field, 'isInvalid', {
set : function (isReadonly ) {
return;
},
get : function () {
return false;
},
configurable: true
});
}
function _overLoadCheckboxContainerMandatoryProperty(field, g_form) {
if (field.render_label) {
for (var i=0; i < field._children.length; i++) {
if (_getField(field._children[i]).mandatory) {
field._mandatory = true;
break;
}
}
} else {
var childCheckbox = _getField(field._children[0]);
if (childCheckbox.mandatory)
field._mandatory = true;
}
Object.defineProperty(field, 'mandatory', {
set : function (isMandatory ) {
var forceOpenChildren = isMandatory && !_isCheckboxGroupMandatorySatisfied(this);
for (var i=0; i < field._children.length; i++) {
var child = _getField(field._children[i]);
if (forceOpenChildren) {
child._visible = true;
child.readonly = false;
}
g_form.setMandatory(field._children[i], isMandatory);
}
this._mandatory = isMandatory;
},
get : function () {
return this._mandatory;
},
configurable: true
});
}
function _overLoadCheckboxContainerVisibleProperty(field, g_form) {
Object.defineProperty(field, "visible", {
set : function (isVisible ) {
if (isVisible) {
if (!this._visible && this._cascade_hidden){
return;
}
} else {
if (!canHideOrDisableCheckboxContainer(this))
return;
}
this._visible = isVisible;
this._cascade_hidden = false;
if (typeof this._parent != "undefined" && this._parent) {
walkToRootAndSetVisibility(g_form, _getField(this._parent), isVisible);
}
},
get : function () {
return field._visible;
},
configurable: true
});
}
function _overLoadCheckboxContainerReadonlyProperty(field, g_form) {
Object.defineProperty(field, "readonly", {
set : function (isReadonly ) {
if (isReadonly && !canHideOrDisableCheckboxContainer(this)) {
return;
}
for (var i=0; i < field._children.length; i++) {
g_form.setReadonly(field._children[i], isReadonly);
}
this._readonly = isReadonly;
this._cascade_readonly = true;
},
get : function () {
return this._readonly;
},
configurable: true
});
}
function _overLoadCheckboxContainerValueProperty(field, g_form) {
Object.defineProperty(field, "value", {
get : function () {
if (this._mandatory && _isCheckboxGroupMandatorySatisfied(this))
return "true";
return this._mandatory ? "" : "false";
},
set : function (value) {
return;
},
configurable: true
});
Object.defineProperty(field, "stagedValue", {
get : function () {
if (this._mandatory && _isCheckboxGroupMandatorySatisfied(this))
return "true";
return this._mandatory ? "" : "false";
},
set : function (value) {
return;
},
configurable: true
});
}
function _overLoadCheckboxContainerLabelProperty(field, g_form) {
if (field.render_label)
return;
Object.defineProperty(field, 'label', {
get : function () {
var childCheckbox = _getField(this._children[0]);
return childCheckbox.label;
},
configurable: true
});
}
function _overLoadCheckboxMandatoryProperty(field, g_form) {
Object.defineProperty(field, "mandatory", {
set : function (isMandatory) {
var checkboxContainer = _getField(this._parent);
if (isMandatory && isCheckboxEmpty(this.value)) {
this._mandatory = isMandatory;
checkboxContainer._mandatory = isMandatory;
var groupSatisfied = _isCheckboxGroupMandatorySatisfied(checkboxContainer);
if (!checkboxContainer._visible && groupSatisfied) {
return;
}
if (!groupSatisfied) {
if (!this._visible)
this._visible = true;
if (this._readonly)
this._readonly = false;
}
checkboxContainer._visible = true;
checkboxContainer._readonly = false;
if (typeof checkboxContainer._parent != "undefined" && checkboxContainer._parent)
walkToRootAndSetVisibility(g_form, _getField(checkboxContainer._parent), true);
}
this._mandatory = isMandatory;
if (isMandatory) {
checkboxContainer._mandatory = true;
return;
}
for (var i=0; i < checkboxContainer._children.length; i++) {
if (_getField(checkboxContainer._children[i])._mandatory) {
checkboxContainer._mandatory = true;
return;
}
}
checkboxContainer._mandatory = isMandatory;
checkboxContainer.isInvalid = false;
},
get : function () {
return this._mandatory;
},
configurable: true
});
}
function _overLoadCheckboxVisibleProperty(field, g_form) {
Object.defineProperty(field, "visible", {
set : function (isVisible ) {
if (!isVisible && !canHideOrDisableCheckbox(this)) {
return;
}
this._visible = isVisible;
if (typeof this._parent != "undefined" && this._parent) {
var parent = _getField(this._parent);
if (isVisible && !parent.visible && !parent._cascade_hidden)
return;
if (!isVisible) {
if (parent._mandatory && !_isCheckboxGroupMandatorySatisfied(parent)) {
var visibleCheckboxes = parent._children
.map(_getField)
.filter(function (child) {
return child._visible;
});
if (visibleCheckboxes.length > 0)
return;
}
return walkToRootAndSetVisibility(g_form, parent, false);
}
parent._visible = isVisible;
parent._cascade_hidden = !isVisible;
if (typeof parent._parent != "undefined" && parent._parent)
walkToRootAndSetVisibility(g_form, _getField(parent._parent), isVisible);
}
},
get : function () {
return field._visible;
},
configurable: true
});
}
function _overLoadCheckboxReadonlyProperty(field, g_form) {
Object.defineProperty(field, "readonly", {
set : function (isReadonly ) {
if (isReadonly && !canHideOrDisableCheckbox(this))
return false;
this._readonly = isReadonly;
if (_getField(this._parent)._cascade_readonly) {
_getField(this._parent)._cascade_readonly = false;
_getField(this._parent)._readonly = false;
}
},
get : function () {
return this._readonly;
},
configurable: true
});
}
function _overLoadCheckboxValueProperty(field, g_form) {
Object.defineProperty(field, "value", {
set : function (value ) {
this._value = value;
var parent = _getField(field._parent);
if (typeof parent.isInvalid != 'undefined' && parent._mandatory) {
if (_isCheckboxGroupMandatorySatisfied(parent))
parent.isInvalid = false;
else
parent.isInvalid = true;
}
},
get : function () {
if (typeof this._value == 'undefined') {
this._value = this.stagedValue;
}
return this._value || 'false';
},
configurable: true
});
}
function _overLoadLabelMandatoryProperty(field, g_form) {
Object.defineProperty(field, 'mandatory', {
set : function (isMandatory) {
console.log("setMandatory not applicable for 'Label' variable type");
return;
},
configurable: true
});
}
function _overLoadLabelValueProperty(field, g_form) {
Object.defineProperty(field, 'value', {
get : function () {return '';},
set : function () {},
configurable: true
});
}
function _overLoadMaskedValueProperty(field, g_form) {
field._value = field.value;
Object.defineProperty(field, 'value', {
set : function (value) {
field._value = value;
if(field._setFromModel)
field._setFromModel = false;
else {
field.confirmPassword = value;
field.isInvalid = false;
}
},
get : function () {
return field._value;
},
configurable: true
});
}
function _overLoadAttachmentValueProperty(field, g_form) {
field._value = field.value;
Object.defineProperty(field, 'value', {
set: function (value) {
if (value == '') {
field._value = field.displayValue = field.originalValue = '';
field.isInvalid = false;
return;
}
field.isInvalid = true;
if (!field.validated) {
$http.get('/api/now/attachment/' + value).then(function(response) {
var allowedExtensionArray = new Array();
if (field.attributes.allowed_extensions)
allowedExtensionArray = field.attributes.allowed_extensions.split(";");
var file = {
name : response.data.result.file_name,
size : response.data.result.size_bytes
};
var _field = {
name : field.name,
allowedExtensions : allowedExtensionArray,
allowedFileSize : field.attributes.max_file_size
};
var result = validateAttachmentVariable(file, _field);
field._value = '';
if (result == ATTACHMENT_SIZE_ERROR) {
g_form.hideFieldMsg(_field.name);
g_form.showFieldMsg(_field.name, i18n.format(i18n.getMessage("The size of the uploaded file cannot exceed {0} MB"), _field.allowedFileSize), "error");
} else if (result == EXTENSION_ERROR) {
g_form.hideFieldMsg(_field.name);
g_form.showFieldMsg(_field.name,  i18n.format(i18n.getMessage("The uploaded file type is not permitted; allowed types are {0}"), _field.allowedExtensions.join(', ')), "error");
} else {
field._value = field.originalValue = value;
field.displayValue = field.displayValue ? response.data.result.file_name : field.displayValue;
}
}, function(error) {
g_form.showFieldMsg(field.name, i18n.getMessage('Invalid value'), "error");
field._value = field.displayValue = field.originalValue = '';
return;
});
}
else {
field._value = field.originalValue = value;
field.validated = false;
}
field.isInvalid = false;
},
get : function () {
return field._value;
},
configurable: true
})
}
function _overLoadMultiRowValueProperty(field, g_form) {
field._value = (field.value && typeof field.value === 'string') ? JSON.parse(field.value) : field.value;
Object.defineProperty(field, 'value', {
set: function (value) {
if (value == '') {
field._value = field._displayValue = [];
return;
}
field.isInvalid = true;
if (!field.validated) {
var data = [];
if (Array.isArray(value)) {
try {
data = JSON.stringify(value);
} catch (e) {
_logWarn('JSON parse error', 'Invalid value for table variable');
return;
}
} else if (typeof value != 'string') {
_logWarn('Invalid Input', 'Invalid value for table variable');
return;
}
var uniqueColumnData = {};
var fieldsMeta = field.columns_meta;
for (var index in fieldsMeta) {
if (fieldsMeta[index].unique)
uniqueColumnData[fieldsMeta[index].name] = fieldsMeta[index].label;
}
var parsedValue = JSON.parse(value);
if (!hasDuplicateColumnData(uniqueColumnData, parsedValue) && !isMaxRowExceeded(field.max_rows, parsedValue, field.label)) {
field._value = parsedValue;
_setMultiRowDisplayValue(field, value);
} else {
var parsedValue = [];
var fieldValue = field._value;
if (fieldValue) {
var isfieldValueAString = (typeof fieldValue === 'string');
field._value = isfieldValueAString ? JSON.parse(fieldValue) : fieldValue;
var displayFieldValue = (isfieldValueAString ? fieldValue : JSON.stringify(fieldValue));
_setMultiRowDisplayValue(field, displayFieldValue);
} else
field._value = field._displayValue = parsedValue;
field.skipOnChangeUpdate = true;
}
}
else {
field._value = JSON.parse(value);
field.skipOnChangeUpdate = false;
field.validated = false;
}
field.isInvalid = false;
},
get : function () {
if (field._value && (field._value.length > 0))
return (typeof field._value === 'string') ? field._value: JSON.stringify(field._value);
else
return '';
},
configurable: true
})
}
function hasDuplicateColumnData(uniqueColumnNames, value) {
if (uniqueColumnNames && value) {
var duplicateUniqueFields = getDuplicateFields(uniqueColumnNames, value);
if (duplicateUniqueFields.length > 0) {
_logWarn('Duplicate Data', 'Some fields are not unique: ' + duplicateUniqueFields.join(', '));
return true;
}
}
return false;
}
function isMaxRowExceeded(rowLimit, value, varName) {
if (value && value.length > rowLimit) {
_logWarn('Maximum Row Limit Exceeded', 'The number of rows specified in the multi-row variable set ' + varName +' exceeds the maximum limit of: '+ rowLimit);
return true;
}
return false;
}
function _setMultiRowDisplayValue(field, fieldValue) {
spScUtil.getDisplayValueForMultiRowSet(field.id, fieldValue).then(function(response) {
if (!response && !response.data)
return;
field._displayValue = JSON.parse(response.data.result);
});
}
function _logWarn(code, msg) {
if (console && console.warn) {
console.warn('(g_form) [' + code + '] ' + msg);
}
}
function _overLoadInvalidProperty(field, g_form) {
Object.defineProperty(field, 'isInvalid', {
set: function (isInvalid) {
field._isInvalid = isInvalid;
},
get: function() {
if(isServerValidationRequired(field))
return field._isInvalid || field.isServerInvalid || field.also_request_for_Invalid;
return field._isInvalid;
},
configurable: true
});
}
function _overLoadFormattersMandatoryProperty(field, g_form) {
Object.defineProperty(field, 'mandatory', {
set: function () {},
get: function () {
return false;
}
});
}
function _overLoadFormattersVisibleProperty(field, g_form) {
Object.defineProperty(field, 'visible', {
set: function () {},
get: function () {return false;}
});
}
function _overLoadHTMLReadOnlyProperty(field, g_form) {
Object.defineProperty(field, 'readonly', {
set : function (isReadOnly ) {
field._readonly = isReadOnly;
g_form.$private.events.propertyChange(
PROPERTY_CHANGE_FIELD,
field.name,
'readonly',
isReadOnly
);
},
get : function () {
return this._readonly;
},
configurable: true
});
}
function _overLoadDefaultReadOnlyProperty(field, g_form) {
Object.defineProperty(field, 'readonly', {
set : function (isReadOnly) {
field._readonly = isReadOnly;
setPlaceholder(isReadOnly, field);
},
get : function () {
return this._readonly;
},
configurable: true
})
}
function setPlaceholder(isReadOnly, field) {
if (isReadOnly && field.placeholder) {
field._placeholder = field.placeholder;
field.placeholder = '';
} else if (!isReadOnly && field._placeholder) {
field.placeholder = field._placeholder;
field._placeholder = '';
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service_catalog/service.spSCNavStateManager.js */
angular.module('sn.$sp').factory('spSCNavStateManager', function($rootScope, $window, spModal, i18n, cabrillo) {
'use strict';
var registeredForms = {};
var isModalOpen = false;
var nativeMobile;
var previewMode = false;
function registerForm (form) {
registeredForms[form.getSysId()] = form;
}
function isNative (native) {
nativeMobile = native;
}
function isPreview (preview) {
previewMode = preview;
}
function unregisterForms (sysIds) {
sysIds.forEach(function (sysId) {
delete registeredForms[sysId];
});
}
function clearUserModifiedFields() {
var includedForms = Object.keys(registeredForms);
includedForms.forEach(function(includedForm) {
if (registeredForms[includedForm].isUserModified())
registeredForms[includedForm].$private.userState.clearModifiedFields();
});
}
function checkForDirtyForms() {
if (!g_dirty_form_warning_enabled || previewMode)
return false;
var isFormDirty = false;
var includedForms = Object.keys(registeredForms);
for (var i in includedForms) {
if (registeredForms[includedForms[i]].isUserModified()) {
isFormDirty = true;
break;
}
}
return isFormDirty;
}
function clearCabrilloButtons() {
if (cabrillo.isNative() && nativeMobile) {
cabrillo.viewLayout.setTitle('');
cabrillo.viewLayout.setNavigationBarButtons();
cabrillo.viewLayout.setBottomButtons();
}
}
$rootScope.$on('$locationChangeStart', function(event, next) {
if (!isModalOpen) {
if (checkForDirtyForms()) {
event.preventDefault();
var options = {
title:i18n.getMessage("Leave page?"),
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0},
message: i18n.getMessage("Changes you made will be lost."),
buttons: [
{label: i18n.getMessage("Cancel"), value: "cancel"},
{label: i18n.getMessage("Leave"), primary: true, value: "leave"}
]
};
if (cabrillo.isNative() && nativeMobile) {
var title = i18n.format("{0} {1}", options.title, options.message);
if (confirm(title)) {
clearCabrilloButtons();
clearUserModifiedFields();
$window.location = next;
}
} else {
isModalOpen = true;
spModal.open(options).then(function(confirm) {
isModalOpen = false;
if(confirm.value == "leave") {
clearUserModifiedFields();
$window.location = next;
}
}, function() {
isModalOpen = false;
});
}
}
else {
clearCabrilloButtons();
}
} else {
event.preventDefault();
}
});
$rootScope.$on('$locationChangeSuccess', function(){
if (!g_persist_msgs_through_page_nav)
$rootScope.$broadcast('$$uiNotification.dismiss');
});
$window.onbeforeunload = function() {
if (checkForDirtyForms())
return true;
}
$window.onpagehide = function() {
clearCabrilloButtons();
}
return {
register: registerForm,
unregisterForms: unregisterForms,
isNative: isNative,
isPreview: isPreview
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spCheckboxGroup.js */
angular.module('sn.$sp').directive('spCheckboxGroup', function($sce, $timeout, spLabelHelper, spAriaUtil, i18n){
'use strict';
return {
restrict : 'E',
templateUrl: 'sp_checkbox_group.xml',
scope: {
getGlideForm: '&glideForm',
containers : "=containers",
formModel : "=formModel",
name : "="
},
controllerAs : "c",
link: function($scope, element, attrs, ngModelCtrl) {
$timeout(function() {
$scope.labelElement = element.find('legend');
});
$scope.syncFieldAriaLabel = spLabelHelper.syncFieldAriaLabel;
$scope.getFieldAriaLabel = spLabelHelper.getFieldAriaLabel;
$scope.accessible = spAriaUtil.isAccessibilityEnabled();
},
controller : function ($scope) {
var c = this;
var field;
$scope.field = $scope.formModel._fields[$scope.name];
field = $scope.field;
$scope.getVarID = function(v) {
if (typeof v.name != "undefined" && hasVariablePrefix(v.name))
return v.name.substring(3);
return v.name;
};
$scope.getGlideForm().$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if ($scope.field._children.indexOf(fieldName) == -1)
return;
if (propertyName === 'readonly')
$scope.syncFieldAriaLabel($scope);
});
$scope.trustedHTML = function(html) {
return $sce.trustAsHtml(html);
};
function hasVariablePrefix(v) {
return v.indexOf("IO:") == 0;
}
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/controller.spLogin.js */
angular.module("sn.$sp").controller("spLogin", function($scope, $http, $window, $attrs, spUtil, spConf, $location, i18n) {
$scope.mfa = $attrs.mfa == "true";
$scope.login = function(username, password) {
var url = spUtil.getURL({sysparm_type: 'view_form.login'});
var pageId = $location.search().id || $scope.page.id;
var isLoginPage = $scope.portal.login_page_dv == pageId;
return $http({
method: 'post',
url: url,
data: $.param({
sysparm_type: 'login',
'ni.nolog.user_password': true,
remember_me: typeof $scope.remember_me != 'undefined' && !!$scope.remember_me ? true : false,
user_name: username,
user_password: password,
get_redirect_url: true,
sysparm_goto_url: isLoginPage ? null : $location.url(),
mfa_redirect_url: $location.url()
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(function(response) {
if (!response.data) {
$scope.message = i18n.getMessage("There was an error processing your request");
return;
}
if (response.data.status == 'mfa_code_required')
$window.location = '/validate_multifactor_auth_code.do';
else if (response.data.status == 'success') {
if ($scope.mfa) {
spUtil.get({
widget: {
sys_id: "6506d341cb33020000f8d856634c9cdc"
}
}, {
action: "multi_factor_auth_setup",
directTo: response.data.redirect_url
}).then(function() {
$window.location = response.data.redirect_url;
});
} else {
$scope.success = response.data.message;
$window.location = response.data.redirect_url;
}
} else {
$scope.message = response.data.message;
}
}, function errorCallback(response) {
$scope.message = i18n.getMessage("There was an error processing your request");
});
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spMessageDialog.js */
angular.module("sn.$sp").directive('spMessageDialog', function (nowServer, i18n, $timeout) {
return {
restrict: 'E',
scope: {
name: '@',
title: '@',
message: '@',
question: '@',
ok: '@',
cancel: '@',
dialogClass: '@',
checkboxMessage: '@',
checkboxCallback: '&',
checkboxState: '='
},
replace: true,
templateUrl: 'sp_dialog.xml',
link: function(scope, element) {
element.remove();
element.appendTo($('body'));
if (scope.checkboxMessage) {
scope.checkboxModel = { value: scope.checkboxState };
scope.update = function() {
scope.checkboxState = scope.checkboxModel.value;
$timeout(function() {
scope.checkboxCallback()(scope.checkboxState);
})
}
}
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/controller.spPage.js */
angular.module("sn.$sp").controller("spPageCtrl", function($scope, $http, $location, $window, spAriaUtil, spUtil, spMetatagService, spAnnouncement,
snRecordWatcher, $rootScope, spPage, spAriaFocusManager, $timeout, spAtf, spGtd, spContextManager, tinymceService, snAnalyticsUtil, snAnalytics) {
'use strict';
var _ = $window._;
var c = this;
var hasDynamicHeaderFooter = true;
c.doAnimate = false;
c.firstPage = true;
c.loadingIndicator = false;
$scope.theme = {};
$scope.page = {
title: "Loading..."
};
$scope.sessions = {};
$scope.$on('sp_loading_indicator', function(e, value) {
c.loadingIndicator = value;
});
if ($window.NOW.sp_show_console_error) {
spPage.showBrowserErrors();
}
tinymceService.loadTinymceAsync();
c.parseJSON = function(str) {
return JSON.parse(str);
};
c.isObjectEmpty = function(obj) {
if (obj && typeof (obj) === 'object')
return Object.keys(obj).length === 0;
}
c.getContainerClasses = function(container) {
var classes = [];
if (!container.bootstrap_alt) {
classes[classes.length] = container.width;
}
if (container.container_class_name) {
classes[classes.length] = container.container_class_name;
}
return classes;
};
var oid = $location.search().id;
var oldPath = $location.path();
var locationChanged = false;
function isNavigateOutPortal(newUrl, oldUrl) {
var newUrlParser = document.createElement('a'),
oldUrlParser = document.createElement('a');
newUrlParser.href = newUrl;
oldUrlParser.href = oldUrl;
if (newUrlParser.hostname !== oldUrlParser.hostname)
return true;
if (newUrlParser.pathname === oldUrlParser.pathname)
return false;
return true;
}
$rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
if (newUrl !== oldUrl && isNavigateOutPortal(newUrl, oldUrl)) {
event.preventDefault();
$window.location = newUrl;
}
});
$rootScope.$on('$locationChangeSuccess', function(e, newUrl, oldUrl) {
locationChanged = (oldUrl != newUrl);
var s = $location.search();
var p = $location.path();
if (oldPath != p) {
$window.location.href = $location.absUrl();
return;
}
if (angular.isDefined($scope.containers) && oid == s.id && s.spa) {
return;
}
if (spPage.isHashChange(newUrl, oldUrl)) {
return;
}
if (!g_persist_msgs_through_page_nav)
$scope.$broadcast('$$uiNotification.dismiss');
if (newUrl = spPage.containsSystemPage(p)) {
$window.location.href = newUrl;
return;
}
if (!$window.NOW.has_access && locationChanged) {
$window.location.href = $location.absUrl();
return;
}
oid = s.id;
getPage();
});
$rootScope.$on('sp.page.loaded', function() {
if(spUtil.isMobile())
spUtil.setMobileBanner($scope);
});
function loadPage(r) {
var response = r.data.result;
spMetatagService.setTags(response.metatags);
spMetatagService.setSeoTags(response.seotags);
c.firstPage = false;
$scope.containers = _.filter(response.containers, {
'subheader': false
});
$scope.subheaders = _.filter(response.containers, {
'subheader': true
});
var p = response.page;
var u = response.user;
if (!spPage.isPublicOrUserLoggedIn(p, u)) {
if (locationChanged) {
$window.location.href = $location.absUrl();
return;
}
}
$rootScope.page = $scope.page = p;
$(spPage.getElement(p)).remove();
$(spPage.getStyle(p)).appendTo('head');
response.portal = $rootScope.portal;
$window.document.title = spPage.getTitle(response);
$scope.$broadcast('$sp.scroll', {position: 0});
if (response.theme) {
var theme = response.theme;
$rootScope.theme = $scope.theme = theme;
var isHeaderDynamic = theme.header && (theme.header['static'] === false);
var isFooterDynamic = theme.footer && (theme.footer['static'] === false);
hasDynamicHeaderFooter = !!(isHeaderDynamic || isFooterDynamic);
}
c.style = spPage.getClasses($scope);
if (!$scope.user) {
$rootScope.user = $scope.user = {};
}
$scope.g_accessibility = spAriaUtil.g_accessibility;
angular.extend($scope.user, response.user);
$scope.user.logged_in = spPage.userLoggedIn($scope.user);
$scope.$broadcast('$$uiNotification', response.$$uiNotification);
if ($scope.user.logged_in && !p.omit_watcher)
snRecordWatcher.init();
$timeout(function() {
c.doAnimate = true;
}, 500);
if (spUtil.isMobile()) {
NOW.sp.enableTours = false;
}
if (NOW && NOW.sp && NOW.sp.enableTours && $scope.user.logged_in) {
spGtd.getToursForPage({portal: $rootScope.portal, page: $rootScope.page, user: $rootScope.user})
.then(function(data) {
$rootScope.$broadcast('sp-menu-update-tours', data);
$scope.$on('sp-header-loaded', function() {
$rootScope.$broadcast('sp-menu-update-tours', data);
});
});
}
spContextManager.init();
var recordInfo = {};
var queryParams = $location.search();
Object.keys(queryParams).forEach(function (key) {
if (key === 'table' || key === 'sys_id')
recordInfo[key] = queryParams[key];
});
if (recordInfo.table || recordInfo.sys_id)
spContextManager.updateContextForKey('record', recordInfo);
sendAnalytics(response.page);
return r;
}
function sendAnalytics(page) {
snAnalytics.startPage(page.id, page.static_title);
}
$rootScope.$on('sn.ucm.finished', function() {
sendAnalytics($scope.page);
if (NOW.ucm_invocations === 1) {
var payload= {};
payload.name = "Successful Login";
payload.data = {};
payload.data["Login"] = "true";
snAnalytics.addEvent(payload);
}
});
function setupAtf() {
spAtf.init().then(function(atf) {
atf.triggerPageLoaded();
});
}
function signalPageLoaded() {
$rootScope.$emit('sp.page.loaded', $rootScope);
displayAnalyticsConsentModal();
}
function displayAnalyticsConsentModal() {
if ($rootScope.portal && $rootScope.portal.sys_id === 'db57a91047001200ba13a5554ee49050')
return;
snAnalyticsUtil.invokeUCMEngine();
}
function getSPPageResponse() {
if (NOW.spPageResponse) {
return NOW.spPageResponse.then(function(response) {
return {
data: response
}
});
} else {
return $http({
method: 'GET',
url: spPage.getUrl($scope.portal_id, !hasDynamicHeaderFooter),
headers: spUtil.getHeaders()
})
}
}
function getPage() {
return getSPPageResponse()
.then(loadPage, handlePageLoadErrors)
.then(function(res) {
spAnnouncement.init(res.data.result.announcements).then(function() {
spAriaFocusManager.pageLoadComplete($location.url());
setupAtf();
});
})
.then(signalPageLoaded)
.then(function() {
NOW.spPageResponse = null;
});
}
function handlePageLoadErrors(error) {
var absUrl = $location.absUrl();
var url = $location.url();
var path = $location.path();
if ('Unauthorized' == error.statusText || '401' == error.status) {
absUrl = absUrl.replace(url, path + '?sysparm_goto_url='+$rootScope.portal.url_suffix);
$window.location.href = absUrl;
}
console.error(error);
return Promise.reject(error);
}
$scope.$on('sp.page.reload', getPage);
$($window).keydown(spPage.saveOnCtrlS);
$scope.$on('$destroy', function() {
$($window).off('keydown', spPage.saveOnCtrlS);
});
c.focusOnPageTitle = function(focusFirstTabbableEl, $event) {
spAriaFocusManager.focusOnPageTitle(focusFirstTabbableEl, $event);
}
c.focusOnAgentChat = function() {
spAriaFocusManager.focusOnAgentChat();
}
spAriaUtil.init();
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spPage.js */
angular.module('sn.$sp').factory('spPage', function($rootScope, spConf, $location, $window, $sanitize, i18n) {
'use strict';
function getStyle(page) {
return '<style type="text/css" data-page-id="' + page.sys_id + '" data-page-title="' + $sanitize(page.title) + '">' + page.css + '</style>'
}
function getClasses(scope) {
var style = [];
if (scope.isNative)
style.push('isNative');
if (scope.theme.navbar_fixed)
style.push('fixed-header');
if (scope.theme.footer_fixed)
style.push('fixed-footer');
return style.join(' ');
}
function getElement(page) {
return "style[data-page-id='" + page.sys_id + "']";
}
function isHashChange(newUrl, oldUrl) {
if (newUrl == oldUrl)
return false;
var newUrlParts = newUrl.split("#");
var oldUrlParts = oldUrl.split("#");
return (newUrlParts.length > 1 && newUrlParts[0] == oldUrlParts[0]);
}
function userLoggedIn(user) {
if (user.hasOwnProperty("logged_in"))
return user.logged_in;
if (user.user_name === "guest")
return false;
if (typeof user.user_name !== "undefined" && user.user_name && user.user_name !== "guest")
return true;
return user.can_debug_admin;
}
function isPublicOrUserLoggedIn(page, user) {
if (page.public || userLoggedIn(user)) {
return true;
}
return false;
}
function getTitle(response) {
if (response.portal.title && !response.portal.hide_portal_name)
return (response.page.title) ? response.page.title + ' - ' + response.portal.title : response.portal.title;
return response.page.title;
}
function saveOnCtrlS(e) {
if (e.keyCode != spConf.s)
return;
if (e.metaKey || (e.ctrlKey && !e.altKey)) {
e.stopPropagation();
e.preventDefault();
$rootScope.$broadcast("$sp.save", e);
}
}
function getUrl(portalId, omitTheme) {
var currentParms = $location.search();
var params = {};
angular.extend(params, currentParms);
params.time = new $window.Date().getTime();
params.portal_id = portalId;
params.request_uri = $location.url();
if (omitTheme)
params.omitTheme = omitTheme;
return spConf.pageApi + '?' + $.param(params);
}
function containsSystemPage(path) {
if (path.indexOf('.do') > 0 && path.indexOf(spConf.page) == -1) {
var newUrl = $location.absUrl();
return '/' + newUrl.substr(newUrl.search(/[^\/]+.do/));
}
return false;
}
function showBrowserErrors() {
$window.console.error = (function (old_function) {
return function (text) {
old_function(text);
$rootScope.$broadcast(spConf.e.notification, {type: "error", message: i18n.getMessage("There is a JavaScript error in your browser console")});
};
} ($window.console.error.bind($window.console)));
}
return {
getTitle: getTitle,
getStyle: getStyle,
getElement: getElement,
isHashChange: isHashChange,
getClasses: getClasses,
isPublicOrUserLoggedIn: isPublicOrUserLoggedIn,
userLoggedIn: userLoggedIn,
saveOnCtrlS: saveOnCtrlS,
getUrl: getUrl,
containsSystemPage: containsSystemPage,
showBrowserErrors: showBrowserErrors
};
});
;
/*! RESOURCE: /scripts/app.$sp/service.spPreference.js */
angular.module('sn.$sp').factory('spPreference', function(spConf, $http, $window) {
'use strict';
return {
set: function(name, value) {
if (value !== null && typeof value === 'object')
value = JSON.stringify(value);
var n = $.param({
sysparm_type: spConf.sysParamType,
sysparm_ck: $window.g_ck,
type: 'set_preference',
name: name,
value: value
});
return $http.post(spConf.angularProcessor + '?' + n);
},
get: function(name, callback) {
if (name == null)
return null;
var n = $.param({
sysparm_type: spConf.sysParamType,
sysparm_ck: $window.g_ck,
type: 'get_preference',
name: name
});
return $http.post(spConf.angularProcessor + '?' + n).then(function(response) {
var answer = response.data.value;
if (callback && typeof callback === "function")
callback(answer);
else
console.warn("spPreference.get synchronous use not supported in Service Portal (preference: " + name + "), use callback");
})
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spWidget.js */
angular.module('sn.$sp').factory('spWidgetService', function($compile, lazyLoader, spServer, $rootScope, $injector) {
var head = document.head || document.getElementsByTagName('head')[0];
function addElement(options) {
var el = document.createElement('style');
el.type = 'text/css';
if (options.id)
el.setAttribute('id', options.id);
if (options.widget)
el.setAttribute('widget', options.widget);
if (el.styleSheet)
el.styleSheet.cssText = options.css;
else
el.appendChild(document.createTextNode(options.css));
return el;
}
function render(scope, element, template) {
element.html(template);
var el = $compile(element.contents())(scope);
element.replaceWith(el);
}
function loadCSS(scope) {
var id = scope.widget.directiveName + '-s';
if (scope.widget.css) {
if (scope.widget.update)
scope.widget.css = scope.widget.css.replace(new RegExp('v' + scope.widget.sys_id, 'g'), scope.widget.directiveName);
if  (!$("head #" + id).length)
head.appendChild(addElement({css: scope.widget.css, id: id, widget: scope.widget.name}));
}
if (scope.widget.options && scope.widget.options.css)
head.appendChild(addElement({css: scope.widget.options.css, widget: scope.widget.name}));
}
function initData(scope){
scope.data = scope.widget.data;
scope.options = scope.widget.options;
scope.widget_parameters = scope.options;
}
function noData(scope) {
if (!scope.widget || !Object.keys(scope.widget).length) {
return true;
}
return false;
}
function loadDirective(scope, directiveName) {
if (scope.widget.providers) {
lazyLoader.providers(scope.widget.providers);
}
lazyLoader.directive(directiveName, function($injector) {
var api = {restrict: 'C', replace: false};
if (typeof scope.data.replace !== 'undefined')
api.replace = scope.data.replace;
if (scope.widget.template)
api.template = scope.widget.template;
if (scope.widget.client_script) {
try {
var stmt = scope.widget.client_script;
if (stmt.indexOf('api.controller') != 0)
stmt = 'api.controller=' + stmt;
var src = scope.widget.id || directiveName;
stmt = "//# sourceURL=" + src + ".js\n" + stmt;
eval(stmt);
api.controller.displayName = src;
if (scope.widget.controller_as) {
api.controllerAs = scope.widget.controller_as;
api.bindToController = {data: '=', options: '=', widget: '=', server: '='};
}
} catch (e) {
console.log(e);
console.log(scope.widget.client_script);
}
}
api.link = function(sc, elem, attr, ctrl) {
var link;
if (scope.widget.link) {
eval('link=' + scope.widget.link);
if (link) {
link(sc, elem, attr, ctrl)
}
};
};
return api;
});
}
function initGlobals(scope) {
scope.page = scope.page || $rootScope.page;
scope.portal = $rootScope.portal;
scope.user = $rootScope.user;
scope.theme = $rootScope.theme;
scope.server = spServer.set(scope);
}
return {
render: render,
loadCSS: loadCSS,
initData: initData,
initGlobals: initGlobals,
noData: noData,
loadDirective: loadDirective
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spWidget.js */
angular.module('sn.$sp').directive('spWidget', function($rootScope, $timeout, $sanitize, lazyLoader, spWidgetService, spUtil, $ocLazyLoad) {
'use strict';
var service = spWidgetService;
function renderWidget(scope, element) {
if (scope.widget.ngTemplates)
lazyLoader.putTemplates(scope.widget.ngTemplates);
service.initData(scope);
service.initGlobals(scope);
var name = scope.widget.sys_id;
name = "v" + name;
if (scope.widget.update) {
name += spUtil.createUid('xxxxx');
}
scope.widget.directiveName = name;
scope.$watch("widget", function(newValue, oldValue){
if (newValue !== oldValue)
service.initData(scope);
});
scope.$on('$destroy', function () {
var depsList = scope.widget.dependencies || [];
var widgetCSSIncludes = NOW.sp.widgetCSSIncludes;
depsList.map(function (item) {
var files = item.files.map(function (file) {
if (file.type !== 'link')
return;
var fileURL = file.url;
var usedElseWhere = widgetCSSIncludes[fileURL] && --widgetCSSIncludes[fileURL];
if (usedElseWhere)
return;
var styleSheet = $('link[href="' + fileURL + '"]');
if (styleSheet.length) {
var last = styleSheet.last();
last.prop('disabled', true);
last.remove();
$ocLazyLoad._getFilesCache().remove(fileURL);
}
});
});
});
var idTag = (scope.widget.rectangle_id) ? "id=\"x"+ scope.widget.rectangle_id +"\"" : "";
var widgetTitle = (scope.widget.options || {}).title || scope.widget.name;
var template = '<div ' + idTag + ' class="' + name + '" data="data" options="options" widget="widget" server="server" sn-atf-area="' + $sanitize(widgetTitle) + '"></div>';
if (name.length == 0)
return;
function load() {
service.loadDirective(scope, name, template);
service.loadCSS(scope);
service.render(scope, element, template);
}
function afterDependencyLoadHandler() {
var depsList = scope.widget.dependencies;
depsList.map(function(item) {
var files = item.files.map(function(file) {
if (file.type !== 'link')
return;
if (NOW.sp.widgetCSSIncludes[file.url])
NOW.sp.widgetCSSIncludes[file.url] += 1;
else
NOW.sp.widgetCSSIncludes[file.url] = 1;
});
});
load();
}
if (scope.widget.dependencies && scope.widget.dependencies.length > 0) {
lazyLoader.dependencies(scope.widget.dependencies).then(afterDependencyLoadHandler, function(e) {
spUtil.format('An error occurred when loading widget dependencies for: {name} ({id}) {error}',
{name: scope.widget.name, id: scope.widget.sys_id, error: e});
load();
});
} else {
load();
}
}
function link(scope, element) {
if (service.noData(scope)) {
var w = scope.$watch("widget", function(){
if (!service.noData(scope)) {
w();
renderWidget(scope, element);
}
});
return;
}
renderWidget(scope, element);
}
return {
restrict : "E",
link : link,
scope : {
widget : '=',
page : '=?'
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/controller.spWidgetDebug.js */
angular.module('sn.$sp').controller('spWidgetDebug', function($scope, $rootScope, $uibModal, $http, spUtil, $window, i18n, spWidgetDiagnostics) {
$scope.reveal = false;
$scope.page = $rootScope.page;
$scope.portal = $rootScope.portal;
$scope.menuModified = false;
var menu = [
null,
[i18n.getMessage("Instance Options"), editInstance],
[i18n.getMessage('Instance in Page Editor {0}').withValues(['➚']), instancePageEdit],
[i18n.getMessage('Page in Designer {0}').withValues(['➚']), openDesigner],
null,
[i18n.getMessage('Show Widget Customizations'), spWidgetDiagnostics.enableDiagnostics],
null,
[i18n.getMessage('Edit Container Background'), editBackground],
null,
[i18n.getMessage('Widget Options Schema'), editOptionSchema],
[i18n.getMessage('Widget in Form Modal'), editWidget],
[i18n.getMessage('Widget in Editor {0}').withValues(['➚']), openWidgetEditor],
null,
[i18n.getMessage('Log to console: {0}').withValues(['$scope.data']), logScopeData],
[i18n.getMessage('Log to console: {0}').withValues(['$scope']), logScope]
];
var basic_menu = [
null,
[i18n.getMessage("Instance Options"), editInstance],
[i18n.getMessage('Log to console: {0}').withValues(['$scope.data']), logScopeData],
[i18n.getMessage('Log to console: {0}').withValues(['$scope']), logScope]
];
$scope.contextMenu = function(event) {
if (!event.ctrlKey || event.shiftKey || !$rootScope.user.can_debug) {
if (!window._protractor_contextmenu) {
return [];
}
}
if (g_user_is_admin) {
if (spWidgetDiagnostics.diagnostics.isEnabled)
menu[5] = [i18n.getMessage('Hide Widget Customizations'), spWidgetDiagnostics.disableDiagnostics];
else
menu[5] = [i18n.getMessage('Show Widget Customizations'), spWidgetDiagnostics.enableDiagnostics];
} else if (!$scope.menuModified) {
menu.splice(5, 2);
$scope.menuModified = true;
}
var m = menu.slice();
if (!$rootScope.user.can_debug_admin)
m = basic_menu.slice();
else if ($scope.page.internal)
m.splice(3, 1);
var w = $scope.rectangle.widget;
m[0] = spUtil.format("'{widget}' {text} : {time}", {widget: w.name, text: i18n.getMessage('generated in'), time: w._server_time});
m[1] = ((!w.option_schema && w.options && !w.options.widget_parameters && !w.field_list) || !$rootScope.user.can_debug_admin) ? [i18n.getMessage("Instance Options")] : [i18n.getMessage("Instance Options"), editInstance];
var p = "_debugContextMenu";
if (p in w && Array.isArray(w[p]))
return m.concat([null], w[p]);
return m;
};
function logScope() {
console.log("Widget instance...", $scope.rectangle.widget);
}
function logScopeData() {
console.log("Widget $scope.data...", $scope.rectangle.widget.data);
}
function editWidget() {
editRecord('sp_widget', $scope.rectangle.widget.sys_id);
}
function editInstance() {
editRecord('sp_instance', $scope.rectangle.sys_id);
}
function editBackground() {
editRecord('sp_container', $scope.container.sys_id);
}
function openDesigner(){
var page = '$spd.do';
var ops = {portal: $scope.portal.url_suffix, page: page, pageId: $scope.page.id, instance: $scope.rectangle.sys_id};
$window.open(spUtil.format('/{page}#/{portal}/editor/{pageId}/{instance}', ops) , page);
}
function openWidgetEditor() {
openConfig({
id : 'widget_editor',
sys_id : $scope.rectangle.widget.sys_id
});
}
function instancePageEdit() {
openConfig({
id : 'page_edit',
p : $scope.page.id,
table : 'sp_instance',
sys_id : $scope.rectangle.sys_id
});
}
function editOptionSchema() {
var data = {
embeddedWidgetId: 'we20',
embeddedWidgetOptions: { sys_id: $scope.rectangle.widget.sys_id }
};
spUtil.get('widget-modal', data).then(function(widget){
var myModalCtrl = null;
widget.options.afterOpen = function(modalCtrl){
myModalCtrl = modalCtrl;
};
var unregister = $scope.$on('$sp.we20.options_saved', function(){
myModalCtrl.close();
unregister();
});
widget.options.afterClose = function(){
$scope.rectangle.debugModal = null;
$rootScope.$broadcast('sp.page.reload');
};
$scope.rectangle.debugModal = widget;
});
}
function openConfig(params) {
$window.open('/sp_config?' + $.param(params), 'sp_config');
}
function editRecord(table, sys_id) {
var input = {
table: table,
sys_id: sys_id
};
spUtil.get('widget-options-config', input).then(function(widget){
var myModalCtrl = null;
widget.options.afterClose = function() {
$scope.rectangle.debugModal = null;
};
widget.options.afterOpen = function(modalCtrl){
myModalCtrl = modalCtrl;
};
$scope.rectangle.debugModal = widget;
var unregister = $scope.$on('sp.form.record.updated', function(evt, fields) {
unregister();
unregister = null;
myModalCtrl.close();
$rootScope.$broadcast('sp.page.reload');
});
});
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spNavbarToggle.js */
angular.module('sn.$sp').directive('spNavbarToggle', function ($rootScope, $window, cabrillo) {
return {
restrict: 'A',
link : function($scope, element, attrs) {
$scope.toggleNavMenu = function() {
$(element).collapse('toggle');
};
$rootScope.$on('sp-navbar-collapse', function() {
$(element).collapse('hide');
});
if (cabrillo.isNative && $window.innerWidth < 767) {
cabrillo.viewLayout.setNavigationBarButtons([{
title: 'Menu'
}], $scope.toggleNavMenu);
}
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spAttachmentButton.js */
angular.module('sn.$sp').directive('spAttachmentButton', function(cabrillo, $rootScope, i18n, spAttachmentUpload, $timeout, spAriaUtil) {
'use strict';
return {
restrict: 'E',
template: function() {
var inputTemplate;
if (cabrillo.isNative()) {
inputTemplate = '<button href="#" title="" ng-click="showAttachOptions()" class="panel-button sp-attachment-add btn btn-link" data-toggle="tooltip" data-placement="bottom" aria-label=""><span class="glyphicon glyphicon-camera"></span></button>';
} else {
inputTemplate = '<input type="file" style="display: none" multiple="true" ng-file-select="uploadAttachments($files)" class="sp-attachments-input"/>';
inputTemplate += '<button title="" ng-click="attachmentHandler.openSelector($event)" class="panel-button sp-attachment-add btn btn-link" data-placement="bottom" data-toggle="tooltip" aria-label="" data-container="section.page"><span class="glyphicon glyphicon-paperclip"></span></button>';
}
return [
'<span class="file-upload-input">',
inputTemplate,
'</span>'
].join('');
},
controller: function($element, $scope) {
var attachedMsg = i18n.getMessage("Attached");
$scope.showAttachOptions = function() {
var handler = $scope.attachmentHandler;
cabrillo.attachments.addFile(
handler.tableName,
handler.tableId,
null,
{maxWidth: 1000, maxHeight: 1000}
).then(function(data) {
handler.getAttachmentList(handler.ADDED);
$rootScope.$broadcast("added_attachment");
}, function() {
console.log('Failed to attach new file');
});
};
$scope.uploadAttachments = function(files) {
spAttachmentUpload.uploadAttachments($scope.attachmentHandler, files)
}
$scope.$on('attachment_select_files', function(e) {
$scope.$evalAsync(function() {
$($element).find('.sp-attachments-input').click();
});
});
$scope.$on('attachment.upload.success', function(evt, args) {
$timeout(function() {
spAriaUtil.sendLiveMessage(args.names + " " + attachedMsg);
}, 500);
});
$scope.$on('attachment.delete.success', function(evt, args) {
$timeout(function() {
spAriaUtil.sendLiveMessage(i18n.getMessage('Attachment deleted successfully'));
}, 500);
});
$scope.$on('attachment.rename.success', function(evt, args) {
spAriaUtil.sendLiveMessage(i18n.getMessage('Attachment renamed successfully'));
});
},
link: function(scope, el, attr) {
i18n.getMessages(["Add attachments", "Required"], function(msgs) {
var msg = msgs["Add attachments"];
if (attr.required === "true")
msg = msg + " " + msgs["Required"];
el.find("button").attr("title", msg);
el.find("button").attr("aria-label", msg);
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spPageRow.js */
angular.module('sn.$sp').directive('spPageRow', function($rootScope, $compile) {
return {
restrict: 'E',
templateUrl: 'sp_page_row',
compile: function($tElement) {
var el = angular.element($tElement[0]);
var recursiveNode = el.children(".sp-row-content").remove();
return function (scope, element, attrs) {
var newNode = recursiveNode.clone();
element.append(newNode);
$compile(newNode)(scope);
};
},
replace: false,
scope: {
columns: "=",
container: "=",
row: '='
},
controller: function($scope) {
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spPanel.js */
angular.module('sn.$sp').directive('spPanel', function() {
return {
restrict: 'E',
transclude: true,
replace: true,
link: function ($scope, $element, $attributes, controller, transcludeFn) {
$scope.widgetParameters = $scope.widget_parameters || $scope.$parent.widget_parameters || {};
if (!$scope.options)
$scope.options = $scope.$eval($attributes.options) || $scope.$parent.options;
var title;
try {
title = $scope.$eval($attributes.title) || $scope.$eval($attributes.widgetTitle);
} catch(e) {
title = $attributes.title
}
$scope.title = title || $scope.options.title;
$scope.bodyClass = $scope.$eval($attributes.bodyClass) || "panel-body";
transcludeFn($scope, function(clone) {
var container = $element.find('div.transclude');
container.empty();
container.append(clone);
});
},
template: '<div class="panel panel-{{options.color}} b">' +
'<div class="panel-heading"> <h2 class="h4 panel-title">' +
'<fa ng-if="options.glyph.length" name="{{options.glyph}}" class="m-r-sm"></fa>{{title}}</h2>' +
'</div>' +
'<div class="{{bodyClass}} transclude"></div>' +
'</div>'
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spModel.js */
angular.module('sn.$sp').directive('spVariableLayout', function(){
'use strict';
return {
restrict : 'E',
templateUrl: 'sp_variable_layout.xml',
scope: false
};
}).directive('spModel', function($q, spUtil, glideFormFactory, glideUserSession, catalogItemFactory, glideFormEnvironmentFactory, catalogGlideFormFactory, spUIActionFactory, glideModalFactory, $uibModal,
spModal, glideListFactory, spModelUtil,spLabelHelper, $sce, spAtf, spSCFieldPropertyDecorator, spSCConf, $rootScope, uiScriptFactory, spAriaUtil) {
'use strict';
return {
restrict : 'E',
templateUrl : function(elem, attrs) {
return attrs.templateUrl || 'sp_model.xml';
},
replace: true,
scope : {
formModel: "=",
mandatory: '=',
isInlineForm: '=?',
embeddedInModal: "=?"
},
controller : function($scope, $rootScope, $timeout) {
var c = this;
var g_form;
var flatFields;
var isCatalogItem;
var formModel;
var ui_g_form;
var formEnvironment;
var deferredEnv = $q.defer();
var _containerVisibility = {};
$scope.okToPaintForm = false;
$scope.delayView = false;
$scope.$watch('formModel', function(newValue) {
if (angular.isDefined(newValue)) {
init();
}
});
$scope.trustedHTML = function(html) {
return $sce.trustAsHtml(html);
}
c.populateMandatory = function populateMandatory(flatFields) {
var mandatory = [];
var field;
for (var f in flatFields) {
field = flatFields[f];
if (typeof field.mandatory_filled == 'undefined' || field.type == spSCConf.CONTAINER_START || field.type == spSCConf.LABEL)
continue;
if (field.mandatory_filled())
continue;
if (field.visible && field.isMandatory())
mandatory.push(field);
}
$scope.$emit("variable.mandatory.change");
return mandatory;
};
function onChange(fieldName, oldValue, newValue){
if (!(fieldName in formModel._fields))
return;
$scope.$evalAsync(function() {
var field = formModel._fields[fieldName];
if (field.stagedValue != newValue) {
field.stagedValue = newValue;
}
var isProcessPrice = isCatalogItem && $scope.formModel.process_price && hasPricingImplications(field);
if (isProcessPrice) {
if (field.type == 'boolean' || field.type == 'boolean_confirm')
c.setBoolean(field, newValue);
if (field.choices)
c.setPrices(field, newValue);
}
$scope.mandatory = c.populateMandatory(flatFields);
var p = {field: field, oldValue: oldValue, newValue: newValue};
$scope.$emit("field.change", p);
$scope.$broadcast("field.change." + field.name, p);
$scope.$emit("field.change." + field.name, p);
if (isProcessPrice)
c.calcPrice(formModel._fields);
});
}
function hasPricingImplications(field) {
if (!field._pricing)
return false;
if (field.type == 'boolean_confirm')
return true;
if (field.type == 'sc_multi_row')
return true;
if (field.type == 'reference' || field.type == 'glide_list' || field.type == 'boolean' || field.choices)
if (field._pricing && field._pricing.pricing_implications === true)
return true;
return false;
}
function getErrorMessage(message) {
var parts = message.replace(/\:/,"####").split("####");
if (parts.length !== 2 || message.indexOf('://') !== -1) { return message; }
var errorFields = [];
var fields = parts[1].split(/\r|\n/);
fields.forEach(function(f) {
f = f.trim();
if (!f) { return; }
errorFields.push(f);
});
if (errorFields.length === 0) { return message; }
return parts[0] + ': ' + errorFields.join(', ');
}
function uiMessageHandler(g_form, type, message) {
switch (type) {
case 'infoMessage':
spUtil.addInfoMessage(message);
break;
case 'warningMessage':
spUtil.addWarningMessage(message);
break;
case 'errorMessage':
case 'mandatoryMessage':
spUtil.addErrorMessage(getErrorMessage(message));
break;
case 'clearMessages':
spUtil.clearMessages();
break;
default:
return false;
}
}
c.getFieldsFromView = function getFieldsFromView(fm) {
var fields = [], field;
if (typeof fm._view !== "undefined") {
for (var f in fm._view) {
field = fm._view[f];
if (fm._fields[field.name]) {
fields.push(fm._fields[field.name]);
}
getNestedVariables(fm, fields, field);
}
} else if (typeof fm._sections !== "undefined") {
getNestedFields(fields, fm._sections);
}
return fields;
};
function getNestedVariables(fm, fields, viewField) {
if (typeof viewField.variables !== "undefined") {
var fieldModel = fm._fields[viewField.name];
if (fieldModel)
fieldModel._children = [];
for (var v in viewField.variables) {
var variable = viewField.variables[v];
if (fm._fields[variable.name]) {
var child = fm._fields[variable.name];
if (fieldModel) {
fieldModel._children.push(variable.name);
child._parent = viewField.name;
}
fields.push(child);
}
getNestedVariables(fm, fields, variable);
}
}
}
function getNestedFields(fields, containers) {
if (!containers)
return;
for (var _container in containers) {
var container = containers[_container];
if (container.columns) {
for (var _col in container.columns) {
var col = container.columns[_col];
for (var _field in col.fields) {
var field = col.fields[_field];
if (field.type == "container")
getNestedFields(fields, [field]);
else if (field.type == "checkbox_container")
getNestedFields(fields, field.containers);
else if (field.type == "field")
fields.push(formModel._fields[field.name]);
}
}
}
}
}
c.hasCatalogVariable = function hasCatalogVariable(flatFields) {
for (var f in flatFields) {
if (flatFields[f].hasOwnProperty('_cat_variable'))
return true;
}
return false;
};
c.calcPrice = function calcPrice(fields) {
function forcePriceUpdate() {
for (var f in fields) {
if (fields[f].type == "sc_multi_row")
return true;
if (fields[f].type == 'reference' || fields[f].type == 'glide_list') {
if (fields[f]._pricing && fields[f]._pricing.pricing_implications === true)
return true;
}
}
}
if (formModel.sys_class_name == 'sc_cat_item_producer')
return;
var price = 0;
var recurring_price = 0;
var isMultiRowFields = false;
angular.forEach(fields, function(field) {
if (field["_multi_row_variable"]) {
isMultiRowFields = true;
return;
}
if (field.price)
price += Number(field.price);
if (field.recurring_price)
recurring_price += Number(field.recurring_price);
});
if (isMultiRowFields)
return;
var o = { price: price, recurring_price: recurring_price, force_update : forcePriceUpdate() };
if (fields)
$scope.$emit("variable.price.change", o);
};
c.setBoolean = function setBoolean(field, value) {
if (field.type != 'boolean' && field.type != 'boolean_confirm')
return;
if (value == true || value == 'true') {
field.price = field._pricing.price_if_checked;
field.recurring_price = field._pricing.rec_price_if_checked;
}
else
field.price = field.recurring_price = 0;
};
c.setPrices = function setPrices(field, value) {
if (!field.choices)
return;
if (!field.choices.length || field.value == ''){
field.price = 0;
field.recurring_price = 0;
}
field.choices.forEach(function(c) {
if (c.value != value)
return;
field.price = c.price;
field.recurring_price = c.recurring_price;
});
};
c.hasChoiceFields = function(flatFields) {
for (var f in flatFields) {
if (flatFields[f].type == 'choice' || flatFields[f].type == 'multiple_choice')
return true;
}
return false;
}
c.hasChoiceFieldsWithPrice = function(flatFields) {
for (var f in flatFields) {
var field = flatFields[f];
if ((field.type == 'choice' || field.type == 'multiple_choice') && field._pricing && field._pricing.pricing_implications === true && field._pricing.enhance_price_labels === true)
return true;
}
return false;
}
$scope.getGlideForm = function() {
return ui_g_form;
};
$scope.setDefaultValue = function (fieldName, fieldInternalValue, fieldDisplayValue) {
g_form.setValue(fieldName, fieldInternalValue, fieldDisplayValue);
};
function hasVariablePrefix(v) {
return v.indexOf("IO:") == 0;
}
$scope.getVarID = function(v) {
if (typeof v.name != "undefined" && hasVariablePrefix(v.name))
return v.name.substring(3);
return v.name;
};
function initGlideForm() {
var uiActions = spUIActionFactory.create(formModel._ui_actions || [], {
attachmentGUID: formModel._attachmentGUID,
uiActionNotifier: function(actionName, uiActionPromise) {
uiActionPromise.then(function(response) {
$rootScope.$broadcast("spModel.uiActionComplete", response, formModel.sys_id);
});
}
}, $scope.formModel.encoded_record);
spModelUtil.extendFields(flatFields);
g_form = glideFormFactory.create($scope, (isCatalogItem ? null : formModel.table), formModel.sys_id, flatFields, uiActions, {
encodedRecord: $scope.formModel.encoded_record,
uiMessageHandler: uiMessageHandler,
cleanDecimals: true,
relatedLists: formModel._related_lists,
sections: formModel._sections
});
g_form.getControl = getControl;
g_form.getField = function(fieldName) {
for (var i = 0, iM = flatFields.length; i < iM; i++) {
var field = flatFields[i];
if (field.variable_name === fieldName || field.name === fieldName) {
return field;
}
}
var getMappedField = g_form.$private.options('getMappedField');
if (typeof getMappedField === 'function') {
var mapped = getMappedField(fieldName);
if (mapped)
return mapped;
}
};
if (isCatalogItem) {
spSCFieldPropertyDecorator.decorate(flatFields, g_form);
transformCatalogPolicies(formModel.policy);
}
function transformCatalogPolicies(uiPolicies) {
uiPolicies.forEach(function(policy) {
policy.conditions.forEach(function(condition) {
if (condition.field.startsWith('variables.')) {
var conditionField = $scope.formModel._fields[condition.field.substring(10)];
if (conditionField)
condition.field = conditionField.variable_name;
}
});
policy.actions.forEach(function(action) {
if (action.name.startsWith('variables.')) {
var actionField = $scope.formModel._fields[action.name.substring(10)];
if (actionField)
action.name = actionField.variable_name;
}
});
})
}
g_form.$private.events.on('change', onChange);
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (propertyName == "mandatory")
$scope.mandatory = c.populateMandatory(flatFields);
if (propertyName == 'messages') {
if (propertyValue && propertyValue.length)
spAriaUtil.sendLiveMessage(propertyValue);
}
if (isCatalogItem && type === "SECTION" && propertyName === "visible") {
var section = _getSection(fieldName);
if (section) {
var mandatoryFields = $scope.mandatory.filter(function (field) {
return field._parent === section.id;
});
if (mandatoryFields.length) {
section.visible = true;
return;
}
var sectionContainer = $scope.formModel._fields[section.id];
if (sectionContainer)
sectionContainer._visible = propertyValue;
}
}
});
$scope.$on("sp.spFormField.stagedValueChange", function() {
$scope.mandatory = c.populateMandatory(flatFields);
});
return g_form;
}
$scope.paintForm = function paintForm(container) {
return $scope.okToPaintForm && $scope.isContainerVisible(container);
};
$scope.isContainerVisible = function isContainerVisible(container) {
if (!isCatalogItem && typeof container.visible !== 'undefined') {
if (container._parent) {
var parentVisibility = _containerVisibility[container._parent];
return typeof parentVisibility !== 'undefined' ? parentVisibility : container.visible;
}
_containerVisibility[container.id] = container.visible;
return container.visible;
}
var field = formModel._fields[container.name];
return typeof field !== 'undefined' ? field.visible : true;
};
c.massageView = function massageView(formModel) {
if (typeof formModel._view == "undefined")
return;
for (var i = formModel._view.length-1; i >= 0; i--) {
var field = formModel._view[i];
if (field.type == 'field' && !formModel._fields[field.name])
formModel._view.splice(i,1);
}
if (formModel._sections == null) {
formModel._sections = [{
_bootstrap_cells: 12,
visible: true,
columns: [{
fields: formModel._view
}]
}];
}
};
function init() {
if (!deferredEnv) {
deferredEnv = $q.defer();
$scope.execItemScripts();
}
$scope.mandatory = [];
formModel = $scope.formModel;
c.massageView(formModel);
flatFields = c.getFieldsFromView(formModel);
isCatalogItem = c.hasCatalogVariable(flatFields);
glideUserSession.loadCurrentUser().then(function(user) {
createEnvironment(user);
$scope.okToPaintForm = true;
$scope.containers = formModel._sections;
deferredEnv.resolve();
}).catch(deferredEnv.reject);
if (formModel && formModel.delayView) {
$scope.delayView = true;
$scope.$on("spModel.view.render", function(evt, id, callback) {
if ($scope.delayView && formModel.sys_id === id) {
$scope.delayView = false;
if (typeof callback == 'function')
callback.call();
}
});
}
}
$scope.execItemScripts = function() {
deferredEnv.promise.then(function(){
deferredEnv = null;
$scope.$emit("spModel.fields.rendered");
$scope.$evalAsync(function() {
$scope.mandatory = c.populateMandatory(flatFields);
formEnvironment.initialize();
$scope.$emit("spModel.gForm.initialized", g_form);
if (isCatalogItem && $scope.formModel.process_price) {
c.calcPrice(flatFields);
if (c.hasChoiceFieldsWithPrice(flatFields))
spLabelHelper.getPriceLabelsForChoiceFields(flatFields, $scope.formModel.recurring_price_frequency)
}
});
});
};
$rootScope.$on("sp.form.submitted", function() {
if (!deferredEnv) {
deferredEnv = $q.defer();
}
$scope.$applyAsync(function() {
$scope.execItemScripts();
});
});
var fieldMap;
const getFieldMap = function() {
fieldMap = new Map(Object.entries(formModel.parent));
return fieldMap;
}
const getParentFormField =  {
'getValue': function(fieldName) {
if (!fieldName)
return '';
var field = null;
if (typeof fieldMap === 'undefined' || fieldMap == null || fieldMap.size === 0)
fieldMap = getFieldMap();
field = fieldMap.get(fieldName);
if (field)
return (typeof field.value !== 'undefined' && field.value !== null) ? field.value.toString() : '';
}
}
function createEnvironment(user) {
g_form = initGlideForm();
var g_modal = glideModalFactory.create({
alert: modalAlert,
confirm: modalConfirm
});
formEnvironment = glideFormEnvironmentFactory.createWithConfiguration(g_form, user, formModel.g_scratchpad, formModel.client_script || [], formModel.policy || [], g_modal, formModel.validation_scripts || [], uiScriptFactory.create(formModel.ui_scripts || [], $q));
ui_g_form = formEnvironment.getUserGlideForm();
if (isCatalogItem) {
formEnvironment.g_env.registerExtensionPoint('g_service_catalog', {'isOrderGuide': function(){ return formModel.isOrderGuideItem ? true : false; }
, 'parent': getParentFormField});
catalogGlideFormFactory.addItemEditor(g_form, formModel.sys_id, null, formModel.sys_id, flatFields);
catalogGlideFormFactory.addVariableEditor(g_form, formModel.sys_id, null, formModel.sys_id, flatFields);
ui_g_form.recordTableName = "sc_cart_item";
}
formEnvironment.g_env.registerExtensionPoint('spModal', spModal);
formEnvironment.g_env.registerExtensionPoint('g_list', glideListFactory.init(g_form, flatFields));
$scope.$emit("spModel.gForm.env.created", g_form);
}
$rootScope.$on('spModel.gForm.rendered', function() {
if (window.ATF)
$timeout(function() {
spAtf.init().then(function(atf) {
g_form.$rootScope = $rootScope;
atf.expose('g_form', spAtf.augmentForm(g_form));
});
}, 1000);
});
$scope.$on('$destroy', function() {
if (g_form)
$scope.$emit("spModel.gForm.destroyed", formModel.sys_id);
});
function modalAlert(title, message, done) {
spModal.alert(message).then(done);
}
function modalConfirm(title, message, done) {
spModal.confirm(message).then(
function() {done(true)},
function() {done(false)}
);
}
function _getSection(sectionName) {
var sections = $scope.formModel._sections;
if (!sections)
return null;
var foundSection = null;
sections.forEach(function(section) {
if (foundSection)
return;
var name = section.caption.toLowerCase().replace(" ", "_").replace(/[^0-9a-z_]/gi, "");
if (name === sectionName) {
foundSection = section;
return;
}
});
return foundSection;
}
}
};
function getControl(name) {
var names = this.getFieldNames();
if (names.indexOf(name) == -1)
return null;
return new GlideFormControl(this, name);
function GlideFormControl(g_form, name) {
this.g_form = g_form;
this.name = name;
this.options = [];
this.focus = function focus() {
console.log(">> focus not implemented for " + this.name)
}
Object.defineProperty(this, 'value', {
get: function() {
return this.g_form.getValue(this.name);
},
set: function(val) {
this.g_form.setValue(this.name, val);
}
})
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spCodeEditorAutocomplete.js */
angular.module('sn.$sp').factory('spCodeEditorAutocomplete', ['$rootScope', '$q', '$http', function($rootScope, $q, $http) {
'use strict';
var configCache = {};
var codeEditorAutocompleteAPI = "/api/now/sp/editor/autocomplete";
return {
getConfig: function(tableName, field) {
if (configCache[tableName + "." + field])
return $q.when(configCache[tableName + "." + field]);
return $http.get(codeEditorAutocompleteAPI + "/table/" + tableName + "/field/" + field).then(function(response) {
var responseConfig = response.data.result;
configCache[tableName + "." + field] = responseConfig;
return responseConfig;
});
}
};
}]);
;
/*! RESOURCE: /scripts/app.$sp/provider.defaultJSAutocomplete.js */
angular.module('sn.$sp').provider('defaultJSAutocomplete', function defaultJSAutocompleteProvider() {
"use strict";
this.$get = function defaultJSAutocompleteFactory() {
return {
"!name": "ecma5",
"!define": {"Error.prototype": "Error.prototype"},
"Infinity": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity",
"!doc": "A numeric value representing infinity."
},
"undefined": {
"!type": "?",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined",
"!doc": "The value undefined."
},
"NaN": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN",
"!doc": "A value representing Not-A-Number."
},
"Object": {
"!type": "fn()",
"getPrototypeOf": {
"!type": "fn(obj: ?) -> ?",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf",
"!doc": "Returns the prototype (i.e. the internal prototype) of the specified object."
},
"create": {
"!type": "fn(proto: ?) -> !custom:Object_create",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create",
"!doc": "Creates a new object with the specified prototype object and properties."
},
"defineProperty": {
"!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty",
"!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article."
},
"defineProperties": {
"!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty",
"!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article."
},
"getOwnPropertyDescriptor": {
"!type": "fn(obj: ?, prop: string) -> ?",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor",
"!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object."
},
"keys": {
"!type": "fn(obj: ?) -> [string]",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys",
"!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)."
},
"getOwnPropertyNames": {
"!type": "fn(obj: ?) -> [string]",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames",
"!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object."
},
"seal": {
"!type": "fn(obj: ?)",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal",
"!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable."
},
"isSealed": {
"!type": "fn(obj: ?) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed",
"!doc": "Determine if an object is sealed."
},
"freeze": {
"!type": "fn(obj: ?) -> !0",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze",
"!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen."
},
"isFrozen": {
"!type": "fn(obj: ?) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen",
"!doc": "Determine if an object is frozen."
},
"preventExtensions": {
"!type": "fn(obj: ?)",
"!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions",
"!doc": "Prevents new properties from ever being added to an object."
},
"isExtensible": {
"!type": "fn(obj: ?) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible",
"!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)."
},
"prototype": {
"!stdProto": "Object",
"toString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString",
"!doc": "Returns a string representing the object."
},
"toLocaleString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString",
"!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes."
},
"valueOf": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf",
"!doc": "Returns the primitive value of the specified object"
},
"hasOwnProperty": {
"!type": "fn(prop: string) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty",
"!doc": "Returns a boolean indicating whether the object has the specified property."
},
"propertyIsEnumerable": {
"!type": "fn(prop: string) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable",
"!doc": "Returns a Boolean indicating whether the specified property is enumerable."
},
"isPrototypeOf": {
"!type": "fn(obj: ?) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf",
"!doc": "Tests for an object in another object's prototype chain."
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object",
"!doc": "Creates an object wrapper."
},
"Function": {
"!type": "fn(body: string) -> fn()",
"prototype": {
"!stdProto": "Function",
"apply": {
"!type": "fn(this: ?, args: [?])",
"!effects": [
"call and return !this this=!0 !1.<i> !1.<i> !1.<i>"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply",
"!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)."
},
"call": {
"!type": "fn(this: ?, args?: ?) -> !this.!ret",
"!effects": [
"call and return !this this=!0 !1 !2 !3 !4"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call",
"!doc": "Calls a function with a given this value and arguments provided individually."
},
"bind": {
"!type": "fn(this: ?, args?: ?) -> !custom:Function_bind",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind",
"!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called."
},
"prototype": "?"
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function",
"!doc": "Every function in JavaScript is actually a Function object."
},
"Array": {
"!type": "fn(size: number) -> !custom:Array_ctor",
"isArray": {
"!type": "fn(value: ?) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray",
"!doc": "Returns true if an object is an array, false if it is not."
},
"prototype": {
"!stdProto": "Array",
"length": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length",
"!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array."
},
"concat": {
"!type": "fn(other: [?]) -> !this",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat",
"!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)."
},
"join": {
"!type": "fn(separator?: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join",
"!doc": "Joins all elements of an array into a string."
},
"splice": {
"!type": "fn(pos: number, amount: number, newelt?: ?) -> [?]",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice",
"!doc": "Changes the content of an array, adding new elements while removing old elements."
},
"pop": {
"!type": "fn() -> !this.<i>",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop",
"!doc": "Removes the last element from an array and returns that element."
},
"push": {
"!type": "fn(newelt: ?) -> number",
"!effects": [
"propagate !0 !this.<i>"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push",
"!doc": "Mutates an array by appending the given elements and returning the new length of the array."
},
"shift": {
"!type": "fn() -> !this.<i>",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift",
"!doc": "Removes the first element from an array and returns that element. This method changes the length of the array."
},
"unshift": {
"!type": "fn(newelt: ?) -> number",
"!effects": [
"propagate !0 !this.<i>"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift",
"!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array."
},
"slice": {
"!type": "fn(from?: number, to?: number) -> !this",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice",
"!doc": "Returns a shallow copy of a portion of an array."
},
"reverse": {
"!type": "fn()",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse",
"!doc": "Reverses an array in place.  The first array element becomes the last and the last becomes the first."
},
"sort": {
"!type": "fn(compare?: fn(a: ?, b: ?) -> number)",
"!effects": [
"call !0 !this.<i> !this.<i>"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort",
"!doc": "Sorts the elements of an array in place and returns the array."
},
"indexOf": {
"!type": "fn(elt: ?, from?: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf",
"!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present."
},
"lastIndexOf": {
"!type": "fn(elt: ?, from?: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf",
"!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex."
},
"every": {
"!type": "fn(test: fn(elt: ?, i: number, array: +Array) -> bool, context?: ?) -> bool",
"!effects": [
"call !0 this=!1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every",
"!doc": "Tests whether all elements in the array pass the test implemented by the provided function."
},
"some": {
"!type": "fn(test: fn(elt: ?, i: number, array: +Array) -> bool, context?: ?) -> bool",
"!effects": [
"call !0 this=!1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some",
"!doc": "Tests whether some element in the array passes the test implemented by the provided function."
},
"filter": {
"!type": "fn(test: fn(elt: ?, i: number, array: +Array) -> bool, context?: ?) -> !this",
"!effects": [
"call !0 this=!1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter",
"!doc": "Creates a new array with all elements that pass the test implemented by the provided function."
},
"forEach": {
"!type": "fn(f: fn(elt: ?, i: number, array: +Array), context?: ?)",
"!effects": [
"call !0 this=!1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach",
"!doc": "Executes a provided function once per array element."
},
"map": {
"!type": "fn(f: fn(elt: ?, i: number, array: +Array) -> ?, context?: ?) -> [!0.!ret]",
"!effects": [
"call !0 this=!1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map",
"!doc": "Creates a new array with the results of calling a provided function on every element in this array."
},
"reduce": {
"!type": "fn(combine: fn(sum: ?, elt: ?, i: number, array: +Array) -> ?, init?: ?) -> !0.!ret",
"!effects": [
"call !0 !1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce",
"!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value."
},
"reduceRight": {
"!type": "fn(combine: fn(sum: ?, elt: ?, i: number, array: +Array) -> ?, init?: ?) -> !0.!ret",
"!effects": [
"call !0 !1 !this.<i> number !this"
],
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight",
"!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value."
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array",
"!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects."
},
"String": {
"!type": "fn(value: ?) -> string",
"fromCharCode": {
"!type": "fn(code: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode",
"!doc": "Returns a string created by using the specified sequence of Unicode values."
},
"prototype": {
"!stdProto": "String",
"length": {
"!type": "number",
"!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length",
"!doc": "Represents the length of a string."
},
"<i>": "string",
"charAt": {
"!type": "fn(i: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt",
"!doc": "Returns the specified character from a string."
},
"charCodeAt": {
"!type": "fn(i: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt",
"!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)."
},
"indexOf": {
"!type": "fn(char: string, from?: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf",
"!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found."
},
"lastIndexOf": {
"!type": "fn(char: string, from?: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf",
"!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex."
},
"substring": {
"!type": "fn(from: number, to?: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring",
"!doc": "Returns a subset of a string between one index and another, or through the end of the string."
},
"substr": {
"!type": "fn(from: number, length?: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr",
"!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters."
},
"slice": {
"!type": "fn(from: number, to?: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice",
"!doc": "Extracts a section of a string and returns a new string."
},
"trim": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim",
"!doc": "Removes whitespace from both ends of the string."
},
"toUpperCase": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase",
"!doc": "Returns the calling string value converted to uppercase."
},
"toLowerCase": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase",
"!doc": "Returns the calling string value converted to lowercase."
},
"toLocaleUpperCase": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase",
"!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings."
},
"toLocaleLowerCase": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase",
"!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings."
},
"split": {
"!type": "fn(pattern?: string|+RegExp, limit?: number) -> [string]",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split",
"!doc": "Splits a String object into an array of strings by separating the string into substrings."
},
"concat": {
"!type": "fn(other: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat",
"!doc": "Combines the text of two or more strings and returns a new string."
},
"localeCompare": {
"!type": "fn(other: string) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare",
"!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order."
},
"match": {
"!type": "fn(pattern: +RegExp) -> [string]",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match",
"!doc": "Used to retrieve the matches when matching a string against a regular expression."
},
"replace": {
"!type": "fn(pattern: string|+RegExp, replacement: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace",
"!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement.  The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match."
},
"search": {
"!type": "fn(pattern: +RegExp) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search",
"!doc": "Executes the search for a match between a regular expression and this String object."
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String",
"!doc": "The String global object is a constructor for strings, or a sequence of characters."
},
"Number": {
"!type": "fn(value: ?) -> number",
"MAX_VALUE": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE",
"!doc": "The maximum numeric value representable in JavaScript."
},
"MIN_VALUE": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE",
"!doc": "The smallest positive numeric value representable in JavaScript."
},
"POSITIVE_INFINITY": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY",
"!doc": "A value representing the positive Infinity value."
},
"NEGATIVE_INFINITY": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY",
"!doc": "A value representing the negative Infinity value."
},
"prototype": {
"!stdProto": "Number",
"toString": {
"!type": "fn(radix?: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString",
"!doc": "Returns a string representing the specified Number object"
},
"toFixed": {
"!type": "fn(digits: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed",
"!doc": "Formats a number using fixed-point notation"
},
"toExponential": {
"!type": "fn(digits: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential",
"!doc": "Returns a string representing the Number object in exponential notation"
},
"toPrecision": {
"!type": "fn(digits: number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision",
"!doc": "The toPrecision() method returns a string representing the number to the specified precision."
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number",
"!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor."
},
"Boolean": {
"!type": "fn(value: ?) -> bool",
"prototype": {
"!stdProto": "Boolean"
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean",
"!doc": "The Boolean object is an object wrapper for a boolean value."
},
"RegExp": {
"!type": "fn(source: string, flags?: string)",
"prototype": {
"!stdProto": "RegExp",
"exec": {
"!type": "fn(input: string) -> [string]",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec",
"!doc": "Executes a search for a match in a specified string. Returns a result array, or null."
},
"test": {
"!type": "fn(input: string) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test",
"!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false."
},
"global": {
"!type": "bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp",
"!doc": "Creates a regular expression object for matching text with a pattern."
},
"ignoreCase": {
"!type": "bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp",
"!doc": "Creates a regular expression object for matching text with a pattern."
},
"multiline": {
"!type": "bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline",
"!doc": "Reflects whether or not to search in strings across multiple lines.\n"
},
"source": {
"!type": "string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source",
"!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n"
},
"lastIndex": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex",
"!doc": "A read/write integer property that specifies the index at which to start the next match."
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp",
"!doc": "Creates a regular expression object for matching text with a pattern."
},
"Date": {
"!type": "fn(ms: number)",
"parse": {
"!type": "fn(source: string) -> +Date",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse",
"!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC."
},
"UTC": {
"!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC",
"!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time."
},
"now": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now",
"!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC."
},
"prototype": {
"toUTCString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString",
"!doc": "Converts a date to a string, using the universal time convention."
},
"toISOString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString",
"!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format."
},
"toDateString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString",
"!doc": "Returns the date portion of a Date object in human readable form in American English."
},
"toTimeString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString",
"!doc": "Returns the time portion of a Date object in human readable form in American English."
},
"toLocaleDateString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString",
"!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n"
},
"toLocaleTimeString": {
"!type": "fn() -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString",
"!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions."
},
"getTime": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime",
"!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time."
},
"getFullYear": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear",
"!doc": "Returns the year of the specified date according to local time."
},
"getYear": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear",
"!doc": "Returns the year in the specified date according to local time."
},
"getMonth": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth",
"!doc": "Returns the month in the specified date according to local time."
},
"getUTCMonth": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth",
"!doc": "Returns the month of the specified date according to universal time.\n"
},
"getDate": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate",
"!doc": "Returns the day of the month for the specified date according to local time."
},
"getUTCDate": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate",
"!doc": "Returns the day (date) of the month in the specified date according to universal time.\n"
},
"getDay": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay",
"!doc": "Returns the day of the week for the specified date according to local time."
},
"getUTCDay": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay",
"!doc": "Returns the day of the week in the specified date according to universal time.\n"
},
"getHours": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours",
"!doc": "Returns the hour for the specified date according to local time."
},
"getUTCHours": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours",
"!doc": "Returns the hours in the specified date according to universal time.\n"
},
"getMinutes": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes",
"!doc": "Returns the minutes in the specified date according to local time."
},
"getUTCMinutes": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date",
"!doc": "Creates JavaScript Date instances which let you work with dates and times."
},
"getSeconds": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds",
"!doc": "Returns the seconds in the specified date according to local time."
},
"getUTCSeconds": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds",
"!doc": "Returns the seconds in the specified date according to universal time.\n"
},
"getMilliseconds": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds",
"!doc": "Returns the milliseconds in the specified date according to local time."
},
"getUTCMilliseconds": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds",
"!doc": "Returns the milliseconds in the specified date according to universal time.\n"
},
"getTimezoneOffset": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset",
"!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale."
},
"setTime": {
"!type": "fn(date: +Date) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime",
"!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n"
},
"setFullYear": {
"!type": "fn(year: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear",
"!doc": "Sets the full year for a specified date according to local time.\n"
},
"setUTCFullYear": {
"!type": "fn(year: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear",
"!doc": "Sets the full year for a specified date according to universal time.\n"
},
"setMonth": {
"!type": "fn(month: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth",
"!doc": "Set the month for a specified date according to local time."
},
"setUTCMonth": {
"!type": "fn(month: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth",
"!doc": "Sets the month for a specified date according to universal time.\n"
},
"setDate": {
"!type": "fn(day: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate",
"!doc": "Sets the day of the month for a specified date according to local time."
},
"setUTCDate": {
"!type": "fn(day: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate",
"!doc": "Sets the day of the month for a specified date according to universal time.\n"
},
"setHours": {
"!type": "fn(hour: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours",
"!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance."
},
"setUTCHours": {
"!type": "fn(hour: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours",
"!doc": "Sets the hour for a specified date according to universal time.\n"
},
"setMinutes": {
"!type": "fn(min: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes",
"!doc": "Sets the minutes for a specified date according to local time."
},
"setUTCMinutes": {
"!type": "fn(min: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes",
"!doc": "Sets the minutes for a specified date according to universal time.\n"
},
"setSeconds": {
"!type": "fn(sec: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds",
"!doc": "Sets the seconds for a specified date according to local time."
},
"setUTCSeconds": {
"!type": "fn(sec: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds",
"!doc": "Sets the seconds for a specified date according to universal time.\n"
},
"setMilliseconds": {
"!type": "fn(ms: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds",
"!doc": "Sets the milliseconds for a specified date according to local time.\n"
},
"setUTCMilliseconds": {
"!type": "fn(ms: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds",
"!doc": "Sets the milliseconds for a specified date according to universal time.\n"
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date",
"!doc": "Creates JavaScript Date instances which let you work with dates and times."
},
"Error": {
"!type": "fn(message: string)",
"prototype": {
"name": {
"!type": "string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name",
"!doc": "A name for the type of error."
},
"message": {
"!type": "string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message",
"!doc": "A human-readable description of the error."
}
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error",
"!doc": "Creates an error object."
},
"SyntaxError": {
"!type": "fn(message: string)",
"prototype": "Error.prototype",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError",
"!doc": "Represents an error when trying to interpret syntactically invalid code."
},
"ReferenceError": {
"!type": "fn(message: string)",
"prototype": "Error.prototype",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError",
"!doc": "Represents an error when a non-existent variable is referenced."
},
"URIError": {
"!type": "fn(message: string)",
"prototype": "Error.prototype",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError",
"!doc": "Represents an error when a malformed URI is encountered."
},
"EvalError": {
"!type": "fn(message: string)",
"prototype": "Error.prototype",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError",
"!doc": "Represents an error regarding the eval function."
},
"RangeError": {
"!type": "fn(message: string)",
"prototype": "Error.prototype",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError",
"!doc": "Represents an error when a number is not within the correct range allowed."
},
"TypeError": {
"!type": "fn(message: string)",
"prototype": "Error.prototype",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError",
"!doc": "Represents an error an error when a value is not of the expected type."
},
"parseInt": {
"!type": "fn(string: string, radix?: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt",
"!doc": "Parses a string argument and returns an integer of the specified radix or base."
},
"parseFloat": {
"!type": "fn(string: string) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat",
"!doc": "Parses a string argument and returns a floating point number."
},
"isNaN": {
"!type": "fn(value: number) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN",
"!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN."
},
"isFinite": {
"!type": "fn(value: number) -> bool",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite",
"!doc": "Determines whether the passed value is a finite number."
},
"eval": {
"!type": "fn(code: string) -> ?",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval",
"!doc": "Evaluates JavaScript code represented as a string."
},
"encodeURI": {
"!type": "fn(uri: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI",
"!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)."
},
"encodeURIComponent": {
"!type": "fn(uri: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent",
"!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)."
},
"decodeURI": {
"!type": "fn(uri: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI",
"!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine."
},
"decodeURIComponent": {
"!type": "fn(uri: string) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent",
"!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine."
},
"Math": {
"E": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E",
"!doc": "The base of natural logarithms, e, approximately 2.718."
},
"LN2": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2",
"!doc": "The natural logarithm of 2, approximately 0.693."
},
"LN10": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10",
"!doc": "The natural logarithm of 10, approximately 2.302."
},
"LOG2E": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E",
"!doc": "The base 2 logarithm of E (approximately 1.442)."
},
"LOG10E": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E",
"!doc": "The base 10 logarithm of E (approximately 0.434)."
},
"SQRT1_2": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2",
"!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707."
},
"SQRT2": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2",
"!doc": "The square root of 2, approximately 1.414."
},
"PI": {
"!type": "number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI",
"!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159."
},
"abs": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs",
"!doc": "Returns the absolute value of a number."
},
"cos": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos",
"!doc": "Returns the cosine of a number."
},
"sin": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin",
"!doc": "Returns the sine of a number."
},
"tan": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan",
"!doc": "Returns the tangent of a number."
},
"acos": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos",
"!doc": "Returns the arccosine (in radians) of a number."
},
"asin": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin",
"!doc": "Returns the arcsine (in radians) of a number."
},
"atan": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan",
"!doc": "Returns the arctangent (in radians) of a number."
},
"atan2": {
"!type": "fn(y: number, x: number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2",
"!doc": "Returns the arctangent of the quotient of its arguments."
},
"ceil": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil",
"!doc": "Returns the smallest integer greater than or equal to a number."
},
"floor": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor",
"!doc": "Returns the largest integer less than or equal to a number."
},
"round": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round",
"!doc": "Returns the value of a number rounded to the nearest integer."
},
"exp": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp",
"!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms."
},
"log": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log",
"!doc": "Returns the natural logarithm (base E) of a number."
},
"sqrt": {
"!type": "fn(number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt",
"!doc": "Returns the square root of a number."
},
"pow": {
"!type": "fn(number, number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow",
"!doc": "Returns base to the exponent power, that is, baseexponent."
},
"max": {
"!type": "fn(number, number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max",
"!doc": "Returns the largest of zero or more numbers."
},
"min": {
"!type": "fn(number, number) -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min",
"!doc": "Returns the smallest of zero or more numbers."
},
"random": {
"!type": "fn() -> number",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random",
"!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range."
},
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math",
"!doc": "A built-in object that has properties and methods for mathematical constants and functions."
},
"JSON": {
"parse": {
"!type": "fn(json: string, reviver?: fn(key: string, value: ?) -> ?) -> ?",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse",
"!doc": "Parse a string as JSON, optionally transforming the value produced by parsing."
},
"stringify": {
"!type": "fn(value: ?, replacer?: fn(key: string, value: ?) -> ?, space?: string|number) -> string",
"!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify",
"!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified."
},
"!url": "https://developer.mozilla.org/en-US/docs/JSON",
"!doc": "JSON (JavaScript Object Notation) is a data-interchange format.  It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.)  It is useful when writing any kind of JavaScript-based application, including websites and browser extensions.  For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference."
}
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/provider.lazyloader.js */
angular.module('sn.$sp').provider('lazyLoader', function() {
"use strict";
var config = {};
var propsCache = {};
var directivesCache = {};
this.set = function(value) {
config = value;
};
function directiveExists(name) {
if (directivesCache[name]) {
return true;
}
directivesCache[name] = true;
return false;
}
function isProviderLoaded(provider) {
if (provider.type === 'directive') {
return directiveExists(provider.name);
}
if (propsCache[provider.name]) {
return true;
}
propsCache[provider.name] = true;
return false;
}
this.$get = ['$controller', '$templateCache', '$ocLazyLoad', function($controller, $templateCache, $ocLazyLoad) {
return {
directive: config.directive,
directiveExists: directiveExists,
controller: config.register,
putTemplates: function(templates) {
for (var i in templates) {
$templateCache.put(i, templates[i]);
}
},
providers: function(provList) {
var provider, script, result = [];
for (var i in provList) {
if (!provList.hasOwnProperty(i))
continue;
provider = provList[i];
if (!isProviderLoaded(provider)) {
eval("script=" + provider.script);
result[i] = config[provider.type](provider.name, script);
}
}
return result;
},
dependencies: function(depsList) {
var deps = depsList.map(function(item) {
var files = item.files.map(function(file) {
var types =  {
script: 'js',
link: 'css'
};
return {
type: types[file.type],
path: file.url
}
});
if (files.length == 1)
return files[0];
var result =  {
files: files,
serie: true
};
if (item.module.length > 0)
result.module = item.module;
return result;
});
return $ocLazyLoad.load(deps);
}
};
}];
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spServer.js */
angular.module('sn.$sp').factory('spServer', function(spUtil) {
"use strict";
function set(scope) {
return {
get: function(data) {
return spUtil.get(scope, data);
},
update: function() {
return spUtil.update(scope);
},
refresh: function() {
return spUtil.refresh(scope);
}
}
}
return {
set: set
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spOnTransition.js */
angular.module('sn.$sp').directive('spOnTransition', function($rootScope) {
function detectEvent(){
var t, el = document.createElement("test");
var transitions = {
"transition"      : "transitionend",
"OTransition"     : "oTransitionEnd",
"MozTransition"   : "transitionend",
"WebkitTransition": "webkitTransitionEnd"
};
for (t in transitions){
if (el.style[t] !== undefined){
return transitions[t];
}
}
}
var transition = detectEvent();
return {
restrict : 'A',
scope: {
spOnTransition: '='
},
link: function(scope, element) {
$(element).on(transition, function() {
$rootScope.$broadcast(scope.spOnTransition.event);
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spContextMenu.js */
angular.module('sn.$sp').directive('spContextMenu', ["$parse", "$q", function ($parse, $q) {
var contextMenus = [];
var removeContextMenus = function (level) {
while (contextMenus.length && (!level || contextMenus.length > level)) {
contextMenus.pop().remove();
}
if (contextMenus.length == 0 && $currentContextMenu) {
$currentContextMenu.remove();
}
};
var $currentContextMenu = null;
var renderContextMenu = function ($scope, event, options, model, level) {
if (!level) { level = 0; }
if (!$) { var $ = angular.element; }
$(event.currentTarget).addClass('context');
var $contextMenu = $('<div>');
$contextMenu.attr({ 'role': 'contentinfo' });
if ($currentContextMenu) {
$contextMenu = $currentContextMenu;
} else {
$currentContextMenu = $contextMenu;
}
$contextMenu.addClass('dropdown clearfix');
var $ul = $('<ul>');
$ul.addClass('dropdown-menu');
$ul.attr({ 'role': 'menu' });
$ul.css({
display: 'block',
"padding-top": '0px',
position: 'absolute',
left: event.pageX + 'px',
top: event.pageY + 'px',
"z-index": 10000
});
var $promises = [];
angular.forEach(options, function (item, i) {
var $li = $('<li>');
$li.attr({ 'role': 'menuitem' });
if (item === null) {
$li.addClass('divider');
} else if (!Array.isArray(item)) {
$li.css("padding", "10px 15px");
$li.css("background-color", "#eee");
$li.css("margin-bottom", "8px");
$li.text(item);
} else {
var nestedMenu = angular.isArray(item[1])
? item[1] : angular.isArray(item[2])
? item[2] : angular.isArray(item[3])
? item[3] : null;
var $a = $('<a>');
$a.css("padding-right", "8px");
$a.attr({ tabindex: '-1', href: '#' });
var text = typeof item[0] == 'string' ? item[0] : item[0].call($scope, $scope, event, model);
$promise = $q.when(text)
$promises.push($promise);
$promise.then(function (text) {
$a.text(text);
if (nestedMenu) {
$a.css("cursor", "default");
$a.append($('<strong style="font-family:monospace;font-weight:bold;float:right;">&gt;</strong>'));
}
});
$li.append($a);
var enabled = angular.isFunction(item[1]);
if (enabled) {
var openNestedMenu = function ($event) {
removeContextMenus(level + 1);
var ev = {
pageX: event.pageX + $ul[0].offsetWidth - 1,
pageY: $ul[0].offsetTop + $li[0].offsetTop - 3
};
renderContextMenu($scope, ev, nestedMenu, model, level + 1);
}
$li.on('click', function ($event) {
$event.preventDefault();
$scope.$apply(function () {
if (nestedMenu) {
openNestedMenu($event);
} else {
$(event.currentTarget).removeClass('context');
removeContextMenus();
item[1].call($scope, $scope, event, model, text);
}
});
});
$li.on('mouseover', function ($event) {
$scope.$apply(function () {
if (nestedMenu) {
openNestedMenu($event);
}
});
});
} else {
$li.on('click', function ($event) {
$event.preventDefault();
});
$li.addClass('disabled');
}
}
$ul.append($li);
});
$contextMenu.append($ul);
var height = Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight
);
$contextMenu.css({
width: '100%',
height: height + 'px',
position: 'absolute',
top: 0,
left: 0,
zIndex: 9999
});
$(document).find('body').append($contextMenu);
$q.all($promises).then(function(){
if(level === 0){
var topCoordinate = event.pageY;
var menuHeight = angular.element($ul[0]).prop('offsetHeight');
var winHeight = event.view.innerHeight;
if (topCoordinate > menuHeight && winHeight - topCoordinate < menuHeight) {
topCoordinate = event.pageY - menuHeight;
}
var leftCoordinate = event.pageX;
var menuWidth = angular.element($ul[0]).prop('offsetWidth');
var winWidth = event.view.innerWidth;
if(leftCoordinate > menuWidth && winWidth - leftCoordinate < menuWidth){
leftCoordinate = event.pageX - menuWidth;
}
$ul.css({
display: 'block',
position: 'absolute',
left: leftCoordinate + 'px',
top: topCoordinate + 'px'
});
}
});
$contextMenu.on("mousedown", function (e) {
if ($(e.target).hasClass('dropdown')) {
$(event.currentTarget).removeClass('context');
removeContextMenus();
}
}).on('contextmenu', function (event) {
$(event.currentTarget).removeClass('context');
event.preventDefault();
removeContextMenus(level);
});
$scope.$on("$destroy", function () {
removeContextMenus();
});
contextMenus.push($ul);
};
return function ($scope, element, attrs) {
element.on('contextmenu', function (event) {
$scope.$apply(function () {
var options = $scope.$eval(attrs.spContextMenu, {event: event});
var model = $scope.$eval(attrs.model);
if (options instanceof Array) {
if (options.length === 0)
return;
event.stopPropagation();
event.preventDefault();
renderContextMenu($scope, event, options, model);
} else {
throw '"' + attrs.contextMenu + '" not an array';
}
});
});
};
}]);
;
/*! RESOURCE: /scripts/app.$sp/factory.spInterceptor.js */
angular.module('sn.$sp').factory('spInterceptor', function($q, $rootScope) {
'use strict';
var activeRequests = [];
var ignore = [
'^/api/now/ui/presence',
'^/api/now/table/'
];
var spRestServices = [
'^/api/now/sp/rectangle/',
'^/api/now/sp/widget/',
'^/api/now/sp/uiaction/'
];
function createUid() {
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r, v;
r = Math.random() * 16 | 0;
v = c === 'x' ? r : r & 0x3 | 0x8;
return v.toString(16);
});
}
function done(id) {
for (var x in activeRequests) {
if (activeRequests[x] === id) {
activeRequests.splice(x, 1);
}
}
if (activeRequests.length === 0) {
$rootScope.$broadcast('sp_loading_indicator', false);
$rootScope.loadingIndicator = false;
}
}
function ignored(url) {
return exist(url, ignore);
}
function isSPRestService(url) {
return exist(url, spRestServices);
}
function exist(url, list) {
var reg;
for (var x in list) {
reg = new RegExp(list[x]);
if (reg.test(url)) {
return true;
}
}
return false;
}
function request(config) {
if (!ignored(config.url)) {
config.id = createUid();
if (isSPRestService(config.url)) {
config.data = config.data || {};
config.headers = config.headers || {};
if (typeof config.data == 'object')
config.data.sessionRotationTrigger = !(window.logged_in);
if (window.getHeaders)
config.headers = angular.merge(window.getHeaders(), config.headers);
}
activeRequests.push(config.id);
$rootScope.$broadcast('sp_loading_indicator', true);
$rootScope.loadingIndicator = true;
}
return config;
}
function error(rejection) {
if (rejection.config.id) {
done(rejection.config.id);
}
return $q.reject(rejection);
}
function response(response) {
if (response.config.id) {
done(response.config.id);
}
return response;
}
return {
request: request,
requestError: error,
response: response,
responseError: error
};
});
;
/*! RESOURCE: /scripts/directive.glyph.js */
angular.module('sn.$sp').directive("glyph", function() {
"use strict";
return {
restrict : 'E',
replace : true,
scope : {
snChar : "@",
},
template : '<span class="glyphicon glyphicon-{{snChar}}" />',
link : function(scope) {
}
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spNotifications.js */
angular.module('sn.$sp').directive('spNotifications', function($timeout, spAriaUtil, spAriaFocusManager, i18n) {
var str = 'CONSOLE:';
function isConsoleMsg(msg) {
if (!msg)
return false;
return msg.startsWith(str);
}
function outputToConsole(msg) {
var output = msg.substring(str.length);
var reg = new RegExp("^\\{|^\\[");
if (reg.test(output)) {
try {
output = jQuery.parseJSON(output);
} catch(err) {
}
}
console.warn(output);
}
return {
restrict: 'E',
replace: true,
template: '<div id="uiNotificationContainer" role="status" aria-atomic="false">\
<div ng-repeat="m in c.notifications"\
class="alert" ng-class="{\'alert-danger\' : m.type == \'error\', \'alert-warning\' : m.type == \'warning\', \'alert-success\' : m.type != \'warning\' && m.type != \'error\'}">\
<span ng-if="m.type == \'error\' " class="fa fa-exclamation-triangle m-r-xs" aria-hidden="true"></span>\
<span ng-if="m.type == \'error\' " class="sr-only">{{c.errorMsg}}</span>\
<span class="alert-msg" ng-bind-html="m.displayMessage" ng-click="::c.dismissOnAnchorClick($event)" role="presentation"></span>\
<button class="btn btn-link fa fa-close dismiss-notifications" ng-click="::c.dismissNotification($index)" aria-label="Close Notification"></button>\
</div>\
</div>',
controllerAs: 'c',
controller: function($scope, $element) {
var c = this;
var dismissedNotifications = [];
c.errorMsg = i18n.getMessage("Error");
c.notifications = [];
var timer;
var duplicateNotfCheck = function(notifications, n, useDisplayMessage) {
for (var i = 0; i < notifications.length; i++)
if (n.message === (useDisplayMessage ? notifications[i].displayMessage : notifications[i].message) && notifications[i].type === n.type)
return i;
return -1;
};
function addNotification(notification) {
if (!notification)
return;
if (isConsoleMsg(notification.message)) {
outputToConsole(notification.message);
return;
}
if (typeof notification.message === "undefined") {
console.warn("Invalid message \"" + notification + "\" passed to spNotifications directive, expected an Object {type:[type], message:[message]}");
return;
}
$element.on('mouseover', function() {
$element.off();
c.cancelAutoDismiss();
});
notification.displayMessage = notification.message;
var notificationIndex = duplicateNotfCheck(c.notifications, notification, false);
$timeout(function () {
if (notificationIndex < 0) {
var dismissedMsgIndex = duplicateNotfCheck(dismissedNotifications, notification, true);
if (dismissedMsgIndex > -1) notification.displayMessage += '&nbsp';
c.notifications.push(notification);
} else {
if (c.notifications[notificationIndex].message === c.notifications[notificationIndex].displayMessage)
c.notifications[notificationIndex].displayMessage += '&nbsp';
else
c.notifications[notificationIndex].displayMessage = c.notifications[notificationIndex].message;
}
}, 500);
if (spAriaUtil.g_accessibility === "true") {
if (notification.type === 'error')
$element.attr('role', 'alert');
}
else {
timer = autoDismiss();
$timeout(function() {
focusFirstErrorField();
}, 50);
}
}
function focusFirstErrorField() {
var hasErrorField = $(".has-error:first");
var elements = ["input:visible", "textarea:visible", "button:visible"];
var hasErrorHtmlField = hasErrorField.find('iframe:visible');
if (hasErrorField.hasClass('type-html') && hasErrorHtmlField.length) {
hasErrorHtmlField.contents().find('body').focus();
return true
}
for (var i = 0; i < elements.length; i++) {
var errorElement = hasErrorField.find(elements[i]);
if (errorElement.length) {
errorElement[0].focus();
return true;
}
}
return false;
}
function addNotifications(e, notifications) {
if (!notifications) {
console.warn("$$uiNotification event fired with invalid or missing notifications parameter");
return;
}
if (Array.isArray(notifications)) {
for (var x in notifications)
addNotification(notifications[x]);
} else {
addNotification(notifications);
}
}
$scope.$on("$$uiNotification", addNotifications);
var updateDismissedNotifications = function(n) {
var index = duplicateNotfCheck(dismissedNotifications, n, false);
if (index < 0)
dismissedNotifications.push(n);
else
dismissedNotifications[index] = n;
};
c.dismissNotification = function(index) {
updateDismissedNotifications(c.notifications[index]);
if (index > -1) c.notifications.splice(index, 1);
if (spAriaUtil.isAccessibilityEnabled()) {
if (c.notifications.length > 0) {
var focusableIndex = (index === c.notifications.length) ? 0 : index+1;
$scope.focusOnNotificationCloseButton(focusableIndex);
}
else if (!focusFirstErrorField())
spAriaFocusManager.focusOnPageTitle();
}
};
c.dismissNotifications = function() {
c.notifications.forEach(function(n) {
updateDismissedNotifications(n);
});
c.notifications.length = 0;
};
c.dismissOnAnchorClick = function(e) {
if (!g_persist_msgs_through_page_nav)
return;
if (e.target.nodeName == 'A')
c.dismissNotifications();
}
c.getMilliSeconds = function() {
var msgTimeout = (typeof g_notif_timeout !== "undefined") ? g_notif_timeout : 5;
var seconds = (areTrivial(c.notifications)) ? 3 : msgTimeout;
return seconds * 1000;
};
function areTrivial(input) {
return input.length >= 1 && input.every(function(item) {
return item && item.type === 'trivial';
})
}
function autoDismiss() {
if (timer)
$timeout.cancel(timer);
var milliSeconds = c.getMilliSeconds();
if (milliSeconds > 0)
return $timeout(c.dismissNotifications, milliSeconds);
}
c.cancelAutoDismiss = function() {
if (areTrivial(c.notifications))
return;
$timeout.cancel(timer);
};
$scope.$on("$$uiNotification.dismiss", c.dismissNotifications);
},
link: function(scope, element, attrs, ctrl) {
scope.focusOnNotificationCloseButton = function(index) {
$timeout(function() {
$('#uiNotificationContainer .dismiss-notifications')[index].focus();
});
};
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/provider.spNotificationEvents.js */
angular.module('sn.$sp').provider('spNotificationEvents', function() {
'use strict';
var _$rootScope;
function clearMessages() {
if (!_$rootScope) {
return;
}
_$rootScope.$broadcast("$$uiNotification.dismiss");
}
function addMessages(messages) {
if (!_$rootScope) {
return;
}
_$rootScope.$broadcast("$$uiNotification", messages);
}
this.clearMessages = clearMessages;
this.addMessages = addMessages;
this.$get = function($rootScope) {
_$rootScope = $rootScope;
return {
clearMessages: clearMessages,
addMessages: addMessages
};
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spIs.js */
angular.module('sn.$sp').factory('spIs', function() {
function email(input) {
var regex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
return regex.test(input);
}
return {
an: {
email: email
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spThrottle.js */
angular.module('sn.$sp').factory('spThrottle', ['$timeout', function ($timeout) {
return function (callback, delay) {
var wait = false;
return function () {
if (!wait) {
callback.call();
wait = true;
$timeout(function () {
wait = false;
}, delay);
}
}
};
}]);
;
/*! RESOURCE: /scripts/app.$sp/service.spModal.js */
angular.module('sn.$sp').factory('spModal', function($q, spUtil, $http, $uibModal, i18n, $document, $timeout, $uibModalStack) {
"use strict";
function alert(message, appendTo) {
var options = {
title: message,
buttons: [ {label: i18n.getMessage('OK'), primary: true} ],
appendTo : appendTo
};
return alertConfirm(options);
}
function confirm(message, appendTo) {
var options = {title: message, appendTo: appendTo};
return alertConfirm(options);
}
function alertConfirm(options) {
options.messageOnly = true;
if (options.title.length < 25)
options.size = 'sm'
var defer = $q.defer();
open(options).then(function() {
defer.resolve(true);
}, function() {
defer.reject(false);
})
return defer.promise;
}
function prompt(message, defaultValue, appendTo) {
var options = {
title: message,
input: true,
value: defaultValue,
appendTo : appendTo,
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0}
};
var defer = $q.defer();
open(options).then(function(value) {
defer.resolve(value);
}, function() {
defer.reject(null);
})
return defer.promise;
}
function open(options) {
options = initOptions(options);
var defer = $q.defer();
if (options.widget) {
var widgetURL = spUtil.getWidgetURL(options.widget);
$http.post(widgetURL, options.widgetInput).success(function(response) {
options.widget = response.result;
options.widget.options.shared = options.shared;
_open(options, defer);
});
} else
_open(options, defer);
return defer.promise;
}
function _open(options, defer) {
var pageRoot = angular.element('.sp-page-root');
var modal = $uibModal.open({
templateUrl:'sp-modal.html',
controller: spModalCtrl,
size: options.size,
appendTo: options.appendTo,
backdrop: options.backdrop != undefined ? options.backdrop : true,
keyboard: options.keyboard != undefined ? options.keyboard : true,
resolve: {
options: function() {
return options;
}
}
});
modal.result.then(function(result) {
if (options.input) {
defer.resolve(result.input, result.button);
} else {
defer.resolve(result.button);
}
}, function(){
defer.reject();
});
modal.rendered.then(function() {
var h1 = angular.element('#modal-title');
var modal = h1.closest('div.modal');
modal.attr('aria-labelledby', 'modal-title');
pageRoot.attr('aria-hidden', 'true');
modal.attr('aria-modal', 'true');
if (options.noDismiss) {
$timeout(function() {
var focusableEls = window.tabbable(modal[0]);
if (focusableEls[0]) focusableEls[0].focus();
}, 0);
}
});
}
function initOptions(options) {
var defaults = {
title: '',
message: '',
messageOnly: false,
errorMessage: '',
input: false,
label: '',
size: '',
value: '',
required: false,
values: false,
onSubmit: null,
widget: null,
widgetInput: null,
noDismiss: false,
dismissOnEnter: false,
buttons: [
{label: i18n.getMessage('Cancel'), cancel:true},
{label: i18n.getMessage('OK'), primary:true}
]
};
options = options || {};
for (var key in defaults) {
if (options[key] === undefined) {
options[key] = defaults[key];
}
}
if (options.messageOnly) {
options.headerStyle = {border: 'none'}
options.footerStyle = {border: 'none', 'padding-top': 0}
}
if (options.noDismiss)
options.headerStyle = {display: 'none'};
return options;
}
function spModalCtrl($scope, options) {
$scope.input = {value: options.value};
$scope.options = options;
$scope.form = {};
$scope.buttonClicked = function(button){
if (button.cancel) {
$scope.$dismiss();
return;
}
if (options.input && $scope.form.xpForm.$invalid) {
$scope.changed = true;
return;
}
if(options.onSubmit) {
var promise = options.onSubmit();
promise.then(function(res) {
if(!res.status) {
$scope.options.errorMessage = res.errorMessage;
return;
} else {
$scope.$close({button:button, input: $scope.input.value});
}
});
} else {
$scope.$close({button:button, input: $scope.input.value});
}
}
$scope.$on('modal.closing', function() {
var pageRoot = angular.element('.sp-page-root');
pageRoot.attr('aria-hidden', 'false');
});
$scope.clearFocusListCache = function() {
$uibModalStack.clearFocusListCache();
}
$scope.submit = function(){
var ok;
angular.forEach($scope.options.buttons, function(button) {
if (button.primary)
ok = button;
})
if (ok) $scope.buttonClicked(ok);
}
$scope.keyPress = function(keyCode) {
if (keyCode === 13 && $scope.options.dismissOnEnter == true)
$scope.submit();
}
}
var spModal = {alert: alert, confirm: confirm, prompt: prompt, open: open};
return spModal;
})
angular.module('sn.$sp').directive('spFocusIf', function focusIf($timeout) {
function link($scope, $element, $attrs) {
var dom = $element[0];
if ($attrs.spFocusIf)
$scope.$watch($attrs.spFocusIf, focus);
else
focus(true);
function focus(condition) {
if (condition) {
$timeout(function() {
dom.focus();
}, $scope.$eval($attrs.spFocusDelay) || 0);
}
}
}
return {
restrict : 'A',
link : link
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spTextarea.js */
angular.module('sn.$sp').directive('spTextarea', function($window, $rootScope) {
'use strict';
function autosizeAsync(scope, element) {
scope.$applyAsync(function(){
if (scope.field.isVisible()) {
$window.requestAnimationFrame(function() {
$window.autosize.update(element);
})
}
})
}
return {
scope: {
field: '=',
getGlideForm: '&glideForm'
},
require: '^ngModel',
template: '<textarea sp-ignore-composition="" ng-attr-placeholder="{{field.placeholder}}" style="resize:vertical;" aria-required="{{field.isMandatory()}}"/>',
restrict : 'E',
replace : true,
link : function(scope, element, attr, ngModel) {
$window.autosize(element);
var render0 = ngModel.$render;
ngModel.$render = function() {
render0();
autosizeAsync(scope, element);
}
var isHiddenOnRender = !scope.field.isVisible();
var resizeCallback = function() {
if (scope.field.isVisible())
autosizeAsync(scope, element);
}
if (isHiddenOnRender) {
$rootScope.$on('field.change', resizeCallback);
}
$rootScope.$on('sp.components.resize', resizeCallback);
var g_form = scope.getGlideForm();
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (fieldName !== scope.field.name)
return;
if (type === 'FIELD' && propertyName === 'visible' && propertyValue)
autosizeAsync(scope, element);
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAria.js */
angular.module('sn.$sp')
.factory('spAriaUtil', function($window, $rootScope) {
'use strict';
var g_accessibility = $window.g_accessibility;
function link(role, forced, index) {
return function($scope, $element, attr) {
if (g_accessibility && (_.isEmpty(attr['role']) || forced))
$element.attr('role', role);
tabindex($element, attr, index);
}
}
function tabindex($element, attr, index) {
if (!_.isEmpty(attr['tabindex']))
index = attr['tabindex'];
if (!_.isEmpty(index))
$element.attr('tabindex', index);
}
function attr($element, name, value) {
if (g_accessibility)
$element.attr(name, value);
}
var liveMessageHandler;
function registerLiveMessageHandler(callbackFn) {
liveMessageHandler = callbackFn;
}
function sendLiveMessage(message, type) {
if (liveMessageHandler)
liveMessageHandler(message, type);
}
function isAccessibilityEnabled() {
return g_accessibility === true || g_accessibility === 'true';
}
function init() {
if(window.g_accessibility_resizeText) {
$(window).on('load', function () {
if (window.NOW.portal_id === '26f2fffb77322300454792718a1061e5') {
var initialRootFontSize = 16;
var currentRootFontSize = parseInt(window.getComputedStyle(document.documentElement).fontSize, 10);
var zoomPercent = Math.ceil(((currentRootFontSize/initialRootFontSize)*100) / 10) * 10;
if (zoomPercent >= 150)
document.body.setAttribute('text-zoom', 'true');
else
document.body.removeAttribute('text-zoom');
} else {
var initialRootFontSize = parseInt(window.getComputedStyle(document.documentElement).fontSize, 10);
var iframe = document.createElement('iframe');
iframe.setAttribute('tabindex', '-1');
iframe.setAttribute('aria-hidden', 'true');
iframe.id = 'text_only_resize_iframe';
iframe.style.top = '-999px';
iframe.style.left = '-999px';
iframe.style.position = 'absolute';
iframe.style.height = '1em';
iframe.onload = function (event) {
iframe.contentWindow.addEventListener('resize', function (event) {
var currentRootFontSize = parseInt(window.getComputedStyle(document.documentElement).fontSize, 10);
var zoomPercent = Math.ceil(((currentRootFontSize/initialRootFontSize)*100) / 10) * 10;
$rootScope.$broadcast('sp.textOnlyZoom', zoomPercent);
if(zoomPercent >= 150)
document.body.setAttribute('text-zoom', 'true');
else
document.body.removeAttribute('text-zoom');
});
};
document.body.insertBefore(iframe, document.body.childNodes[0]);
}
});
}
}
return {
init: init,
link : link,
tabindex : tabindex,
g_accessibility : g_accessibility,
sendLiveMessage: sendLiveMessage,
onLiveMessage: registerLiveMessageHandler,
isAccessibilityEnabled: isAccessibilityEnabled
}
})
.directive('spa11y', function(spAriaUtil) {
function link($scope, $element, attr) {
$element.attr('accessibility', g_accessibility);
}
return {
restrict : 'A',
link : link
}
})
.directive('spAria', function(spAriaUtil) {
function link($scope, $element, attr) {
var role = attr['spAria'];
if (spAriaUtil.g_accessibility && !_.isEmpty(role))
$element.attr('role', role);
}
return {
restrict : 'A',
link : link
}
})
.directive('body', function(spAriaUtil, spAriaFocusManager, $location, $browser, $window) {
return {
restrict : 'E',
link : function(scope, elem) {
angular.element(elem).on('click', 'a', function(){
scope.$applyAsync(function() {
spAriaFocusManager.navigateToLink($location.url());
var hash = $location.hash();
if ($location.absUrl() === $browser.url() && hash) {
var elm = document.getElementById(hash) || $('a:visible[name='+hash+']')[0];
if (elm)
elm.scrollIntoView();
else if (hash === 'top')
$window.scrollTo(0, 0);
}
});
});
}
}
})
.directive('form', function(spAriaUtil) {
return {
restrict : 'E',
link : spAriaUtil.link('form')
}
})
.directive('img', function(spAriaUtil) {
return {
restrict : 'E',
link : spAriaUtil.link('presentation')
}
})
.directive('textarea', function(spAriaUtil) {
return {
restrict : 'E',
link : spAriaUtil.link('textbox', false, 0)
}
})
.directive('input', function(spAriaUtil) {
function link($scope, $element, attr) {
var role;
switch (attr['type']) {
case 'email':
case 'password':
case 'tel':
case 'text':
case 'url':
role = 'textbox';
break;
case 'button':
case 'checkbox':
case 'radio':
role = attr['type'];
break;
case 'hidden':
break;
case 'image':
case 'reset':
case 'submit':
role = 'button';
break;
case 'number':
role = 'spinbutton';
break;
case 'range':
role = 'slider';
break;
case 'search':
role = 'searchbox';
break;
}
if (spAriaUtil.g_accessibility && !_.isEmpty(role))
spAriaUtil.link(role, false, 0)($scope, $element, attr);
}
return {
restrict : 'E',
link : link
}
})
.directive('span', function(spAriaUtil) {
function link($scope, $element, attr) {
var role;
if (attr['style'] && attr['style'].indexOf('background') > -1) {
role = 'presentation';
attr['aria-hidden'] = true;
}
if (spAriaUtil.g_accessibility && !_.isEmpty(role))
spAriaUtil.link(role, false, 0)($scope, $element, attr);
}
return {
restrict : 'E',
link : link
}
})
.directive('role', function(spAriaUtil) {
function link($scope, $element, attr) {
var role = attr['role'];
if (role === 'slider') {
spAriaUtil.tabindex($element, attr, -1);
$element.find('i[aria-valuetext]').each(function( idx, el ) {
$(el).attr('tabindex', 0);
});
}
}
return {
restrict : 'A',
link : link
}
})
.directive('spAriaLive', function(spAriaUtil, spUtil, $sanitize) {
function link(scope, elem, attr) {
var track = { status: false, alert: false };
var isMobile = spUtil.isMobile(), ariaLiveTimeout;
var liveMsgFunc = function(message, type) {
ariaLiveTimeout && clearTimeout(ariaLiveTimeout);
if (isMobile)
$(elem).find(type == 'status' ? '.sp-aria-live-polite' : '.sp-aria-live').removeAttr("style");
type = type || 'alert';
if (!message.length) {
$(elem).find(type == 'status' ? '.sp-aria-live-polite' : '.sp-aria-live').html('');
return;
}
var uniqueMessage = [];
message.forEach(function(item, index) {
if (uniqueMessage.indexOf(item.message) == -1)
uniqueMessage.push(item.message);
});
if (message.length === 1)
track[type] = !track[type];
var parentDiv = document.createElement('div');
uniqueMessage.forEach(function(item, index) {
uniqueMessage[index] = track[type] ? (uniqueMessage[index] + '&nbsp') : uniqueMessage[index];
var childDiv = document.createElement('div');
childDiv.innerHTML = $sanitize(uniqueMessage[index]);
parentDiv.appendChild(childDiv);
});
$(elem).find(type == 'status' ? '.sp-aria-live-polite' : '.sp-aria-live').html('').append(parentDiv);
if (isMobile) {
setTimeout(function() {
document.querySelector(type == 'status' ? '.sp-aria-live-polite' : '.sp-aria-live').style.display = 'none';
}, 200);
}
ariaLiveTimeout = setTimeout(function() {
$(elem).find('.sp-aria-live-polite')[0].innerHTML = '';
$(elem).find('.sp-aria-live')[0].innerHTML = '';
}, 1000);
};
var timeout;
var prevMessage;
spAriaUtil.onLiveMessage(function(msg, type) {
var message = (typeof msg === 'object') ? msg : [{message:msg}];
if (message.length === 1) {
if (msg == prevMessage) {
timeout && clearTimeout(timeout);
timeout = setTimeout(function() {
liveMsgFunc(message, type);
}, 150);
} else
liveMsgFunc(message, type);
prevMessage = msg;
} else {
timeout && clearTimeout(timeout);
liveMsgFunc(message, type);
prevMessage = '';
}
});
}
return {
template : [
'<div>',
'<div aria-live="assertive" class="sr-only sp-aria-live"></div>',
'<div aria-live="polite" class="sr-only sp-aria-live-polite"></div>',
'</div>'
].join(''),
restrict : 'E',
link : link
}
})
.directive('spRating', function($timeout, i18n) {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
var ratingDescriptionMsg = i18n.getMessage('{0} out of {1} selected');
$timeout(function() {
if (attrs.readonly === true || attrs.readonly === "true") {
angular.element(elem).removeAttr('tabindex');
}
scope.$watch(attrs.ngModel, function(newValue) {
angular.element(elem).attr('aria-valuetext', ratingDescriptionMsg.withValues([newValue, attrs.max]));
});
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spAriaPageTitle.js */
angular.module("sn.$sp").directive('spAriaPageTitle', function(spAriaFocusManager) {
function link(scope, elem, attr) {
spAriaFocusManager.registerPageTitleFocus(function(focusFirstTabbableEl, $event) {
scope.$applyAsync(function() {
if (focusFirstTabbableEl) {
var focusablePageElements = window.tabbable($('main')[0]);
if (focusablePageElements[0]) {
focusablePageElements[0].focus();
$event.stopPropagation();
return;
}
}
elem.attr('tabIndex', '-1').focus();
});
});
}
return {
restrict: 'E',
replace: true,
scope: {
pageTitle: '='
},
template: "<h1 class='sr-only'>{{pageTitle}}</h1>",
link: link
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAriaFocusManager.js */
angular.module('sn.$sp').service("spAriaFocusManager", function() {
var danglingNavigation;
var onPageLoadHandlerCallback;
function linkHandler(newLinkRoute) {
danglingNavigation = newLinkRoute;
}
function pageLoadComplete(newPageRoute) {
if (newPageRoute == danglingNavigation && onPageLoadHandlerCallback) {
onPageLoadHandlerCallback();
}
danglingNavigation = null;
}
function registerPageTitleCallback(pageLoadHandlerFn) {
onPageLoadHandlerCallback = pageLoadHandlerFn;
}
function focusOnPageTitle(focusFirstTabbableEl, $event) {
if (onPageLoadHandlerCallback) {
onPageLoadHandlerCallback(focusFirstTabbableEl, $event);
}
}
function focusOnAgentChat() {
var spAgentChatContainer = $('.sp-ac-root')[0];
var chatToggleButton = $('button.sp-ac-btn')[0];
var isChatOpen = angular.element(spAgentChatContainer).scope()["$parent"]["c"]["isOpen"];
if (isChatOpen)
spAgentChatContainer.focus();
else
chatToggleButton.focus();
}
function enableFocusOnDisabledSelect2(element) {
if (g_accessibility !== "true") {
return;
}
element = $(element.currentTarget);
var parentElem = element.parent();
var inputElem = parentElem.find(".select2-focusser");
if (!inputElem[0])
return;
var spanElem = parentElem.find(".select2-arrow")[0] || parentElem.find("[data-select2-arrow]")[0];
spanElem = $(spanElem);
if (element.attr("disabled")) {
inputElem.removeAttr("disabled");
inputElem.removeAttr("aria-expanded");
inputElem.attr("readonly", "readonly");
inputElem.removeAttr("role");
spanElem.removeClass("select2-arrow");
spanElem.attr("data-select2-arrow", "false");
} else {
inputElem.removeAttr("readonly");
inputElem.attr("role", "combobox");
inputElem.attr("aria-expanded", "false");
spanElem.addClass("select2-arrow");
spanElem.attr("data-select2-arrow", "true");
}
}
return {
navigateToLink: linkHandler,
pageLoadComplete: pageLoadComplete,
registerPageTitleFocus: registerPageTitleCallback,
focusOnPageTitle: focusOnPageTitle,
enableFocusOnDisabledSelect2 : enableFocusOnDisabledSelect2,
focusOnAgentChat: focusOnAgentChat
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAnnouncement.js */
angular.module('sn.$sp').factory('spAnnouncement', function($rootScope, $http, $window, $timeout, $q, spConf, spUtil) {
'use strict';
var _initialized = false;
var _initializing = false;
var _sessionId = $window.NOW.session_id;
var _all = [];
var _list = [];
function _clone(obj) {
return JSON.parse(JSON.stringify(obj));
}
function _cleanupStorage() {
for (var key in $window.localStorage) {
if (!$window.localStorage.hasOwnProperty(key)) {
return;
}
if (key.indexOf('dismissed_announcement_') === 0 && $window.localStorage.getItem(key) !== _sessionId) {
$window.localStorage.removeItem(key)
}
}
}
function _handleHttpError(res) {
console.log(spUtil.format('*** [HTTP::{code}] Unable to retrieve announcement', {
code: res.status
}));
}
function _buildReq(path, method) {
return {
method: method ? method : 'GET',
url: path ? spConf.announcementApi + '/' + path : spConf.announcementApi,
headers: {
'X-PORTAL-ID': $rootScope.portal_id
}
};
}
function _filterType(type) {
return function(announcement) {
if (!type) {
return true;
}
var filterTypes = type.trim().toLowerCase().split(',');
var types = announcement.type.trim().toLowerCase().split(',');
for (var i = 0; i < types.length; i++) {
for (var j = 0; j < filterTypes.length; j++) {
if (types[i].trim() === filterTypes[j].trim()) {
return true;
}
}
}
return false;
}
}
function _filter(list, query, limit, page) {
var result = [];
if (!query) {
result = list;
} else {
result = list.filter(function(a) {
var include = false;
try {
if (typeof(query) === 'function') {
include = query(a);
} else if (query.key) {
include = a[query.key] === query.value;
}
} catch (e) {
console.log('*** spAnnouncement.service: unable to process filter', e);
}
return include;
});
}
if (limit && page) {
if (!result.length) {
return {
data: result,
page: 0,
totalPages: 0,
totalRecords: 0
};
}
limit = parseInt(limit, 10);
page = parseInt(page + '', 10);
var offset = (page - 1) * limit;
return {
data: result.slice(offset, offset + limit),
page: page,
totalPages: Math.ceil(result.length / limit),
totalRecords: result.length
};
}
return result;
}
function _remove(id, list) {
return list.filter(function(a) {
return a.id !== id;
});
}
function _sessionDismissed(id) {
return $window.localStorage.getItem('dismissed_announcement_' + id) === _sessionId;
}
function _dismiss(id) {
var announcement = _.find(_all, {
id: id
});
if (announcement.dismissOption === 'SESSION_DISMISSIBLE' || !$rootScope.user.logged_in) {
try {
$window.localStorage.setItem('dismissed_announcement_' + id, _sessionId);
} catch (e) {
}
} else {
$http(_buildReq(id + '/dismiss', 'POST'));
}
announcement.dismissed = true;
_processAnnouncements();
}
function _processAnnouncements() {
_list = [];
_all.forEach(function(a) {
if (a.dismissed || ((a.dismissOption === 'SESSION_DISMISSIBLE' || !$rootScope.user.logged_in)) && _sessionDismissed(a.id)) {
a.dismissed = true;
}
_list.push(a);
});
$rootScope.$broadcast(spConf.e.announcement);
}
function _subscribe(scope, callback) {
var handler = scope.$on(spConf.e.announcement, callback);
scope.$on('$destroy', handler);
}
function _getAnnouncements(announcements) {
if (announcements) {
return $q(function(resolve) {
_all = announcements;
resolve();
});
}
return $http(_buildReq()).then(function(res) {
_all = res.data.result;
}, _handleHttpError);
}
function _init(announcements) {
if (_initialized || _initializing || $window.NOW.sp.disableAnnouncements) {
return $q(function(resolve) {
resolve();
});
}
_initializing = true;
return _getAnnouncements(announcements).then(function() {
_processAnnouncements();
$rootScope.$evalAsync(_cleanupStorage);
_initialized = true;
_initializing = false;
});
}
return {
init: _init,
subscribe: _subscribe,
dismiss: _dismiss,
filterOnType: _filterType,
get: function(query, limit, page) {
return _clone(_filter(_list, query, limit, page));
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spAnnouncements.js */
angular.module('sn.$sp').directive('spAnnouncements', function($timeout, spAriaFocusManager) {
return {
restrict: 'E',
replace: true,
templateUrl: 'sp_announcements.xml',
controllerAs: 'c',
controller: function($scope, spAnnouncement, i18n, $window) {
var c = this;
var _announcements;
c.showAll = false;
c.announcements = [];
c.totalAnnouncements = 0;
c.i18n = {
dismiss: i18n.getMessage('Dismiss'),
collapse: i18n.getMessage('HIDE ALL'),
announcement: i18n.getMessage('announcement'),
announcements: i18n.getMessage('announcements'),
defaultLinkText: i18n.getMessage('Learn More'),
more: i18n.getMessage('MORE'),
less: i18n.getMessage('LESS')
};
function _updateCurrentAnnouncements() {
c.announcements = c.showAll ? _announcements : [_announcements[0]];
}
function _getCurrentAnnouncements() {
c.totalAnnouncements = 0;
_announcements = spAnnouncement.get(function(announcement) {
return !announcement.dismissed && spAnnouncement.filterOnType('banner')(announcement);
});
if (_announcements.length) {
c.totalAnnouncements = _announcements.length;
if (c.totalAnnouncements > 1) {
c.expandMoreCount = i18n.format(i18n.getMessage('EXPAND ALL {0}'), c.totalAnnouncements - 1);
if (!c.showAll)
c.showMore = c.expandMoreCount;
}
else
c.showMore = c.showAll ? c.i18n.less : c.i18n.more;
_announcements = c.totalAnnouncements > 0 ? _announcements : [];
_updateCurrentAnnouncements();
}
}
c.dismiss = function(id, index) {
spAnnouncement.dismiss(id);
$timeout(function() {
focusNextAnnouncement(index);
}, 10);
};
function focusNextAnnouncement(index) {
var nxtAnnouncementEle = $('div.announcement-container .text-container');
if (nxtAnnouncementEle[index])
nxtAnnouncementEle[index].focus();
else {
if (index > 0)
focusNextAnnouncement(index-1);
else {
var skipLinkEle = $('.skip-link');
if (skipLinkEle.length > 0)
skipLinkEle[0].focus();
}
}
}
c.toggleShowAll = function($event) {
c.showAll = !c.showAll;
if (c.totalAnnouncements > 1) {
_updateCurrentAnnouncements();
c.showMore = c.showAll ? c.i18n.collapse : c.expandMoreCount;
}
else
c.showMore = c.showAll ? c.i18n.less : c.i18n.more;
if (!c.showAll) {
$window.scrollTo(0, 0);
if ($event.currentTarget.classList.contains('text-container'))
$('.text-container')[0].focus();
else
$('.sp-announcement-list-actions')[0].focus();
}
}
c.getStyle = function(announcement) {
var style = announcement.displayStyle || {};
return {
backgroundColor: style.backgroundColor || '#006ED5',
color: style.foregroundColor || '#ffffff',
textAlign: (style.alignment || 'left').toLowerCase()
};
};
c.getJustifyContentValue = function(announcement) {
return (announcement.displayStyle || {}).alignment === 'CENTER' ? 'center' : 'flex-start';
};
c.linkSetup = function(a) {
a.linkTarget = '_self';
if ('urlNew' === a.clickTarget) {
a.linkTarget = '_blank';
}
a.linkType = !a.targetLink ? 'none' : a.targetLinkText ? 'normal' : 'title';
};
spAnnouncement.subscribe($scope, _getCurrentAnnouncements);
_getCurrentAnnouncements();
if (c.totalAnnouncements === 1 && !c.announcements[0].targetLinkText && !c.announcements[0].summary) {
c.singleEmptyTitle = true;
}
$(document).ready(function() {
$('body').tooltip({
selector: '[data-toggle="tooltip"]'
});
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spNavStateManager.js */
angular.module('sn.$sp').factory('spNavStateManager', function($rootScope, $window, spConf, $q, spModal, i18n) {
'use strict';
var registeredForms = {};
function registerForm (tableName, saveFunction, g_form) {
registeredForms[tableName] = {'saveFunc': saveFunction, 'g_form': g_form};
return registeredForms[tableName];
}
function onRecordChange() {
var dirtyFormsArray = _getDirtyArrayFromArgs();
if(dirtyFormsArray.length !== 0) {
return showModal(dirtyFormsArray);
} else {
return $q.when(true);
}
}
function showModal(dirtyTableNames) {
return spModal.open({
title:i18n.getMessage("Save Changes"),
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0},
message: i18n.getMessage("Do you want to save your changes before leaving this page?"),
buttons: [
{label: i18n.getMessage("Discard"), value: "discard"},
{label: i18n.getMessage("Save"), primary: true, value: "save"}
]
}).then(function(confirm) {
if(confirm.value == "save") {
for (var tn in dirtyTableNames) {
var tableName = dirtyTableNames[tn];
registeredForms[tableName].saveFunc();
}
}
for (var i in dirtyTableNames) {
var tableName = dirtyTableNames[i];
registeredForms[tableName].g_form.$private.userState.clearModifiedFields();
}
});
}
function _getDirtyArrayFromArgs() {
if (!g_dirty_form_warning_enabled)
return [];
var dirtyFormsArray = [];
var tables = Array.prototype.slice.call(arguments, 0);
if (tables.length === 0) {
tables = Object.keys(registeredForms);
}
for (var t in tables) {
var tableName = tables[t];
if (registeredForms[tableName] && registeredForms[tableName].g_form.isUserModified()){
dirtyFormsArray.push(tableName);
}
}
return dirtyFormsArray;
}
function _getDirtyTables() {
if (!g_dirty_form_warning_enabled)
return [];
var dirtyTables = [];
Object.keys(registeredForms).forEach(function(tableName) {
var form = registeredForms[tableName];
if (form.g_form.isUserModified()) {
dirtyTables.push(tableName);
}
});
return dirtyTables;
}
$rootScope.$on('$locationChangeStart', function(event, next) {
var dirtyTables = _getDirtyTables();
if (dirtyTables.length > 0) {
event.preventDefault();
showModal(dirtyTables).then(function() {
window.location = next;
});
}
});
$window.onbeforeunload = function(event) {
var dirtyTables = _getDirtyTables();
if (dirtyTables.length > 0) {
event.returnValue = "";
}
}
return {
_getDirtyArrayFromArgs: _getDirtyArrayFromArgs,
onRecordChange: onRecordChange,
register: registerForm
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spMetatags.js */
angular.module('sn.$sp').factory('spMetatagService', function() {
'use strict';
var metatagMap = {};
var seoMap = {};
var subscribeCallbackArr = [];
var subscribeCallbackArrSEO = [];
function notifySubscribers() {
for (var i = 0; i < subscribeCallbackArr.length; i++)
subscribeCallbackArr[i](metatagMap);
}
function notifySubscribersSEO() {
for (var i = 0; i < subscribeCallbackArrSEO.length; i++)
subscribeCallbackArrSEO[i](seoMap);
}
return {
setTags: function(tagArr) {
metatagMap = {};
if (tagArr && tagArr.length) {
for (var i = 0; i < tagArr.length; i++)
metatagMap[tagArr[i].name] = tagArr[i].content;
}
notifySubscribers();
},
setSeoTags: function(tagArr) {
seoMap = tagArr[0];
notifySubscribersSEO();
},
subscribe: function(callback) {
subscribeCallbackArr.push(callback);
},
subscribeSEO: function(callback) {
subscribeCallbackArrSEO.push(callback);
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spMetatags.js */
angular.module('sn.$sp').directive('spMetatags', function(spMetatagService, $window) {
return {
restrict: 'A',
link: function(scope, elem, attr) {
spMetatagService.subscribe(function(tags) {
elem.find("[custom-tag]").remove();
for(var key in tags){
var tagElement = $window.document.createElement("meta");
tagElement.setAttribute("custom-tag", "");
tagElement.setAttribute("name", key);
tagElement.setAttribute("content", tags[key]);
elem.append(tagElement);
}
});
spMetatagService.subscribeSEO(function (seoMap) {
if (!seoMap)
return;
canonicalURL(seoMap.canonicalURL);
hrefLangTags(seoMap.hrefLangs);
customseoTags(seoMap.customSEOTags);
function canonicalURL(canonicalURL) {
if (!canonicalURL)
return;
var tagElement = $window.document.createElement("link");
tagElement.setAttribute("custom-tag", "");
tagElement.setAttribute("rel", "canonical");
tagElement.setAttribute("href", canonicalURL);
elem.append(tagElement);
}
function hrefLangTags(hrefLangs) {
if (!hrefLangs)
return;
try {
var hrefLangsArr = JSON.parse(hrefLangs);
for (var i = 0; i < hrefLangsArr.length; i++) {
var tagElement = $window.document.createElement("link");
tagElement.setAttribute("custom-tag", "");
tagElement.setAttribute("rel", "alternate");
tagElement.setAttribute("hreflang", hrefLangsArr[i].locale);
tagElement.setAttribute("href", hrefLangsArr[i].href);
elem.append(tagElement);
}
} catch (err) {}
}
function customseoTags(customSEOTags) {
if (!customSEOTags)
return;
try {
var customSEOTagsArr = JSON.parse(customSEOTags);
for (var i = 0; i < customSEOTagsArr.length; i++) {
var div = $window.document.createElement("div");
div.innerHTML = customSEOTagsArr[i].trim();
elem.append(div.firstChild);
}
} catch (err) {}
}
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spUIActionsExecuter.js */
angular.module('sn.$sp').factory('spUIActionsExecuter', function($q, glideUIActionsApi, spModal, i18n, $http, spAuthentication, glideUserSession, cabrillo, spAuthModal, spNotificationEvents, spUtil, $window) {
'use strict';
var NOW_REAUTHENTICATE_CODE = 'NOW.REAUTHENTICATE';
function closeEsigWindow() {
if (window.NOW.esigWin && !window.NOW.esigWin.closed)
window.NOW.esigWin.close();
}
function executeListAction(actionSysId, tableName, recordSysId, requestParams) {
return execute(actionSysId, 'list', tableName, recordSysId, undefined, undefined, requestParams)
}
function executeFormAction(actionSysId, tableName, recordSysId, fields, encodedRecord, requestParams) {
return execute(actionSysId, 'form', tableName, recordSysId, fields, encodedRecord, requestParams);
}
function execute(actionSysId, type, tableName, recordSysId, fields, encodedRecord, requestParams) {
var $request = glideUIActionsApi.execute(
actionSysId,
type,
tableName,
recordSysId,
fields,
encodedRecord,
requestParams
);
if ((!window.NOW.esigWin || window.NOW.esigWin.closed) && tableName === "sysapproval_approver" &&
!cabrillo.isNative() && spUtil.isMobile() && $window.g_sso_open_in_window &&
($window.g_user_login_method === 'saml' || $window.g_user_login_method === 'multisso' || $window.g_user_login_method === 'oidc'))
window.NOW.esigWin = window.open('');
return $request.then(function(response) {
var result = response.data.result,
username = requestParams.username,
userSysId = requestParams.userSysId;
return retrieveSessionMessages().then(function(sessionMessagesResponse) {
spNotificationEvents.addMessages(sessionMessagesResponse.data.result.$$uiNotification);
if (result.response_code === NOW_REAUTHENTICATE_CODE) {
return spAuthModal.prompt(requestParams, username, userSysId).then(function() {
spNotificationEvents.clearMessages();
if (!angular.isDefined(requestParams)) {
requestParams = {};
}
requestParams[NOW_REAUTHENTICATE_CODE] = userSysId;
closeEsigWindow();
return execute(
actionSysId,
type,
tableName,
recordSysId,
fields,
encodedRecord,
requestParams
);
}, function() {
console.error("Re-auth failed");
closeEsigWindow();
});
} else
closeEsigWindow();
})
});
}
function retrieveSessionMessages() {
return $http({
method: 'GET',
url: '/api/now/sp/sessionuinotifications'
});
}
return {
executeListAction: executeListAction,
executeFormAction: executeFormAction
};
});
;
/*! RESOURCE: /scripts/app.$sp/provider.spEsignature.js */
angular.module('sn.$sp').provider('spEsignature', function() {
'use strict';
this.$get = function spEsignature($q, $http, $window, urlTools, xmlUtil) {
var w = window;
var esignOW;
var windowWidth;
var windowHeight;
var loginURL;
function initiateEsignature() {
var postParams = {
sysparm_scope: 'global',
sysparm_processor: 'ESignatureAuthUtils',
sysparm_name: 'fetchAuthDetails'
}
return $http({
method: 'POST',
url: '/xmlhttp.do',
data: urlTools.encodeURIParameters(postParams),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
transformResponse: function(response) {
return xmlUtil.getDataFromXml(response, 'result');
}
}).then(
function(response) {
var data = response.data ? response.data[0] : {};
process(data);
});
}
function process(data) {
var shouldLogoutFirst = data.logoutFirst === 'true';
w['windowHeight'] = data.popup_window_height;
w['windowWidth'] = data.popup_window_width;
w['loginURL'] = data.loginURL;
if (window.NOW.esigWin)
w['esignOW'] = window.NOW.esigWin;
if (shouldLogoutFirst)
openEsignatureWindow(data.logoutURL);
else
authenticate();
}
function openEsignatureWindow(url) {
if (w['esignOW'] && !w['esignOW'].closed)
w['esignOW'].location.href = url;
else
w['esignOW'] = window.open(url, 'esignatureAuthentication',
'height='+w['windowHeight']+',width='+w['windowWidth']+',top=100,left=100,toolbar=0,location=0,menubar=0');
}
w['authenticate'] = function(){
if (w['loginURL'])
openEsignatureWindow(w['loginURL']);
};
w['evaluateRedirect'] = function(msg) {
w['esignOW'].close();
if (msg == "oidc login complete" || msg == "saml2 login complete")
$window.onReauthenticationComplete(msg);
};
return {
initiateEsignature: initiateEsignature
};
};
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAuthentication.js */
angular.module('sn.$sp').factory('spAuthentication', function($window, $q, $http, spUtil, i18n) {
'use strict';
var genericError = i18n.getMessage('There was an error processing your request');
var sessionUsername = $window.NOW.user_name;
var authEndpoint = spUtil.getURL({
sysparm_type: 'view_form.login'
});
function _success() {
return $q(function(resolve) {
resolve({
success: true
});
});
}
function _error(message) {
return $q(function(resolve) {
resolve({
success: false,
message: message || genericError
});
});
}
function _authenticate(username, password, additionalOptions) {
var options = {
'sysparm_type': 'login',
'ni.nolog.user_password': true,
'user_name': username,
'user_password': password
};
return $http({
method: 'post',
url: authEndpoint,
data: $.param(_.extend({}, options, additionalOptions || {})),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(function(response) {
if (!response.data) {
return _error();
}
if (response.data.status !== 'success') {
return _error(response.data.message);
}
return _success();
}, function(error) {
return _error();
});
}
function _validate(username, password) {
if (username !== sessionUsername) {
return _error(i18n.getMessage('Specified username does not match with the username of currently logged in user'));
}
return _authenticate(username, password);
}
return {
validateCreds: _validate
};
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAuthModal.js */
angular.module('sn.$sp').factory('spAuthModal', function($q, spModal, i18n, $http, spAuthentication, glideUserSession, cabrillo, $cookies, $window, spUtil, $uibModal, spEsignature) {
"use strict";
function _showAuthenticationModal(requestParams, username, userSysId) {
var currentUser;
var deferred = $q.defer();
glideUserSession.loadCurrentUser({reload: true}).then(function(user) {
if (!user) {
deferred.reject({
error: {
status: 'ANONYMOUS',
message: i18n.getMessage('Not logged in')
}
});
return;
}
currentUser = user;
var serializedUser = {
sysId: currentUser.userID,
userName: currentUser.userName,
firstName: currentUser.firstName,
lastName: currentUser.lastName
};
if (cabrillo.isNative()) {
cabrillo.auth.reauthenticate(currentUser).then(function() {
deferred.resolve(serializedUser);
}, function(error) {
if (error && error.status) {
deferred.reject({
error: error
});
}
deferred.reject();
});
return;
}
var loginMethod = currentUser.$private.loginMethod;
if (!loginMethod) {
var providerSysId = $cookies.get('glide_sso_id');
loginMethod = providerSysId ? 'multisso' : 'db';
}
if (loginMethod === 'saml' || loginMethod === 'oidc' || loginMethod === 'multisso') {
var modal;
if ($window.g_sso_open_in_window) {
spEsignature.initiateEsignature();
} else {
glideUserSession.getSsoReauthenticationUrl().then(function(url) {
requestParams.externalLoginURL = url;
openExternalAuthModal(requestParams).then(function(m) {
modal = m;
});
});
}
$window.onReauthenticationComplete = function(result) {
deferred.resolve(serializedUser);
if (modal)
modal.close();
};
} else {
spModal.open({
title:i18n.getMessage("Approver authentication"),
message:i18n.getMessage("Additional authentication is required, enter your usename and password to continue."),
footerStyle: {border: 'none', 'padding-top': 0},
widget: 'simpleloginui',
widgetInput: {},
shared: requestParams,
onSubmit: function() {
return onLoginModalSubmit(requestParams, username);
}
}).then(function(confirm) {
if (confirm.label == i18n.getMessage("OK")) {
deferred.resolve(serializedUser);
} else {
deferred.reject();
}
});
}
});
return deferred.promise;
}
function onLoginModalSubmit(requestParams, username) {
return $q(function(resolve, reject) {
var errorMessage = null;
if(!requestParams.username || requestParams.username.trim() === "" ||
!requestParams.password || requestParams.password.trim() === "") {
errorMessage = i18n.getMessage("User name or password invalid");
} else if(requestParams.username !== username) {
errorMessage = i18n.getMessage("Attempted to authenticate as a different user");
}
if(!errorMessage || errorMessage === "") {
spAuthentication.validateCreds(requestParams.username, requestParams.password).then(function(res) {
resolve({status: res.success, errorMessage: res.message});
});
} else {
resolve({status: !errorMessage || errorMessage === "", errorMessage: errorMessage});
}
});
}
function openExternalAuthModal(requestParams) {
var deferred = $q.defer();
var options = {
title: i18n.getMessage("Approver authentication"),
message: '',
messageOnly: false,
errorMessage: '',
input: false,
label: '',
size: 'lg',
value: '',
required: false,
footerStyle: {border: 'none', 'padding-top': 0},
values: false,
onSubmit: null,
widget: 'simpleloginui',
widgetInput: {},
shared: requestParams,
buttons: [{label: i18n.getMessage('Cancel'), cancel:true}]
};
var widgetURL = spUtil.getWidgetURL(options.widget);
$http.post(widgetURL, options.widgetInput).success(function(response) {
options.widget = response.result;
options.widget.options.shared = options.shared;
var modal = $uibModal.open({
templateUrl:'sp-modal.html',
controller: spModalCtrl,
size: options.size,
resolve: {
options: function() {
return options;
}
}
});
deferred.resolve(modal);
});
return deferred.promise;
}
function spModalCtrl($scope, options) {
$scope.options = options;
$scope.form = {};
$scope.buttonClicked = function(button){
if (button.cancel) {
$scope.$dismiss();
return;
}
}
}
return {
prompt: _showAuthenticationModal
}
})
;
/*! RESOURCE: /scripts/app.$sp/directive.spPauseChildWatchersIfHidden.js */
angular.module("sn.$sp").directive('spPauseChildWatchersIfHidden', function () {
return {
link: function (scope, element, attrs) {
var count = 0;
scope.$watch(function(){return !element.is(':visible');}, function (newVal) {
if (newVal) {
toggleChildrenWatchers(element, true);
} else {
toggleChildrenWatchers(element, false);
}
});
function toggleChildrenWatchers(element, pause) {
$.each(element.children(), function (j, childElement) {
toggleAllWatchers(angular.element(childElement), pause);
});
}
function toggleAllWatchers(element, pause) {
var data = element.data();
if (data.hasOwnProperty('$scope') && data.$scope.hasOwnProperty('$$watchers') && data.$scope.$$watchers) {
if (pause) {
data._bk_$$watchers = [];
$.each(data.$scope.$$watchers, function (i, watcher) {
var temp = {};
$.extend(true, temp, watcher);
data._bk_$$watchers.push(temp);
});
data.$scope.$$watchers = [];
} else {
if (data.hasOwnProperty('_bk_$$watchers')) {
count += data._bk_$$watchers.length;
$.each(data._bk_$$watchers, function (i, watcher) {
var temp = {};
$.extend(true, temp, watcher)
data.$scope.$$watchers.push(temp)
});
}
}
}
toggleChildrenWatchers(element, pause);
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spGtd.js */
angular.module('sn.$sp').factory('spGtd', function($q, $http, $rootScope, spUtil, i18n) {
"use strict";
var url = '/api/now/guided_tours/tours';
var guidedToursAPIEvents = {
TOUR_STARTED   : 'tourStarted',
STEP_STARTED   : 'stepStarted',
TOUR_ABANDONED : 'tourAbandoned',
TOUR_FAILED    : 'tourFailed',
TOUR_COMPLETED : 'tourCompleted',
TOUR_ENDED     : 'tourEnded',
TOUR_DISMISSED : 'tourDismissed',
GET_ALL_TOURS : 'getAllTours'
};
var tourServiceEvents = {
tourStarted : 'tourStarted',
stepStarted : 'step_started',
abandoned 	: 'abandoned',
failed		: 'failed',
completed 	: 'completed',
tourEnded 	: 'tourEnded',
dismissed 	: 'dismissed'
}
var webAEventStream = 'gtd_client_api_event';
try {
top.NOW = top.NOW || {};
top.NOW.gtdConfig = top.NOW.gtdConfig || {
servicePortalTours: true,
displayMessage: {
info :  function(msg){ spUtil.addInfoMessage(msg); },
error: function(msg) { spUtil.addErrorMessage(msg); }
},
i18n: i18n
};
top.NOW.guided_tours = top.NOW.guided_tours || getGuidedToursClientAPI();
} catch(e) {
return {
getToursForPage: function(){
var defer = $q.defer();
defer.reject();
return defer.promise;
},
launch: function(){
}
};
}
$rootScope.$on('$locationChangeSuccess', function(e, newUrl, oldUrl) {
if (top.NOW && top.NOW.guidedToursService) {
top.NOW.gtdConfig.tours = null;
top.NOW.gtdConfig.state = null;
top.NOW.gtdConfig.portal_id = null;
top.NOW.gtdConfig.page_id = null;
top.NOW.guidedToursService.setConfig(top.NOW.gtdConfig);
}
});
function _getTourData(portal, page, context) {
var defer = $q.defer();
$http({
method: 'GET',
url: url,
params: {page_id: page, portal_id: portal, type: 'service_portal', context: context}
}).then(function(response) {
defer.resolve(response.data.result);
}, function(err) {
defer.reject(err);
});
return defer.promise;
}
function _loadScript(options, tours, state) {
top.NOW.gtdConfig.tours = tours;
top.NOW.gtdConfig.state = state;
top.NOW.gtdConfig.portal_id = options.portal.sys_id;
top.NOW.gtdConfig.page_id = options.page.sys_id;
if (!top.NOW.guidedToursService) {
_insertPlayerScript();
} else {
top.NOW.guidedToursService.setConfig(top.NOW.gtdConfig);
top.NOW.guidedToursService.trigger('check-autolaunch', {location:window.location, config: top.NOW.gtdConfig})
}
}
function getUrlParams(str) {
var containsParameter = str.indexOf('?') >= 0 ;
var sp = null, params = [], kvpair = null;
if (containsParameter) {
sp = str.split('?');
if (sp.length > 1) {
params = sp[1].split('&').map(function(kv) {
kvpair = kv.split('=');
return {name: kvpair[0], value: kvpair[1] ? kvpair[1] : null}
});
}
}
return params;
}
function getUrlParameterWithName(str, name) {
var result = null;
var params = getUrlParams(str);
for(var i=0; i<params.length; i++) {
if (params[i].name === name) {
result = params[i];
break;
}
}
return result;
}
function isAdditonalParamsMatched(context, url){
var defaultPrams = ['gtd_portal_title', 'gtd_page_title', 'id'];
var additionalParams = getUrlParams(context).filter(function(item){
return defaultPrams.indexOf(item.name) === -1;
});
for(var i=0; i < additionalParams.length; i++){
var param = additionalParams[i];
var urlParm = param && param.name ? getUrlParameterWithName(url,param.name) : '';
if((urlParm && urlParm.value) !== param.value)
return false;
}
return true;
}
function getToursForPage(options) {
var defer = $q.defer();
var state = null;
if (sessionStorage) {
state = sessionStorage.getItem('guided_tour:tour.state') || location.href.indexOf('gtd_preview_tour_id') >= 0;
if (state) {
_loadScript(options, null, state);
}
}
if(!options || !options.page || !options.user || !options.portal) {
defer.reject();
} else {
var context = document.location.href.replace(/^.*\/\/[^\\/]+/, '');
_getTourData(options.portal.sys_id, options.page.sys_id, context).then(
function(data){
var url = document.location.href;
var pageid = getUrlParameterWithName(url, 'id');
var filterByPageId = (pageid && pageid.value);
var tourOptions = null;
data = data.filter(function(t) {
if(!isAdditonalParamsMatched(t.context, url))
return false;
var contt = getUrlParameterWithName(t.context, 'id');
if (filterByPageId) {
if (contt.value === pageid.value) return true;
if (t.options) {
try {
tourOptions = JSON.parse(t.options);
if (tourOptions.isMapped && tourOptions.actualContext === contt.value) {
return true;
}
} catch(e) {
return false;
}
}
return false;
}
return true;
});
if (!state && data && data.length) {
_loadScript(options, data, state);
}
if(data && data.length) {
var autoLaunchTour = {
isTourPresent: false
};
for(var i=0; i<data.length; i++) {
if(data[i].isAutoLaunchable) {
autoLaunchTour["name"] = data[i].name;
autoLaunchTour["options"] = data[i].options;
autoLaunchTour["type"] = data[i].type;
autoLaunchTour["tourId"] = data[i].sysID;
autoLaunchTour["isTourPresent"] = true;
break;
}
}
sessionStorage.setItem("guided_tour:autolaunchable", JSON.stringify(autoLaunchTour));
}
defer.resolve(data);
}, function(){
defer.reject();
});
}
return defer.promise;
}
function launch(tourId) {
if (top.NOW && top.NOW.guidedToursService) {
top.NOW.guidedToursService.startTour(tourId, 0);
}
}
function getGuidedToursClientAPI(){
var GuidedToursClientAPI = {
api: {
startTour: _startTour,
endTour: _endTour,
applyListFilter: _applyListFilter,
getAllTours: _getAllTours,
loadPlayer: _loadPlayer
},
events : {
on: _on,
off: _off
},
_filterFunc: null,
_tourService: null,
_registerEvents: _registerEvents
};
return GuidedToursClientAPI;
}
function _startTour(sysId, stepNum, cb){
_trigger(webAEventStream, {payload:sysId, event:guidedToursAPIEvents.TOUR_STARTED});
if(!top.NOW.guided_tours._tourService)
return;
stepNum = (stepNum) ? stepNum : 0;
if(top.NOW.guided_tours._tourService.currentTour){
cb && cb({success: false, message: i18n.getMessage("Cannot start a new tour while another tour is in progress.")})
return;
}
top.NOW.guided_tours._tourService.startTour(sysId, stepNum, cb);
}
function _endTour(){
var  _tourService = top.NOW.guided_tours._tourService;
if(!_tourService)
return;
var sys_id = _tourService && _tourService.currentTour && _tourService.currentTour.sys_id;
_trigger(webAEventStream, {payload:sys_id, event:guidedToursAPIEvents.TOUR_ENDED});
_tourService.endTour();
}
function _applyListFilter(filterFunc){
top.NOW.guided_tours._filterFunc = filterFunc;
}
function _getAllTours(cb){
if(!top.NOW.guided_tours._tourService)
return;
_trigger(webAEventStream, {payload:'', event:guidedToursAPIEvents.GET_ALL_TOURS});
var toursList = [];
var filterFunc;
getToursForPage({portal: $rootScope.portal, page: $rootScope.page, user: $rootScope.user}).then(
function(data){
toursList = data;
try{
filterFunc = top.NOW.guided_tours._filterFunc;
if(filterFunc)
toursList = toursList.filter(filterFunc);
return cb && cb(null, toursList);
} catch(err){
cb && cb(err);
}
}, function(){
defer.reject;
});
}
function _loadPlayer() {
try {
if (top === window) {
if (NOW && NOW.guidedToursService) {
} else {
_insertPlayerScript();
}
}
} catch(e) {
console && console.log('An error has occured. Guided Tours could not be loaded!');
}
}
function _registerEvents(service){
var GT_API = top.NOW.guided_tours;
GT_API._tourService = service;
GT_API._tourService.on(tourServiceEvents.tourStarted, function(args) {_trigger(guidedToursAPIEvents.TOUR_STARTED, args);});
GT_API._tourService.on(tourServiceEvents.stepStarted, function(args) {_trigger(guidedToursAPIEvents.STEP_STARTED, args);});
GT_API._tourService.on(tourServiceEvents.abandoned, function(args) {_trigger(guidedToursAPIEvents.TOUR_ABANDONED, args);});
GT_API._tourService.on(tourServiceEvents.failed, function(args) {_trigger(guidedToursAPIEvents.TOUR_FAILED, args);});
GT_API._tourService.on(tourServiceEvents.completed, function(args) {_trigger(guidedToursAPIEvents.TOUR_COMPLETED, args);});
GT_API._tourService.on(tourServiceEvents.tourEnded, function(args) {_trigger(guidedToursAPIEvents.TOUR_ENDED, args);});
GT_API._tourService.on(tourServiceEvents.dismissed, function(args) {_trigger(guidedToursAPIEvents.TOUR_DISMISSED, args);});
}
function _on(event, cbFunc){
if(CustomEvent)
CustomEvent.on(event, cbFunc);
}
function _off(event, func){
if(CustomEvent)
if(!func || typeof func!== 'function')
CustomEvent.unAll(event);
else
CustomEvent.un(event, func);
}
function _trigger(event, args){
CustomEvent.fireTop(event, args);
}
function _insertPlayerScript(){
var script = document.createElement('script');
script.src = '/scripts/app.guided_tours/guided_tours_player.js?v=' + g_builddate;
script.type = 'text/javascript';
script.async = 'true';
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
}
return {
getToursForPage: getToursForPage,
launch: launch
};
});
;
/*! RESOURCE: /scripts/app.$sp/service.spFacets.js */
angular.module('sn.$sp').factory('spFacetsClientService', function($rootScope, $location, $http, $q, spFacetManager) {
'use strict';
function _search(params) {
return $http.post('/api/now/sp/search', params)
.then(function successCallback(response) {
if(params.include_facets) {
spFacetManager.notify(response);
}
if (response.data.result) {
var notifications = {};
response.data.result.$$uiNotification.forEach(function (notification) {
if(!notifications[notification.message]) {
notifications[notification.message] = notification;
}
});
if(!params.include_facets) {
$rootScope.$broadcast('$$uiNotification', _.values(notifications));
}
}
return $q.when(response);
}, function errorCallback(response) {
});
}
return {
search: function(params) {
return _search(params);
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAtf.js */
angular.module('sn.$sp').factory('spAtf', function ($q, $http, $rootScope) {
'use strict';
var _atf;
function _getAtfManager(atf) {
function _triggerPageLoaded() {
if (atf.triggerPortalPageLoaded) {
atf.triggerPortalPageLoaded();
}
}
function _expose(name, obj) {
window[name] = obj;
}
return {
triggerPageLoaded: _triggerPageLoaded,
expose: _expose
};
}
function _augmentForm(g_form) {
var oriFieldValues = {};
function gel(id) {
if (typeof id != 'string') {
return id;
}
return document.getElementById(id);
}
function _getReferenceTable(field) {
var referenceTable = field.ed ? field.ed.reference : undefined;
if (typeof referenceTable === 'undefined') {
referenceTable = field.refTable;
}
if (typeof referenceTable === 'undefined') {
referenceTable = field.ref_table;
}
return referenceTable;
}
g_form.getParameter = function (param) {
if (!(param.substr(0, 8) == 'sysparm_')) {
param = 'sysparm_' + param;
}
var pcel = gel(param);
return pcel ? pcel.value : '';
};
g_form.getFormElement = function () {
return gel(g_form.getTableName() + '.do');
};
g_form.isChoiceField = function (fieldName) {
var field = g_form.getField(fieldName);
return field && (field.type === 'choice' || field.type === 'multiple_choice');
};
g_form.isValidChoice = function (fieldName, value) {
var field = g_form.getField(fieldName);
var choices = field.choices || [];
for (var i = 0; i < choices.length; i++) {
if (choices[i].value === value) {
return true;
}
}
return false;
};
g_form.getRef = function (fieldName, callback) {
if (!callback) {
_logWarn('GETREF:NOCB', 'Mobile scripts must specify a callback function');
return;
}
var field = g_form.getField(fieldName);
if (!field) {
_logWarn('GETREF:FNF', 'Field not found: ' + fieldName);
return;
}
var table = _getReferenceTable(field);
var referenceKey = field.reference_key ? field.reference_key : 'sys_id';
var url = '/api/now/table/' + table + '?sysparm_query=' + encodeURIComponent(referenceKey + '=' + field.value) + '&sysparm_fields=sys_id&sysparm_limit=1';
$http.get(url).then(function (res) {
if (res.data.result && res.data.result.length === 1) {
return callback(res.data.result[0]);
}
callback({ _error: 'No matching record found' });
}, function (res) {
callback({ _error: res.data.error.message });
});
};
g_form.serializeToString = function () {
var tableName = g_form.getTableName();
var serialized = [
'sys_target=' + tableName,
'sys_uniqueValue=' + g_form.getUniqueValue()
];
g_form.serialize().forEach(function (f) {
var key = tableName + '.' + f.ed.name;
serialized.push('sys_original.' + key + '=' + encodeURIComponent((oriFieldValues[f.ed.name] || f).value));
serialized.push(key + '=' + encodeURIComponent(f.value));
});
return serialized.join('&');
};
g_form.atfSubmit = function(sysId) {
var action = sysId.length > 2 ? 'sysverb_update' : 'sysverb_insert';
var deferred = $q.defer();
g_form.submit(action);
var cleanUp = $rootScope.$on('sp.form.submitted', function(o, result) {
cleanUp();
deferred.resolve(result);
});
return deferred.promise;
};
g_form.$private.events.on('onChange', function (fieldName, oldValue) {
oriFieldValues[fieldName] = { value: oldValue };
});
return g_form;
}
function _init() {
if (_atf) {
return $q(function (resolve) {
resolve(_getAtfManager(_atf));
});
}
if (window.ATF) {
_atf = window.ATF;
return $q(function (resolve) {
resolve(_getAtfManager(_atf));
});
} else if (window.frameElement && window.frameElement.id === "testFrame") {
window.ATF = {};
window.ATF.portalPageLoaded = true;
}
return $q(function (resolve, reject) {
reject();
});
}
return {
init: _init,
augmentForm: _augmentForm
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spFacetPill.js */
angular.module('sn.$sp').directive('spFacetPill', function(spFacetManager, spAriaUtil) {
return {
restrict: 'E',
replace: true,
scope: {
facet: '='
},
template: '<div class="sp-facet-pill label label-as-badge label-primary" ng-class="{ \'active\': c.focused}"><span>{{::facet.label}}</span><span class="pull-right"><i class="fa fa-close" ng-focus="c.onFocus()" ng-blur="c.onBlur()" ng-click="c.removePill()" aria-label="{{::c.removeLabel}}" role="button" tabindex="0"></i></span></div>',
controllerAs: 'c',
controller: function($scope, i18n) {
var c = this;
c.removeLabel = i18n.getMessage('Remove {0} facet filter').withValues([$scope.facet.label]);
var facetRemovedMsg = i18n.getMessage('Facet removed, search results updated');
c.removePill = function() {
spFacetManager.clearFacetValue($scope.facet.id, $scope.facet.item.value);
spAriaUtil.sendLiveMessage(facetRemovedMsg);
}
c.onFocus = function() {
c.focused = true;
}
c.onBlur = function() {
c.focused = false;
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spSearchNav.js */
angular.module('sn.$sp').directive('spSearchNav', function(i18n, $location, spFacetManager) {
return {
restrict: 'E',
replace: true,
scope: {
searchSources: '=',
q: '=',
t: '=',
listView: '=',
showToggle: '='
},
templateUrl: 'sp_search_nav.xml',
controllerAs: 'c',
controller: function($scope) {
var c = this;
c.i18n = {
all: i18n.getMessage('All'),
sources: i18n.getMessage('Sources'),
search_categories: i18n.getMessage('Search Categories')
};
c.searchSources = getSearchSources($scope.searchSources);
$scope.$on('$locationChangeSuccess', onLocationChangeSuccess);
function onLocationChangeSuccess(event, newUrl, oldUrl) {
var page = pageChanged(newUrl, oldUrl);
if(!pageChanged(newUrl, oldUrl) && searchSourceChanged(newUrl, oldUrl)) {
var newUrlParams = newUrl.match(/t=.+/);
if(!newUrlParams) {
updateSelectedSearchSource(null);
} else {
updateSelectedSearchSource(newUrlParams[0].split("&")[0].substring(2));
}
}
}
function pageChanged(newUrl, oldUrl) {
var newUrlParams = newUrl.match(/id=.+/),
oldUrlParams = oldUrl.match(/id=.+/);
if(!newUrlParams && !oldUrlParams) {
return false;
}
if((!newUrlParams && oldUrlParams) || (newUrlParams && !oldUrlParams)) {
return true;
}
return newUrlParams[0].split("&")[0] !== oldUrlParams[0].split("&")[0];
}
function searchSourceChanged(newUrl, oldUrl) {
var newUrlParams = newUrl.match(/t=.+/),
oldUrlParams = oldUrl.match(/t=.+/);
if(!newUrlParams && !oldUrlParams) {
return false;
}
if((!newUrlParams && oldUrlParams) || (newUrlParams && !oldUrlParams)) {
return true;
}
return newUrlParams[0].split("&")[0] !== oldUrlParams[0].split("&")[0];
}
c.onSearchSourceClick = function(menu, input) {
spFacetManager.clearAllFacet();
$location.search("spa","1");
$location.search("q", $scope.q);
if(input && input.value) {
$location.search("t", input.value);
} else {
$location.search("t", null);
}
updateSelectedSearchSource(input.value);
};
function updateSelectedSearchSource(value) {
var items = c.searchSources.items;
if(value) {
items.forEach(function(searchSource) {
if(searchSource.value === value) {
searchSource.selected = true;
} else {
searchSource.selected = false;
}
});
} else {
items.forEach(function(searchSource) {
if(!searchSource.value) {
searchSource.selected = true;
} else {
searchSource.selected = false;
}
});
}
c.searchSources.items = items;
}
function getSearchSources(data) {
return {
label: c.i18n.sources,
id: 'searchSources',
items: getSearchSourceItems(data)
};
}
function getSearchSourceItems(data) {
var values = _.values(data),
sources = [];
values.forEach(function(value) {
sources.push({
label: value.name,
value: value.id,
selected: value.id == $scope.t,
order: value.order
});
})
sources.sort(function(a, b) {
return a.order - b.order;
});
sources.unshift({
label: c.i18n.all,
value: null,
selected: !$scope.t
});
return sources;
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spFacetList.js */
angular.module('sn.$sp').directive('spFacetList', function(i18n, spFacetManager, spAriaUtil) {
return {
restrict: 'E',
replace: true,
scope: {
listTitle: '=',
t: '=',
facets: '=',
loading: '=',
collapsed: '=',
collpasedMap: "=",
toggleSearchsource: '=',
collapsedSearchsource: '='
},
templateUrl: 'sp_facet_list.xml',
controllerAs: 'c',
controller: function($scope) {
var c = this;
c.showClearAll = shouldShowClearAll();
c.show = $scope.facets && $scope.facets.length !== 0;
c.collapsed = $scope.collapsedSearchsource;
$scope.$on('$locationChangeSuccess', onLocationChangeSuccess);
function onLocationChangeSuccess(event, newUrl, oldUrl) {
c.showClearAll = shouldShowClearAll();
}
function searchSourceChanged(newUrl, oldUrl) {
var newUrlParams = newUrl.match(/t=.+/),
oldUrlParams = oldUrl.match(/t=.+/);
if(!newUrlParams && !oldUrlParams) {
return false;
}
if((!newUrlParams && oldUrlParams) || (newUrlParams && !oldUrlParams)) {
return true;
}
return newUrlParams[0].split("&")[0] !== oldUrlParams[0].split("&")[0];
}
function shouldShowClearAll () {
for(var i = 0; i < $scope.facets.length; i++) {
if(spFacetManager.isFacetSelected($scope.facets[i].id, $scope.t)) {
return true;
}
}
return false;
}
c.toggleIcon = function(title) {
c.collapsed = !c.collapsed;
spFacetManager.publish("spSearchSources.toggle.data", {searchSource: $scope.t, collapsed: c.collapsed});
if (c.collapsed)
spAriaUtil.sendLiveMessage(c.i18n.isCollapsed.withValues([title]));
else
spAriaUtil.sendLiveMessage(c.i18n.isExpanded.withValues([title]));
};
c.i18n = {
clearAll: i18n.getMessage('Clear All'),
loading: i18n.getMessage('Loading'),
filterSelectionCleared: i18n.getMessage('filter selection has cleared for {0} and search results updated'),
filterSelected: i18n.getMessage('Filter selected {0} and search results updated'),
filterSelectedWithLabels: i18n.getMessage('Filter selected {0} {1} and search results updated'),
isCollapsed: i18n.getMessage('{0} is collapsed'),
isExpanded: i18n.getMessage('{0} is Expanded'),
allFacetsCleared: i18n.getMessage("All facets have been cleared, and search results have been updated"),
enabled: i18n.getMessage('Enabled'),
disabled: i18n.getMessage('Disabled')
};
c.showClear = function (facet) {
return spFacetManager.isFacetSelected(facet.id, $scope.t);
};
c.clearAll = function () {
spFacetManager.clearAllFacet();
spAriaUtil.sendLiveMessage(c.i18n.allFacetsCleared);
};
c.onSelectFacet = function (menu, input) {
if (Array.isArray(input)) {
var values = input.map(function(item) {
return item.value;
});
if($scope.t) {
spFacetManager.addFacetWithSearchSource($scope.t, menu.id, values);
} else {
spFacetManager.addFacet(menu.id, values);
}
spAriaUtil.sendLiveMessage(c.i18n.filterSelected.withValues([menu.label]));
} else {
var item = input;
if($scope.t) {
spFacetManager.addFacetWithSearchSource($scope.t, menu.id, item.value);
} else {
spFacetManager.addFacet(menu.id, item.value);
}
spAriaUtil.sendLiveMessage(c.i18n.filterSelectedWithLabels.withValues([menu.label, item.label]));
}
}
c.clearFacet = function(menu) {
spFacetManager.clearFacet(menu.id);
spAriaUtil.sendLiveMessage(c.i18n.filterSelectionCleared.withValues([menu.label]));
c.showClearAll = shouldShowClearAll();
}
c.isCollapsed = function(menuId) {
return $scope.collpasedMap && $scope.collpasedMap[menuId] !== undefined ? $scope.collpasedMap[menuId] : $scope.collapsed;
}
c.onFacetToggle = function(menuId, collapsed) {
spFacetManager.publish("spFacets.toggle.data", {searchSource: $scope.t, facetId: menuId, collapsed: collapsed});
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spFacetLists.js */
angular.module('sn.$sp').directive('spFacetLists', function(spFacetManager) {
return {
restrict: 'E',
replace: true,
scope: {
collapsed: '=',
collapsedSearchsource: '=',
toggleSearchsource: '=',
listTitle: '=',
searchSources: '='
},
template: '<div class="sp-facet-lists"><div ng-show="c.isLoading" class="loading-icon"><i class="fa fa-spinner fa-spin fa-3x fa-fw spinner-text-size"></i><span class="sr-only">{{::c.i18n.loading}}</span></div><div ng-show="c.show()"><div class="panel-heading heading"><h2 class="panel-title" aria-label="{{::listTitle}}">{{::listTitle}}</h2></div><div ng-repeat="data in c.facets"><sp-facet-list collapsed="collapsed" collpased-map="c.facetToogleMap[data.searchSource]" collapsed-searchsource="c.isSearchSourceCollapsed(data.searchSource)" toggle-searchsource="toggleSearchsource" facets="data.facets" list-title="searchSources[data.searchSource].name" t="data.searchSource"></sp-facet-list></div></div></div>',
controllerAs: 'c',
controller: function($scope) {
var c = this;
c.facetToogleMap = {};
c.searchSourceToggleMap = {};
spFacetManager.subscribe("spFacets.refresh.data", "list", onFacetsData);
spFacetManager.subscribe("spFacets.toggle.data", "list", onFacetToggle);
spFacetManager.subscribe("spSearchSources.toggle.data", "list", onSearchSourceToggle);
c.isLoading = true;
c.show = function () {
return !c.isLoading && !isEmpty(c.facetsObjectMap);
};
function onSearchSourceToggle (data) {
c.searchSourceToggleMap[data.searchSource] = data.collapsed;
}
function onFacetToggle (data) {
if(!c.facetToogleMap[data.searchSource]) {
c.facetToogleMap[data.searchSource] = {};
}
c.facetToogleMap[data.searchSource][data.facetId] = data.collapsed;
}
c.isCollapsed = function(searchSource, facetId) {
return c.facetToogleMap[searchSource] !== undefined && c.facetToogleMap[searchSource][facetId] !== undefined ? c.facetToogleMap[searchSource][menuId] : $scope.collapsed;
}
c.isSearchSourceCollapsed = function(searchSource) {
return c.searchSourceToggleMap[searchSource] !== undefined ? c.searchSourceToggleMap[searchSource] : $scope.collapsedSearchsource;
}
function isEmpty(facetsObjectMap) {
if(!facetsObjectMap) {
return true;
}
for(var searchSource in facetsObjectMap) {
if(facetsObjectMap[searchSource] && facetsObjectMap[searchSource].length > 0) {
return false;
}
}
return true;
}
function getFacets(facetsObjectMap) {
var facetArray = [];
for(var searchSource in facetsObjectMap) {
var data = {};
data.searchSource = searchSource;
data.facets = facetsObjectMap[searchSource];
data.order = $scope.searchSources[searchSource].order;
facetArray.push(data);
}
facetArray.sort(function(a, b) {
return a.order - b.order;
});
return facetArray;
}
function onFacetsData(params) {
c.facetsObjectMap= params.data;
c.facets = getFacets(c.facetsObjectMap);
c.isLoading = false;
updateFacet(params.query);
}
function updateFacet(queries) {
var keys = Object.keys(queries),
t = queries.t;
keys.forEach(function(k) {
var queryContent = queries[k];
var values = [];
if (queryContent.charAt(0) === '[' && queryContent.charAt(queryContent.length - 1) === ']') {
queryContent = queryContent.substring(1, queryContent.length - 1);
values = queryContent.split(",");
} else {
values.push(queryContent);
}
values.forEach(function(value) {
value = value.split("%2C").join(",");
var item = findItem(t, k, value);
if(item) {
item.selected = true;
c.showClearAll = true;
}
});
});
}
function findItem(t, key, value) {
var facets = c.facetsObjectMap[t];
if(facets && facets.length > 0) {
var f = facets.filter(function(d) {
return d.id === key;
});
if(f && f.length > 0) {
var item = f[0].items.filter(function(i) {
return i.value === value;
});
return item[0];
}
return null;
}
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spListMenu.js */
angular.module('sn.$sp').directive('spListMenu', function(i18n, spAriaUtil, $window, $timeout) {
return {
restrict: 'E',
replace: true,
scope: {
onclickFn: '&',
onclearFn: '&',
ontoggleFn: '&',
showClear: '=',
listView: '=',
showToggle: '=',
collapsed: '=',
menu: '='
},
link: function(scope, element, attrs, ctrl) {
if ( scope.menu.id === $window.facetId) {
$window.facetId = false;
$timeout(function() {
var ele = $("div[data-menu-id=" + scope.menu.id + "]").filter(":visible")[0];
ele =  $(ele).find('.panel-title').find('button');
if (ele.length > 0) {
$(ele[0]).focus();
}
});
}
},
templateUrl: 'sp_list_menu.xml',
controllerAs: 'c',
controller: function($scope) {
var MULTI_SELECT = "MULTI_SELECT";
var c = this;
var selectedItems = computeSelectedItems();
var initialSelectedItems = selectedItems;
c.selectionIsDirty = false;
c.isMultiSelect = $scope.menu.type === MULTI_SELECT;
c.onItemClickFn = function(menu, item) {
if (!c.isMultiSelect && item.selected)
return;
item.selected = !item.selected;
selectedItems = (c.isMultiSelect) ? computeSelectedItems() : item;
if (!c.isMultiSelect)
c.submit();
};
c.submit = function() {
if (selectedItems.length == 0)
c.clear();
else {
c.setCurrentFacetId();
$scope.onclickFn({
menu: $scope.menu,
input: selectedItems
});
}
}
c.clear = function() {
c.setCurrentFacetId();
$scope.onclearFn({
menu: $scope.menu
});
};
c.setCurrentFacetId = function() {
$window.facetId = $scope.menu.id;
}
c.show = function () {
return $scope.menu && $scope.menu.items && $scope.menu.items.length > 0;
};
c.i18n = {
clear:  i18n.getMessage('Clear'),
apply:  i18n.getMessage('Apply'),
collapse: i18n.getMessage('Collapse'),
isCollapsed: i18n.getMessage('{0} is collapsed'),
isExpanded: i18n.getMessage('{0} is Expanded')
};
function isSmallScreenSize() {
return $window.matchMedia('(max-width: 767px)').matches;
}
c.collapsed = $scope.collapsed;
c.showToggle = $scope.showToggle;
c.toggleIcon = function(evt, menuLabel) {
c.collapsed = !c.collapsed;
$scope.ontoggleFn({
menuId: $scope.menu.id,
collapsed: c.collapsed
});
if (c.collapsed)
spAriaUtil.sendLiveMessage(c.i18n.isCollapsed.withValues([menuLabel]));
else
spAriaUtil.sendLiveMessage(c.i18n.isExpanded.withValues([menuLabel]));
};
c.showClearButton = function() {
return $scope.showClear && !c.showApplyButton()
}
c.showApplyButton = function() {
return c.isMultiSelect && c.selectionIsDirty;
}
function computeSelectedItems() {
var newSelectedItems = $scope.menu.items.filter(function(item) {
return item.selected;
});
if (initialSelectedItems)
c.selectionIsDirty = dirtyCheck(newSelectedItems, initialSelectedItems);
return newSelectedItems;
}
function dirtyCheck(newItems, initialItems) {
if (newItems.length !== initialItems.length)
return true;
var initialValueArr = initialItems.map(function(item) {
return item.value;
});
return !newItems.every(function(newItem) {
if (initialValueArr.indexOf(newItem.value) > -1)
return true;
});
}
$scope.$on("sp.search.cancel", function() {
selectedItems = initialSelectedItems;
c.selectionIsDirty = false;
$scope.menu.items.forEach(function(item) {
var initialValueArr = initialSelectedItems.map(function(item) {
return item.value;
});
item.selected = initialValueArr.indexOf(item.value) > -1;
});
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spListMenuItems.js */
angular.module('sn.$sp').directive('spListMenuItems', function(i18n) {
function link(scope, elem, attr) {
scope.focus = function() {
$(elem).find("button")[0].focus();
}
}
return {
restrict: 'E',
replace: true,
scope: {
onclickFn: '&',
menu: '='
},
link: link,
templateUrl: function (elem, attr) {
return (attr.type === "MULTI_SELECT") ?
"sp_list_menu_checkbox.xml" :
"sp_list_menu_item.xml"
},
controllerAs: 'c',
controller: function($scope) {
var c = this;
c.showNextItems = false;
c.i18n = {
see_more: i18n.getMessage('See more'),
see_less: i18n.getMessage('See less'),
selected: i18n.getMessage('Selected')
};
getItems();
function getItems() {
var items = $scope.menu.items;
for (var i = 0; i < items.length; i++) {
if (items[i].label.indexOf('>') > -1) {
var completeLabel = items[i].label.split('>');
var ariaLabel = completeLabel[completeLabel.length - 1];
items[i].ariaLabel = ariaLabel;
} else
items[i].ariaLabel = items[i].label;
}
if (items.length > 10) {
c.items = items.slice(0, 10);
c.nextItems = items.slice(10);
} else {
c.items = items;
}
}
c.showMoreButton = function() {
return $scope.menu.items.length > 10 && !c.showNextItems;
}
c.onMoreButtonClick = function() {
c.showNextItems = true;
}
c.onLessButtonClick = function() {
c.showNextItems = false;
$scope.focus();
}
c.onClick = function(item) {
$scope.onclickFn({
menu: $scope.menu,
item: item
});
};
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/factory.spFacetManager.js */
angular.module('sn.$sp').factory('spFacetManager', function($location) {
'use strict';
var subscribeCallbackMap = {};
function addFacetWithSearchSource(t, key, value) {
$location.search("spa","1");
$location.search("t", t);
addFacet(key, value);
}
function addFacet(key, value) {
$location.search("spa","1");
var urlValue = value.toString();
if (Array.isArray(value)) {
value = value.map(encodeCommas);
urlValue = "[" + value.toString() + "]";
}
$location.search(key, urlValue);
}
function clearFacet(key) {
$location.search(key, null);
}
function clearFacetValue(facetID, facetValue) {
facetValue = encodeCommas(facetValue);
var currentFacetValue = $location.search()[facetID];
if (!currentFacetValue.charAt(0) === '[' || !currentFacetValue.charAt(currentFacetValue.length - 1) === ']') {
clearFacet(facetID);
return;
}
var currentFacetArr = currentFacetValue.substring(1, currentFacetValue.length - 1).split(',');
var index = currentFacetArr.indexOf(facetValue);
currentFacetArr.splice(index, 1);
if (currentFacetArr.length == 0) {
clearFacet(facetID);
return;
}
$location.search(facetID, '[' + currentFacetArr.toString() + ']');
}
function clearAllFacet() {
var urlParams = $location.search(),
keys = _.keys(urlParams);
for(var i = 0; i < keys.length; i++) {
if(keys[i] !== 'q' && keys[i] !== 't' && keys[i] !== 'id' && keys[i] !== 'spa') {
$location.search(keys[i], null);
}
}
}
function isFacetSelected(key, searchSource) {
var facetURLValue = $location.search()[key],
t = $location.search().t;
return (facetURLValue != undefined && facetURLValue != null) && t === searchSource;
}
function isAnyFacetSelected() {
var urlParams = $location.search(),
keys = _.keys(urlParams);
for(var i = 0; i < keys.length; i++) {
if(keys[i] !== 'q' && keys[i] !== 't' && keys[i] !== 'id' && keys[i] !== 'spa') {
return true;
}
}
return false;
}
function notify(response) {
_notifySubscribers("spFacets.refresh.data", {data: response.data.result.facets, query: $location.search()});
}
function _notifySubscribers(eventName, data) {
if(subscribeCallbackMap[eventName]) {
var listeners = subscribeCallbackMap[eventName];
for (var i = 0; i < listeners.length; i++) {
listeners[i](data);
}
}
}
function encodeCommas(str) {
return str.split(",").join("%2C");
}
return {
addFacet: addFacet,
addFacetWithSearchSource: addFacetWithSearchSource,
clearFacet: clearFacet,
clearFacetValue: clearFacetValue,
clearAllFacet: clearAllFacet,
isAnyFacetSelected: isAnyFacetSelected,
isFacetSelected: isFacetSelected,
notify: notify,
publish: function(eventName, data) {
_notifySubscribers(eventName, data);
},
subscribe: function(eventName, id, callback) {
if(!subscribeCallbackMap[eventName]) {
subscribeCallbackMap[eventName] = [];
}
subscribeCallbackMap[eventName].push(callback);
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAISearchResults.js */
angular.module('sn.$sp').factory('spAISearchResults', function($location, $rootScope, spAriaFocusManager) {
'use strict';
function navigate(data, actionPayload, action) {
if (actionPayload.url) {
window.open(actionPayload.url);
return;
}
var source = data.tableToSourceMap[actionPayload.table] || actionPayload.table;
var assignmentId = 'd46f400473211010c342d5fdbdf6a7cf'
if (action)
assignmentId = action.assignmentId || action.actionAssignmentId;
if (!source)
return;
var pageUrl = data.urlMap[source] && data.urlMap[source][assignmentId];
if (!pageUrl) {
pageUrl = '&id=form&table=' + actionPayload.table + '&sys_id=' + actionPayload.sysId;
} else {
var payload2QueryParamMap = data.sourceToPageMap[source] && data.sourceToPageMap[source][assignmentId].payload2QueryParamMap;
for (var key in actionPayload) {
if (key === 'url')
continue;
var keyParam = key;
if (key === 'sysId')
keyParam = 'sys_id';
if (payload2QueryParamMap && payload2QueryParamMap[key])
keyParam = payload2QueryParamMap[key];
pageUrl += '&' + keyParam + '=' + actionPayload[key];
}
}
locationSearch(pageUrl);
}
function locationSearch(url) {
$rootScope.$applyAsync(function() {
var navigateToUrl = $location.search(url);
spAriaFocusManager.navigateToLink(navigateToUrl.url());
});
}
return {
navigate: navigate,
locationSearch: locationSearch
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.select2EventBroker.js */
angular.module('sn.$sp').factory('select2EventBroker', function() {
var subscribers = {};
var uuid = -1;
function _openSelect2Element() {
for (var key in subscribers) {
subscribers[key]();
}
}
function _onSelect2Opening(callback) {
var subscriptionToken = (++uuid).toString();
subscribers[subscriptionToken] = callback.bind(this);
return function unsubscribe() {
delete subscribers[subscriptionToken];
}
}
return {
publishSelect2Opening: _openSelect2Element,
subscribeSelect2Opening: _onSelect2Opening
}
});
;
/*! RESOURCE: /scripts/app.$sp/filter.unique.js */
angular.module('sn.$sp').filter('unique', function() {
return function(collection, property) {
return _.uniqBy(collection, function(item) {
return item[property];
});
}
});
;
/*! RESOURCE: /scripts/app.$sp/service.spContextManager.js */
angular.module('sn.$sp').factory('spContextManager', function ($rootScope, $window, $interval, $q) {
'use strict';
var GLOBAL_CTX_KEY = 'global';
var _initialized, _initializing, _context;
function _clear() {
_context = {};
}
function _clone(obj) {
if (!obj)
return undefined;
return JSON.parse(JSON.stringify(obj));
}
function _cleanKey(key) {
key = (key || '').trim().toLowerCase();
if (key === '')
throw new Error('Please provide proper key for the context');
return key;
}
function _removeKey(key) {
if (_context[key])
delete _context[key];
}
function _setGlobalContext(rootScope) {
return $q(function (resolve) {
var interval;
var cancelInterval = function () {
$interval.cancel(interval);
interval = undefined;
}
interval = $interval(function () {
var scope = rootScope || $rootScope;
if (!scope.portal || !scope.page || !scope.user)
return;
_removeKey(GLOBAL_CTX_KEY);
addContext(GLOBAL_CTX_KEY, {
portal: {
sys_id: scope.portal.sys_id,
title: scope.portal.title,
url_suffix: scope.portal.url_suffix
},
page: {
sys_id: scope.page.sys_id,
id: scope.page.id,
title: scope.page.title,
is_public: scope.page.public
},
user: {
sys_id: scope.user.sys_id,
username: scope.user.user_name,
first_name: scope.user.first_name,
last_name: scope.user.last_name,
email: scope.user.email,
roles: scope.user.roles
},
language: {
user: $window.g_lang,
system: $window.g_system_lang
}
});
cancelInterval(interval);
resolve();
}, 0);
});
}
function _getContextForKey(key) {
if (!_context)
return;
return _clone(_context[key]);
}
function addContext(key, context) {
key = _cleanKey(key);
if (!context)
throw new Error('Please provide proper context for the key: ' + key);
if (_context[key] !== undefined)
throw new Error('Context for the key "' + key + '" is already registered');
_context[key] = context;
}
function getContext() {
return _clone(_context);
}
function getContextForKey(key, returnPromise) {
if (!returnPromise)
return _clone(_context[key]);
var interval;
var cancelInterval = function () {
$interval.cancel(interval);
interval = undefined;
}
return $q(function (resolve) {
var expire = new Date().getTime() + $window.NOW.sp_ctx_mgr_timeout;
interval = $interval(function () {
var context = _getContextForKey(key);
if (context) {
cancelInterval();
resolve(context);
return;
}
if (new Date().getTime() > expire) {
cancelInterval();
throw new Error('Request to get context for the key "' + key + '" timed out');
}
}, 10);
});
}
function updateContextForKey(key, context) {
_removeKey(key);
addContext(key, context);
}
function init() {
if (_initialized || _initializing) {
return $q(function (resolve) {
resolve();
});
}
_initializing = true;
return $q(function (resolve) {
_clear();
_setGlobalContext().then(function () {
_initialized = true;
_initializing = false;
resolve();
});
});
}
$rootScope.$on('sp.page.loaded', function () {
_setGlobalContext($rootScope);
});
return {
init: init,
addContext: addContext,
getContext: getContext,
getContextForKey: getContextForKey,
updateContextForKey: updateContextForKey
};
});
;
/*! RESOURCE: /scripts/app.$sp/service.spAgentChat.js */
angular.module('sn.$sp').factory('spAgentChat', function ($q, $http, $window, $location, spContextManager) {
'use strict';
var CONTEXT_KEY = 'agent-chat';
var STORAGE_KEY = 'sp.agent-chat';
var DEFAULT_FRAME_URL = '/$sn-va-web-client-app.do?sysparm_nostack=true&sysparm_stack=no';
var _url, _sessionId, _portalId;
var _initialized = false;
var _initializing = false;
var _config = {
isVisible: false,
isOpen: false,
hasUnreadMessage: false,
unreadMessages: 0
};
var _handlers = {};
var events = {
NEW_UNREAD_MESSAGE: 'sn-va-web-client-app-new-message',
REAUTH: 'sn-va-web-client-app-trigger-login',
CLOSE_AGENT_CHAT: 'sn-va-web-client-app-close-iframe',
STATE_CHANGE: 'STATE_CHANGE'
};
function _appendParams(kvp, params) {
var keys = Object.keys(kvp);
keys.forEach(function (key) {
params[key] = kvp[key];
});
}
function _buildParamString(params) {
var kvp = [];
var keys = Object.keys(params);
keys.forEach(function (key) {
kvp.push('sysparm_' + key + '=' + params[key]);
});
return kvp.length > 0 ? '&' + kvp.join('&') : '';
}
function _getConfig() {
var deferred = $q.defer();
var state = JSON.parse(localStorage.getItem(STORAGE_KEY));
if (state && state[_sessionId] && state[_sessionId][_url]) {
var config = state[_sessionId][_url];
_config.isVisible = true;
_config.isOpen = config.is_open;
_config.hasUnreadMessage = config.has_unread_message;
_config.unreadMessages = config.unread_messages;
deferred.resolve(_config);
return deferred.promise;
}
$http({ method: 'GET', url: '/api/now/sp/agent_chat/portal/' + _portalId + '/config' }).then(function (response) {
if (response.data.result && response.data.result.id !== null) {
_config.isVisible = true;
}
deferred.resolve(_config);
});
return deferred.promise;
}
function _handleEvent(event, payload) {
(_handlers[event] || []).forEach(function (handler) {
handler(payload);
})
}
function _initEventHandlers() {
Object.keys(events).forEach(function (event) {
_handlers[events[event]] = [];
});
$window.addEventListener('message', function (e) {
_handleEvent(e.data);
});
$window.addEventListener('storage', function (e) {
if (e.key !== STORAGE_KEY)
return;
_getConfig().then(function (config) {
_handleEvent(events.STATE_CHANGE, config);
});
}, true);
}
function _initStateStorage() {
var state = JSON.parse(localStorage.getItem(STORAGE_KEY)) || {};
Object.keys(state).forEach(function (key) {
if (key !== _sessionId)
delete state[key]
});
state[_sessionId] = state[_sessionId] || {};
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
}
function getFrameUrl() {
var deferred = $q.defer();
$http({ method: 'GET', url: '/api/now/sp/agent_chat/portal/' + _portalId + '/context' }).then(
function (response) {
spContextManager.getContextForKey('global', true).then(function (globalContext) {
spContextManager.getContextForKey(CONTEXT_KEY, true).then(function (acContext) {
var params = {};
params['portal'] = globalContext.portal.url_suffix;
params['page'] = globalContext.page.id;
params['language'] = globalContext.language.user;
_appendParams(spContextManager.getContextForKey('record') || {}, params);
_appendParams(acContext, params);
if (response.data && response.data.result)
_appendParams(response.data.result, params);
deferred.resolve(DEFAULT_FRAME_URL + _buildParamString(params));
});
});
}, function (response) {
console.error('Unable to retrieve SP Agent Chat Context. Error: ' + response.data.error.message);
deferred.resolve(DEFAULT_FRAME_URL);
});
return deferred.promise;
}
function setState(config) {
var state = JSON.parse(localStorage.getItem(STORAGE_KEY));
state[_sessionId][$location.path()] = {
is_open: config.isOpen,
has_unread_message: config.hasUnreadMessage,
unread_messages: config.unreadMessages,
};
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
}
function subscribe(event, handler) {
var eventHandlers = _handlers[event];
if (Array.isArray(eventHandlers))
eventHandlers.push(handler);
}
function registerParam(key, value) {
if (typeof value !== 'string')
throw new Error('Value for the "' + key + '" agent chat param must be of type "string"');
spContextManager.getContextForKey(CONTEXT_KEY, true).then(function (context) {
context[key] = value;
spContextManager.updateContextForKey(CONTEXT_KEY, context);
});
}
function init(portalId) {
if (_initialized || _initializing) {
return $q(function (resolve) {
resolve(_config);
});
}
_initializing = true;
_url = $location.path();
_sessionId = $window.NOW.session_id;
_portalId = portalId;
_initStateStorage();
return $q(function (resolve) {
_initEventHandlers();
spContextManager.init().then(function () {
spContextManager.addContext(CONTEXT_KEY, {});
_getConfig().then(function (config) {
_initialized = true;
_initializing = false;
resolve(config);
});
});
});
}
return {
init: init,
events: events,
subscribe: subscribe,
getFrameUrl: getFrameUrl,
setState: setState,
registerParam: registerParam
};
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spAgentChat.js */
angular.module('sn.$sp').directive('spAgentChat', function () {
return {
restrict: 'E',
replace: true,
templateUrl: 'sp_agent_chat.xml',
controllerAs: 'c',
scope: true,
controller: function ($window, spAgentChat, i18n, $rootScope, $scope, spUtil) {
var c = this;
var _portalId = $rootScope.portal_id;
c.isVisible = false;
c.isOpen = false;
c.hasUnreadMessage = false;
c.unreadMessages = 0;
c.frameUrl = null;
c.isMobile = spUtil.isMobile();
c.i18n = {
openChatWindow: i18n.getMessage('Open chat window'),
minimizeChatWindow: i18n.getMessage('Minimize chat window'),
openChatWindowWithUnreadMessage: i18n.getMessage('Open chat window. {0} unread messages'),
agentChatWindow: i18n.getMessage('Agent Chat Window')
};
c.getBadgeAriaLabel = function () {
if (c.isOpen)
return c.i18n.minimizeChatWindow;
else if (c.hasUnreadMessage)
return c.i18n.openChatWindowWithUnreadMessage.withValues([c.unreadMessages]);
else
return c.i18n.openChatWindow;
};
c.toggle = function ($event) {
if ($event) {
$event.currentTarget.blur();
}
c.isOpen = !c.isOpen;
c.hasUnreadMessage = false;
c.unreadMessages = 0;
$('body').toggleClass('disable_overflow_scrolling');
spAgentChat.setState({ isOpen: c.isOpen, hasUnreadMessage: c.hasUnreadMessage, unreadMessages: c.unreadMessages });
if (c.isOpen && c.frameUrl !== undefined) {
var spAgentChatFrame = $('iframe.sp-ac-frame');
var vaWebClient = $('sn-component-va-web-client', spAgentChatFrame.contents())[0];
var snChatInputElement = $('.sn-chat-input-element', $(vaWebClient))[0];
if (snChatInputElement === undefined)
snChatInputElement = $('.sn-chat-input-element', vaWebClient.shadowRoot)[0];
setTimeout(function() {
if (snChatInputElement.disabled)
$('.sp-ac-root')[0].focus();
else
snChatInputElement.focus();
}, 0);
} else if (c.isOpen && c.frameUrl === undefined) {
setTimeout(function() {
$('.sp-ac-root')[0].focus();
}, 0);
}
if (c.frameUrl !== undefined)
return;
spAgentChat.getFrameUrl().then(function (frameUrl) {
c.frameUrl = frameUrl;
});
}
spAgentChat.init(_portalId).then(function (config) {
c.frameUrl = config.frameUrl;
c.isVisible = config.isVisible;
c.hasUnreadMessage = config.hasUnreadMessage;
c.unreadMessages = config.unreadMessages;
if (c.isOpen !== config.isOpen) {
c.toggle();
}
});
spAgentChat.subscribe(spAgentChat.events.NEW_UNREAD_MESSAGE, function () {
if (!c.isOpen) {
c.hasUnreadMessage = true;
c.unreadMessages = c.unreadMessages + 1;
if (c.unreadMessages > 999) {
c.unreadMessages = 999;
}
$scope.$apply();
spAgentChat.setState({ isOpen: c.isOpen, hasUnreadMessage: c.hasUnreadMessage, unreadMessages: c.unreadMessages });
}
});
spAgentChat.subscribe(spAgentChat.events.CLOSE_AGENT_CHAT, function () {
c.toggle();
$scope.$apply();
$('button.sp-ac-btn')[0].focus();
});
spAgentChat.subscribe(spAgentChat.events.REAUTH, function () {
$window.location.reload(true);
});
spAgentChat.subscribe(spAgentChat.events.STATE_CHANGE, function (config) {
c.isOpen = config.isOpen;
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spRichTextLabel.js */
angular.module('sn.$sp').directive('spRichTextLabel', function($sce, cabrillo, getTemplateUrl) {
return {
scope: {
field: '='
},
templateUrl: getTemplateUrl('sp_rich_text_label.xml'),
restrict : 'E',
replace : true,
controller : function($scope) {
$scope.trustAsHtml = function(html) {
return $sce.trustAsHtml(html);
};
$scope.isNative = cabrillo.isNative();
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/directive.spIgnoreComposition.js */
angular.module('sn.$sp').directive('spIgnoreComposition', function () {
return {
restrict: 'A',
link: function postLink(scope, element) {
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
if (isIE11)
element.off('compositionstart').off('compositionend');
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentModel.js */
angular.module('sn.$sp').directive('spAssessmentNavButtons', function(getTemplateUrl) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_nav_buttons.xml'),
scope: false
};
}).directive('spAssessmentProgressBar', function(getTemplateUrl, i18n) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_progressbar.xml'),
scope: true,
controller : function($scope) {
$scope.progress = parseInt($scope.formModel.percent_answered);
$scope.progressText = i18n.format(i18n.getMessage("{0} complete"), parseInt($scope.formModel.percent_answered) + '%');
}
};
}).directive('spAssessmentAddInfo', function(getTemplateUrl, i18n, spAsmtDirtyFormManager) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_add_info.xml'),
scope: {
'field': '=',
'isMobile': '=?',
'isNative': '='
},
controller : function($scope) {
if (!$scope.field.add_info)
$scope.field.add_info = "";
$scope.field.original_add_info = $scope.field.add_info;
}
};
}).directive('spAssessmentModel', function($q, spUtil, glideFormFactory, glideUserSession, glideFormEnvironmentFactory, spUIActionFactory,
spModelUtil, $rootScope, spAriaUtil, getTemplateUrl, $http, i18n, snAttachmentHandler, spAsmtSignatureUtil, cabrillo, $sce, spModal, uiScriptFactory, spAsmtFieldPropertyDecorator, spAsmtDirtyFormManager) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_model.xml'),
replace: true,
scope : {
formModel: "=",
isMobile : '=?'
},
controller : function($scope, $rootScope, $timeout) {
var c = this;
var g_form;
var ui_g_form;
var formEnvironment;
var formModel;
var deferredEnv = $q.defer();
$scope.renderFields = false;
var flatFields;
$scope.currentPage = 0;
$scope.hasPagination;
$scope.controlMessages = [];
i18n.getMessages(['Collapse', 'Expand', 'Submit', 'Submitting...', 'Save', 'Saving...'], function(msgs) {
$scope.controlMessages = msgs;
});
$scope.isNative = cabrillo.isNative();
spAsmtSignatureUtil.setNative($scope.isNative);
$scope.$watch('formModel', function(newValue) {
if (angular.isDefined(newValue)) {
init();
}
});
$scope.trustHTML = function(string) {
return $sce.trustAsHtml(string);
};
$scope.$watch('isMobile', function(newValue, oldValue) {
if (angular.isDefined(newValue) && newValue !== oldValue) {
init();
if ($scope.formModel.pagination === 'question')
return;
if (newValue) {
$scope.currentPage = 0;
} else {
var questionIndex = $scope.currentPage;
var count = 0;
var endLoop = false;
if ($scope.formModel.pagination === 'category') {
for (var i = 0; i < $scope.pages.length && !endLoop; i++) {
for (var j = 0; j < $scope.pages[i].categories.length && !endLoop; j++)
if (questionIndex - $scope.pages[i].categories[j].questions.length >= 0) {
questionIndex -= $scope.pages[i].categories[j].questions.length;
count++;
} else {
endLoop = true;
}
}
}
$scope.currentPage = count;
updatePageTitle();
}
}
});
$scope.isLastPage = function() {
return $scope.currentPage == $scope.pages.length - 1;
}
$scope.showNativeButtons = function(isSubmitting) {
if (!$scope.isNative)
return;
var buttons = [];
if ($scope.currentPage == 0) {
buttons.push({
title: $scope.pages.length == 1 ? (isSubmitting ? i18n.getMessage('Submitting...') : i18n.getMessage('Submit')) : i18n.getMessage('Next'),
backgroundColor: formModel.sys_properties.mobileNativeColor,
textColor: '#FFFFFF',
enabled: !isSubmitting
});
cabrillo.viewLayout.setBottomButtons(buttons, function(buttonIndex) {
$scope.validatePageAndSave($scope.pages.length == 1 ? 'submit' : 'next');
});
} else {
buttons.push({
title: i18n.getMessage('Previous'),
backgroundColor: '#f7f7f7',
textColor: '#000000',
enabled: !isSubmitting
});
buttons.push({
title: $scope.isLastPage() ? (isSubmitting ? i18n.getMessage('Submitting...') : i18n.getMessage('Submit')) : i18n.getMessage('Next'),
backgroundColor: formModel.sys_properties.mobileNativeColor,
textColor: '#FFFFFF',
enabled: !isSubmitting
});
cabrillo.viewLayout.setBottomButtons(buttons, function(buttonIndex) {
switch(buttonIndex) {
case 0:
$scope.navigatePage('previous');
break;
case 1:
$scope.validatePageAndSave($scope.isLastPage() ? 'submit' : 'next');
break;
}
});
}
}
$rootScope.$on("sp.assessment.form.visible", function() {
$scope.showNativeButtons(false);
$timeout(function() {
focusFirstVisibleField();
}, 300);
});
$rootScope.$on("mesp.popup.close", function() {
$timeout(function(){
updatePageTitle();
$scope.showNativeButtons(false);
});
});
$rootScope.$on("mesp.popup.open", function() {
$timeout(function() {
cabrillo.viewLayout.setBottomButtons();
});
});
$rootScope.$on("asmt.signature.popup.close", function(data, response) {
if ($scope.isNative)
$scope.showNativeButtons(response.signatureValidated);
});
$rootScope.$on("asmt.signature.popup.open", function() {
if ($scope.isNative)
cabrillo.viewLayout.setBottomButtons();
});
$scope.navigatePage = function(direction) {
direction == 'next' ? $scope.currentPage++ : $scope.currentPage--;
updatePageTitle();
$scope.showNativeButtons(false);
initializeGlideForm();
$timeout(function() {
focusFirstVisibleField();
$scope.$emit('sp.components.resize');
}, 300);
}
var showSignatureFailureMessage = function() {
g_form.addErrorMessage(formModel.signature.msgs.emptySignatureMessage);
};
$scope.submitAssessment = function(actionName) {
var currentPage = $scope.currentPage;
$scope.$evalAsync(function () {
if (actionName == 'submit' &&  !$scope.isSignatureFilled()) {
if($scope.formModel.signature && $scope.formModel.signature.type !== 'full_name')
showSignatureFailureMessage();
return;
}
var formData = {
sysparm_action: actionName == 'next' ? 'save' : actionName,
sysparm_instance_id: formModel.instance_id,
hidden_questions : []
}
var fields = $scope.getFlatFieldsFromPage(currentPage);
$scope.currentAction = actionName;
for (var ques in fields) {
saveQuestion(fields[ques], formData);
}
formData['percent_answered'] = $scope.getPercentAnswered();
if (formModel.signature && actionName === 'submit')
formData['signature_result'] = formModel._fields[formModel.signature.sys_id].value;
var stringifiedFormData = JSON.stringify(formData);
var encodedFormData = encodeURIComponent(stringifiedFormData);
if (actionName == 'submit')
$scope.showNativeButtons(true);
$http({
method: 'POST',
url: '/sp_survey.do',
data: encodedFormData,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
}
}).then(successHandler).catch(errorHandler);
function successHandler(response) {
$scope.$emit('assessment.form.submitted', {action_name: actionName, response: response});
if ($scope.isSavingOrSubmitting())
spAsmtDirtyFormManager.unregisterForms([g_form.getSysId()]);
}
function errorHandler(response) {
$scope.$emit('assessment.form.submit_failed', {action_name: actionName});
$scope.currentAction = '';
}
})
}
function saveQuestion (question, formData) {
var questionId = question.sys_id;
if (!question.isVisible()) {
formData['hidden_questions'].push(questionId);
switch(question.type) {
case 'attachment':
if (!!question.attachments) {
question.attachments.forEach(function(attachment) {
snAttachmentHandler.deleteAttachment(attachment.sys_id);
});
}
formData["ADDINFO:ASMTQUESTION:" + questionId] = '';
break;
case 'multiplecheckbox':
case 'ranking':
var prefix = question.type == 'multiplecheckbox'? 'ASMTDEFINITION:': 'ASMTDEFINITIONRANK:';
question.choices.map(function(choice) {
var key = prefix + choice.sys_id + '_' + question.metric + '_' + question.source_id;
formData[key] = '';
formData["ADDINFO:" + key] = '';
});
break
default:
formData["ASMTQUESTION:" + questionId] = '';
formData["ADDINFO:ASMTQUESTION:" + questionId] = '';
}
return;
}
switch(question.type) {
case 'attachment':
formData["ASMTQUESTION:" + questionId] = '';
formData["ADDINFO:ASMTQUESTION:" + questionId] = question.add_info;
break;
case 'multiplecheckbox':
case 'ranking':
var prefix = question.type == 'multiplecheckbox' ? 'ASMTDEFINITION:' : 'ASMTDEFINITIONRANK:';
question.choices.map(function(choice) {
var key = prefix + choice.sys_id + '_' + question.metric + '_' + question.source_id;
if(question.type == 'multiplecheckbox')
formData[key] = (choice.selected || choice.selected == 'true') ? true : '';
else
formData[key] = choice.value;
formData["ADDINFO:" + key] = question.add_info;
});
break;
default:
formData["ASMTQUESTION:" + questionId] = question.value;
formData["ADDINFO:ASMTQUESTION:" + questionId] = question.add_info;
}
}
var stringQAMapHelper = function(questions) {
var stringQAMap = {};
questions.forEach(function(qid) {
var question = formModel._fields[qid];
if (question.type == 'string' || question.type == 'textarea')
stringQAMap[qid] = {validator: question.field_validation, value: question.value};
});
return stringQAMap;
};
$scope.validateString = function(stringQAMap) {
spUtil.get($scope.$parent, {'action': "check_string_validation","string_qa_map": JSON.stringify(stringQAMap)}).then(function(response) {
if (!response || !response.data || !response.data.stringValidationResponse)
return;
var validationResults = JSON.parse(response.data.stringValidationResponse);
angular.forEach(validationResults, function(value, qid) {
var question = formModel._fields[qid];
question.isServerValidationDone = true;
question.isInvalid = question.isServerInvalid = validationResults[qid].isInvalidString;
question.fieldValidatorErrorMsg = validationResults[qid].fieldValidatorErrorMsg;
if (question.isInvalid) {
g_form.showFieldMsg(question.name, question.fieldValidatorErrorMsg, 'error');
}
});
});
}
$scope.isSignatureFilled = function() {
var signature = formModel.signature;
if (formModel.isPublic || !signature || signature.type == 'assertion_only')
return true;
if (signature.type == 'full_name' && !signature.validated) {
signature.validationCallback = function(validated) {
if (validated) {
$scope.submitAssessment('submit');
return true;
} else
showSignatureFailureMessage();
};
spAsmtSignatureUtil.verifySignature(formModel.signature);
return false;
}
if (signature.type == 'checkbox') {
if (formModel._fields[signature.sys_id].value != true)
return false;
else
formModel._fields[signature.sys_id].value = 'checked';
}
return true;
};
$scope.isRegexDone = function() {
var fields = $scope.getFlatFieldsFromPage($scope.currentPage);
for (var field in fields) {
if (fields.hasOwnProperty(field) && fields[field].isServerValidationDone === false)
return false;
}
return true;
}
$scope.validatePageAndSave = function(actionName) {
if (actionName == 'cancel') {
var dialogHeader = formModel.parameterizedMsgsMap.cancel_header;
var dialogMsg = formModel.parameterizedMsgsMap.cancel_modal_msg;
spModal.open({
title: dialogHeader,
message: dialogMsg,
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0},
buttons: [
{label: i18n.getMessage("Cancel"), value: "cancel"},
{label: i18n.getMessage("OK"), primary: true, value: "ok"}
]
}).then(function(confirm) {
if (confirm.value == "ok") {
$scope.submitAssessment(actionName);
return true;
}
return;
});
} else {
if ($scope.isRegexDone() && g_form)
if (!g_form.submit(actionName))
$scope.openInvalidFields();
}
}
$scope.openInvalidFields = function() {
var firstInvalidQuestion;
var errorElement;
$scope.pages[$scope.currentPage].categories.forEach(function(category) {
var questions = category.questions;
var invalidQuestions = questions.filter(function(qid){ return $scope.formModel._fields[qid].isInvalid == true || ($scope.formModel._fields[qid].type == 'signature' && $scope.formModel._fields[qid].value != true) });
if (invalidQuestions.length) {
if (!firstInvalidQuestion)
firstInvalidQuestion = invalidQuestions[0];
if (category.collapsed)
category.collapsed = false;
}
});
var errorElementLabel = 'label[for="sp_formfield_' + firstInvalidQuestion + '"]';
errorElement = $(errorElementLabel);
if (errorElement.length) {
$timeout(function(){
errorElement[0].scrollIntoView();
}, 500);
}
}
$scope.isPageVisible = function (page, formModel) {
for (var i = 0; i < page.categories.length; i++) {
var category = page.categories[i];
var questions = category.questions;
for (var j = 0; j < questions.length; j++) {
var question = formModel._fields[questions[j]];
if (question.visible)
return true;
}
}
return false;
}
$scope.getPercentAnswered = function() {
var currentPercent = 0;
if ($scope.currentPage == $scope.pages.length - 1 && $scope.currentAction == 'submit')
currentPercent = 100;
else
currentPercent = ($scope.currentPage * 100.0) / $scope.pages.length;
formModel.percent_answered =  formModel.percent_answered > currentPercent ? formModel.percent_answered : currentPercent;
return formModel.percent_answered;
};
$scope.isSavingOrSubmitting = function() {
return $scope.currentAction == 'save' || $scope.currentAction == 'submit';
}
c.getFlatFields = function (formModel) {
var fields = formModel._fields;
var flatFields = [];
for (var field in fields){
if  (fields[field].type != 'signature')
flatFields.push(fields[field]);
}
return flatFields;
}
function onChange(fieldName, oldValue, newValue) {
if (!(fieldName in formModel._fields))
return;
$scope.$evalAsync(function() {
var field = formModel._fields[fieldName];
if (field.stagedValue != newValue) {
field.stagedValue = newValue;
}
setCategoryMandatory($scope.formModel, $scope.pages);
var p = {field: field, oldValue: oldValue, newValue: newValue};
if (!$scope.isMobile && formModel.is_kiosk_survey) {
field.readonly = true;
$scope.validatePageAndSave('submit');
}
$scope.$emit("field.change", p);
$scope.$broadcast("field.change." + field.name, p);
$scope.$emit("field.change." + field.name, p);
});
}
function getErrorMessage(message) {
var parts = message.replace(/\:/,"####").split("####");
if (parts.length !== 2 || message.indexOf('://') !== -1) { return message; }
var errorFields = [];
var fields = parts[1].split(/\r|\n/);
fields.forEach(function(f) {
f = f.trim();
if (!f) { return; }
errorFields.push(f);
});
if (errorFields.length === 0) { return message; }
return parts[0] + ': ' + errorFields.join(', ');
}
function uiMessageHandler(g_form, type, message) {
switch (type) {
case 'infoMessage':
spUtil.addInfoMessage(message);
break;
case 'warningMessage':
spUtil.addWarningMessage(message);
break;
case 'errorMessage':
case 'mandatoryMessage':
spUtil.addErrorMessage(getErrorMessage(message));
break;
case 'clearMessages':
spUtil.clearMessages();
break;
default:
return false;
}
}
$scope.getGlideForm = function() {
return ui_g_form;
};
$scope.setDefaultValue = function (fieldName, fieldInternalValue, fieldDisplayValue) {
g_form.setValue(fieldName, fieldInternalValue, fieldDisplayValue);
};
function initGlideForm() {
var uiActions = spUIActionFactory.create(formModel._ui_actions || [], {
attachmentGUID: formModel._attachmentGUID,
uiActionNotifier: function(actionName, uiActionPromise) {
uiActionPromise.then(function(response) {
$rootScope.$broadcast("spModel.uiActionComplete", response, formModel.sys_id);
});
}
}, $scope.formModel.encoded_record);
spModelUtil.extendFields(flatFields);
g_form = glideFormFactory.create($scope, formModel.table, formModel.sys_id, flatFields, uiActions, {
encodedRecord: $scope.formModel.encoded_record,
uiMessageHandler: uiMessageHandler,
cleanDecimals: true,
relatedLists: formModel._related_lists,
sections: formModel._sections,
fieldIterator: $scope.fieldIterator
});
g_form.getControl = getControl;
g_form.getField = function(fieldName) {
for (var i = 0, iM = flatFields.length; i < iM; i++) {
var field = flatFields[i];
if (field.name === fieldName) {
return field;
}
}
var getMappedField = g_form.$private.options('getMappedField');
if (typeof getMappedField === 'function') {
var mapped = getMappedField(fieldName);
if (mapped)
return mapped;
}
};
g_form.$private.events.on('change', onChange);
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (propertyName == "mandatory") {
setCategoryMandatory($scope.formModel, $scope.pages);
}
if (propertyName == 'messages') {
if (propertyValue && propertyValue.length)
spAriaUtil.sendLiveMessage(propertyValue);
}
if (propertyName == "visible") {
if (propertyValue)
$scope.$broadcast('sp.assessment.details.visible', fieldName);
if (formModel.pagination == 'question' || $scope.isMobile)
$scope.pages = getPages(formModel);
$scope.showNativeButtons(false);
}
});
g_form.$private.events.on('submitted', function(action) {
$scope.submitAssessment(action);
if (action == 'next') {
$scope.navigatePage(action);
}
});
$scope.$on("sp.spFormField.stagedValueChange", function() {
setCategoryMandatory($scope.formModel, $scope.pages);
});
spAsmtFieldPropertyDecorator.decorate(flatFields, g_form);
return g_form;
}
$scope.fieldIterator = function(f) {
var fields = $scope.getFlatFieldsFromPage($scope.currentPage);
fields.forEach(f);
}
$scope.getFlatFieldsFromPage = function(pageId) {
var fields = [];
var signature = $scope.formModel.signature;
$scope.pages[pageId].categories.forEach(function(category) {
var questions = category.questions;
questions.forEach(function(qid) {
if (!signature || signature.sys_id != qid)
fields.push($scope.formModel._fields[qid]);
});
});
return fields;
}
function init() {
formModel = $scope.formModel;
$scope.pages = getPages(formModel);
$scope.hasPagination = formModel.pagination !== "none" || $scope.isMobile;
initializeGlideForm();
postInitialization();
}
function postInitialization () {
if ($scope.hasPagination)
updatePageTitle();
if (formModel.one_click_survey || formModel.not_show_intro_note)
$scope.showNativeButtons(false);
}
function initializeGlideForm() {
if (!deferredEnv) {
deferredEnv = $q.defer();
$scope.execItemScripts();
}
flatFields = c.getFlatFields(formModel);
glideUserSession.loadCurrentUser().then(function(user) {
createEnvironment(user);
deferredEnv.resolve();
}).catch(deferredEnv.reject);
}
$scope.execItemScripts = function() {
deferredEnv.promise.then(function() {
deferredEnv = null;
$scope.$emit("spModel.fields.rendered");
$scope.$evalAsync(function() {
setCategoryMandatory($scope.formModel, $scope.pages);
formEnvironment.initialize();
$scope.$emit("spModel.gForm.initialized", g_form);
spAsmtDirtyFormManager.register(g_form);
spAsmtDirtyFormManager.isNative($scope.isNative);
});
});
};
$scope.getValidationScriptsForCurrentPage = function() {
if (!formModel.validation_scripts || !formModel.validation_scripts.length)
return [];
var currentPageFields = [];
$scope.pages[$scope.currentPage].categories.forEach(function(category) {
currentPageFields = currentPageFields.concat(category.questions || []);
});
var validationScripts = [];
for (var i = 0; i < formModel.validation_scripts.length; i++) {
var filteredFields = [];
filteredFields = formModel.validation_scripts[i].fields.filter(function (f) { return currentPageFields.indexOf(f) != -1; });
if (filteredFields.length > 0) {
var validationScript = JSON.parse(JSON.stringify(formModel.validation_scripts[i]));
validationScript.fields = filteredFields;
validationScripts.push(validationScript);
}
}
return validationScripts;
}
function createEnvironment(user) {
g_form = initGlideForm();
formEnvironment = glideFormEnvironmentFactory.createWithConfiguration(g_form, user, formModel.g_scratchpad, formModel.client_script || [], formModel.policy || [], {}, $scope.getValidationScriptsForCurrentPage(), uiScriptFactory.create(formModel.ui_scripts) || []);
ui_g_form = formEnvironment.getUserGlideForm();
$scope.renderFields = true;
$scope.$emit("spModel.gForm.env.created", g_form);
g_form.$private.events.on('change', onChangeStringValidation);
}
function onChangeStringValidation(fieldName, oldValue, newValue) {
if (formModel._fields[fieldName].type != 'textarea' && formModel._fields[fieldName].type != 'string')
return;
var field = formModel._fields[fieldName];
field.isServerValidationDone = field.field_validation ? false :  true;
field.isServerInvalid = false;
var stringQAMap = stringQAMapHelper([fieldName]);
$scope.validateString(stringQAMap);
}
function getPages(formModel) {
var pages = [];
var pageId = 0;
var pagination = $scope.isMobile ? 'question' : formModel.pagination;
if (pagination == 'category') {
var pageCategories = [];
for (var i = 0; i < formModel.categories.length; i++) {
var page = {categories: [], visible: true};
var category = formModel.categories[i];
page.categories.push(category);
page.visible = $scope.isPageVisible(page, formModel);
if (!page.visible)
continue;
page.id = pageId++;
page.showCategoryDetails = true;
pages.push(page);
}
} else if (pagination == 'question') {
for (var i = 0; i < formModel.categories.length; i++) {
var category = formModel.categories[i];
var questions = category.questions;
for (var j = 0; j < questions.length; j++) {
var page = {categories: [],visible: true};
var qId = questions[j];
var question = formModel._fields[qId];
var pageCategory = _.assign({}, category);
page.visible = question.visible;
if (question.type === 'template' && !$scope.isMobile) {
if (question.template.firstQuestion) {
pageCategory.questions = formModel.template_groups[question.template_group].questions;
page.visible =  getTemplateGroupVisibility(question.template_group, formModel);
}
else
continue;
} else
pageCategory.questions = [question.sys_id];
page.categories.push(pageCategory);
if (!page.visible)
continue;
page.id = pageId++;
if (j == 0)
page.showCategoryDetails = true;
pages.push(page);
}
}
} else {
var page = {categories: [], visible: true};
page.categories = [];
for (var i = 0; i < formModel.categories.length; i++) {
var category = JSON.parse(JSON.stringify(formModel.categories[i]));
category.collapsed = false;
page.categories.push(category);
page.id = pageId;
}
pages.push(page);
}
setCategoryMandatory(formModel, pages);
addSignature(formModel, pages, pageId, $scope.isMobile);
return pages;
}
function updatePageTitle() {
if(!$scope.pages[$scope.currentPage])
return;
var changeToDefault = !!$scope.pages[$scope.currentPage].isSignature;
var name = $scope.pages[$scope.currentPage].categories[0].name;
$scope.$emit('survey.update.title', name, changeToDefault);
}
}
};
function getTemplateGroupVisibility(groupNumber, formModel) {
var templateQuestions = formModel.template_groups[groupNumber].questions;
for (var index in templateQuestions) {
if (formModel._fields[templateQuestions[index]].visible)
return true;
}
return false;
}
function setCategoryMandatory(formModel, pages) {
pages.forEach(function(page){
page.isPageMandatory = false;
page.categories.forEach(function(category) {
var isMandatory = false
category.questions.forEach(function(qId) {
var question = formModel._fields[qId];
if (question.mandatory && question.mandatory_filled && !question.mandatory_filled()) {
isMandatory = true;
return;
}
})
category.isMandatory = isMandatory;
if (category.isMandatory)
page.isPageMandatory = true;
})
})
}
function addSignature(formModel, pages, pageId, isMobile) {
var signature = formModel.signature;
if (formModel.isPublic || !signature) return;
if (formModel.pagination == 'none' && !isMobile) {
var numOfCategories =  pages[pages.length - 1].categories.length;
var lastCategory = pages[pages.length - 1].categories[numOfCategories - 1];
if (!formModel._fields.hasOwnProperty(signature.sys_id))
lastCategory.questions.push(signature.sys_id);
} else {
var page = {categories: [], visible: true, isSignature: true};
var category = {};
category.id = signature.sys_id;
category.name =  formModel.title;
category.questions = [signature.sys_id];
page.categories.push(category);
page.id = pageId;
pages.push(page);
}
if (!!formModel._fields[signature.sys_id]) return;
formModel._fields[signature.sys_id] = spAsmtSignatureUtil.getQuestion(signature);
}
function getControl(name) {
var names = this.getFieldNames();
if (names.indexOf(name) == -1)
return null;
return new GlideFormControl(this, name);
function GlideFormControl(g_form, name) {
this.g_form = g_form;
this.name = name;
this.options = [];
this.focus = function focus() {
console.log(">> focus not implemented for " + this.name)
}
Object.defineProperty(this, 'value', {
get: function() {
return this.g_form.getValue(this.name);
},
set: function(val) {
this.g_form.setValue(this.name, val);
}
})
}
}
function focusFirstVisibleField() {
var field = $(".sp-asmt-auto-focus:first");
var elements = ["input:visible", "textarea:visible", "button:visible"];
for (var i = 0; i < elements.length; i++) {
var ele = field.find(elements[i]);
if (ele.length) {
ele[0].focus();
break;
}
}
$('.asmt-modal-layout')[0].scrollIntoView();
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentFormField.js */
angular.module('sn.$sp').directive('spAssessmentMobileField', function(getTemplateUrl){
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_mobile_field.xml'),
scope: false
};
}).directive('spAssessmentFormField', function(getTemplateUrl, i18n) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_form_field.xml') ,
replace: true,
controllerAs: 'c',
scope : {
field: '=',
formModel: '=',
isMobile: "=",
getGlideForm: '&glideForm',
isNative: '='
},
controller : function($scope) {
var c = this;
var field = $scope.field;
if (!field)
throw "spAssessmentFormField used without providing a field.";
c.showLabel = function showLabel(field) {
return ($scope.isMobile ||  field.type != 'template') && field.label && field.label.trim() != '';
};
$scope.stagedValueChange = function() {
$scope.$emit('sp.spFormField.stagedValueChange', null);
};
c.renderSPFormField = function(field) {
var type = field.type;
switch(type) {
case 'imagescale':
case 'ranking':
case 'number':
case "template":
case 'multiplecheckbox':
case 'signature':
case 'attachment':
return false;
case 'numericscale':
case 'multiple_choice':
if ($scope.isMobile)
return false;
default:
return true;
}
};
$scope.fieldValueChanged = function(newValue) {
if (angular.isDefined(newValue)) {
field.stagedValue = newValue;
$scope.getGlideForm().setValue(field.name, newValue, newValue);
}
return field.value;
};
function init() {
var type = $scope.field.type;
switch(type) {
case 'choice':
var choose = i18n.getMessage("Choose");
var chooseLabel = '-- ' + choose + ' --';
if (!field.choices || field.choices.length == 0 || field.choices[0].label != chooseLabel)
field.choices = [{label: chooseLabel, value: '', sys_id: 'NONESYSID'}].concat(field.choices || []);
break;
case 'reference':
var ed = {
name: 'reference',
reference: field.recordTableName,
searchField: field.searchField,
qualifier: field.refCondition
};
field.ed = ed;
break;
case 'ranking':
var isFilled = field.choices.map(function(choice) {return !!choice.value && choice.value != '-1'}).reduce(function(x, y) {return x && y}, true);
field.value = field.stagedValue =  isFilled ? field.value : '';
break;
case 'template':
if (!$scope.isMobile) {
var fieldArray = Object.entries($scope.formModel._fields);
var filteredArray = fieldArray.filter(function (e) { return e[1].template_group === field.template_group});
$scope.templateGroupFields = {};
for(var i = 0; i < filteredArray.length; i++)
$scope.templateGroupFields[filteredArray[i][0]] = filteredArray[i][1];
}
break;
default:
break;
}
}
init();
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentLayout.js */
angular.module('sn.$sp').directive('spAssessmentLayout', function(getTemplateUrl) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_layout.xml'),
scope: false
};
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentRanking.js */
angular.module('sn.$sp').directive('spAssessmentRanking', function(getTemplateUrl, $timeout) {
return {
restrict: 'E',
templateUrl: getTemplateUrl('sp_assessment_ranking.xml'),
scope: {
field: '=?',
snChange: '&',
isNative: '='
},
controller: function($scope, $element) {
$scope.field.choices.sort(function(a, b) {return a.value - b.value;});
$scope.choicesOrder = [];
$scope.field.choices.forEach(function(choice) {
$scope.choicesOrder.push(choice.sys_id);
});
$scope.updatingChoices = false;
function swap(a, i, j) {
if (i < 0 || i >= a.length || j < 0 || j >= a.length)
return;
var temp = a[i];
a[i] = a[j];
a[j] = temp;
}
$scope.onSelectChange = function(choice) {
$scope.field.choices.forEach(function(c) {
if (c.value == choice.value && c.sys_id != choice.sys_id) {
c.value = '-1';
}
});
var currentPosition = $scope.choicesOrder.indexOf(choice.sys_id);
var order = $scope.sortable.toArray();
swap(order, parseInt(choice.value) - 1, currentPosition);
swap($scope.choicesOrder, parseInt(choice.value) - 1, currentPosition);
$scope.sortable.sort(order);
$scope.lastModifiedChoice = choice.value - 1;
$scope.setFieldValue();
$scope.setFocusToLastModifiedChoice();
}
$timeout(function() {
$scope.sortable = new Sortable($element.find('ul')[0], {
onUpdate: function () {
$scope.updatingChoices = true;
var rankList = $element.find('select');
for(var i = 0; i < rankList.length; i++) {
rankList[i].value = i + 1;
var currentPosition = $scope.choicesOrder.indexOf(rankList[i].id);
swap($scope.choicesOrder, i, currentPosition);
$(rankList[i]).triggerHandler('change');
}
$scope.updatingChoices = false;
$scope.setFieldValue();
$scope.setFocusToLastModifiedChoice();
}
});
angular.element($element.find('ul')[0]).on('touchmove', function(evt) {
evt.preventDefault();
});
});
$scope.setFieldValue = function() {
if ($scope.updatingChoices)
return;
var selected = true;
for (var i in $scope.field.choices) {
if ($scope.field.choices[i].value == '-1') {
selected = false;
break;
}
}
if ($scope.snChange) {
var change = {};
change["newValue"] = selected ? selected + '' : '';
$scope.snChange(change);
}
$scope.updatingChoices = false;
}
$scope.setFocusToLastModifiedChoice = function() {
if ($scope.updatingChoices)
return;
$scope.setFocusToSelect($scope.lastModifiedChoice);
}
},
link: function(scope, element) {
setTimeout(function() {
$(element).find('li').mouseenter(function(elem) {
$(this).addClass('hovered');
})
$(element).find('li').mouseleave(function(elem) {
$(this).removeClass('hovered');
})
$(element).find('li').attr('style', scope.isNative ? 'margin-top: .325rem !important' : undefined);
}, 10);
scope.setFocusToSelect = function(index) {
var ele = element.find('select');
if (ele)
ele[index].focus();
}
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/service.spAsmtSignatureUtil.js */
angular.module('sn.$sp').factory('spAsmtSignatureUtil', function($rootScope, $http, $q, i18n, spModal, $sce) {
"use strict";
var nativeMobile;
function setNative(native) {
nativeMobile = native;
}
function checkLogin(signature, widgetData) {
signature.signAuthFailure = false;
var password = widgetData.widget.data.templateData.password;
return $q(function (resolve, reject) {
$http({
method: 'POST',
url: '/sp_survey.do',
data: {
sysparm_request_type: 'verify_signature',
sysparm_user: signature.username,
sysparm_password: password
}
}).then(function (response) {
var isValid = response.data == 'true';
signature.signAuthFailure = !isValid;
resolve({status : isValid, errorMessage: signature.msgs.invalidCredentials});
if (signature.validationCallback && isValid) {
signature.validated = true;
signature.validationCallback(true);
signature.validationCallback = null;
}
},
function(error) {
resolve({status : false, errorMessage: signature.msgs.emptySignatureMessage});
}
);
});
}
function verifySignature(signature) {
signature.signAuthFailure = false;
signature.password = '';
signature.isNative = nativeMobile;
$rootScope.$broadcast('asmt.signature.popup.open');
spModal.open({
title: signature.msgs.signatureAuthentication,
onSubmit: function() {
return checkLogin(signature, this);
},
widget: "template_renderer",
buttons: [
{label: i18n.getMessage("Cancel"), value: "close", cancel: true},
{label: i18n.getMessage("OK"), value: "ok", primary: true}
],
widgetInput: {data: signature, template: "sp_assessment_signature.xml"}
}).then(function() {
$rootScope.$broadcast('asmt.signature.popup.close', {signatureValidated: !!signature.validated});
}, function() {
$rootScope.$broadcast('asmt.signature.popup.close', {signatureValidated: !!signature.validated});
if (signature.validationCallback && signature.signAuthFailure) {
signature.validationCallback(false);
}
})
};
function getQuestion(signature) {
return {
type: 'signature',
name: signature.sys_id,
value: signature.value,
stagedValue: signature.value,
sys_id: signature.sys_id,
signType: signature.type,
userName: signature.username,
depends_on: '',
visible: true,
readonly: (signature.type === 'full_name' ? true : false),
mandatory: (signature.type === 'checkbox' ? true : false),
htmlLabel: $sce.trustAsHtml(signature.label),
isVisible: function() { return true },
isMandatory: function() { return this.mandatory },
isReadonly : function() { return this.readonly },
mandatory_filled : function() {return this.value}
};
}
return {
verifySignature: verifySignature,
getQuestion: getQuestion,
setNative: setNative
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentNumber.js */
angular.module('sn.$sp').directive('spAssessmentNumber', function(getTemplateUrl, i18n) {
return {
restrict: 'E',
templateUrl: getTemplateUrl('sp_assessment_number.xml'),
scope: {
field: '=?',
snChange: '&',
isMobile : '=?',
isNative: '='
},
controller: function($scope, $element) {
$scope.translations = {};
i18n.getMessages(["The value is not valid or it is out of range.", "The entered value has been changed to an integer."], function(msgs){
$scope.translations = msgs;
});
var field = $scope.field;
$scope.validate = function() {
var value = field.stagedValue;
field.isConverted = false;
if ($scope.isFloat(value) && value >= 0) {
value = Math.floor(value);
field.isConverted = true;
}
var parsedValue = parseFloat(value);
var maxValue = parseInt(field.maxValue);
var minValue = parseInt(field.minValue);
field.isInvalid = field.isInvalidInput = (value !== '') && (isNaN(value) || parsedValue > maxValue || parsedValue < minValue);
if ($scope.snChange) {
var change = {};
change["newValue"] = value;
$scope.snChange(change);
}
};
$scope.isFloat = function(n) {
return n % 1 !== 0;
};
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentCheckboxGroup.js */
angular.module('sn.$sp').directive('spAssessmentCheckboxGroup', function(getTemplateUrl) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_checkbox_group.xml') ,
replace: true,
scope : {
field: '=',
snChange: '&'
},
controller : function($scope) {
var selectedChoices = [];
$scope.field.choices.forEach(function(choice) {
if (choice.selected) {
selectedChoices.push(choice.value);
}
});
$scope.setFieldValue = function(choice) {
if (choice.selected) {
selectedChoices.push(choice.value);
} else {
selectedChoices = selectedChoices.filter(function(value) {
return value != choice.value;
})
}
if ($scope.snChange) {
var change = {};
change["newValue"] = selectedChoices.toString();
$scope.snChange(change);
}
}
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentImageScale.js */
angular.module('sn.$sp').directive('spAssessmentImageScale', function(getTemplateUrl) {
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl('sp_assessment_image_scale.xml'),
scope: {
field: '=?',
snChange: '&',
isMobile: '=?',
isKioskSurvey: '=',
isNative: '='
},
controller: function($scope) {
$scope.initialOpacity = $scope.field.unselected_image_all_present ? 1 : 0.5;
var keys = {
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
SPACE: 32
};
$scope.selectChoice = function(event, choice) {
event.stopPropagation();
$scope.initialOpacity = 0;
choice.opacity = 1;
if ($scope.snChange) {
var change = {};
change["newValue"] = choice.value;
$scope.snChange(change);
}
unselectOtherChoices();
if ($scope.isMobile) {
$scope.mobileChoice = choice;
}
}
$scope.selectOption = function(event, currentIndex) {
if (event.which == keys.SPACE) {
event.preventDefault();
$scope.selectChoice(event, $scope.field.choices[currentIndex]);
return;
}
var length = $scope.field.choices.length;
var select = -1;
switch(event.which) {
case keys.LEFT:
case keys.UP:
select = (--currentIndex + length) % length;
break;
case keys.RIGHT:
case keys.DOWN:
select = (++currentIndex) % length;
break;
}
if (select == -1)
return;
event.preventDefault();
$scope.chooseOption(event, select);
};
$scope.chooseOption = function(event, position) {
var elements = document.getElementsByClassName("img-scale-" + $scope.field.sys_id);
if (elements && elements[position]) {
for (var i = 0; i < elements.length; i++) {
elements[i].tabIndex = -1;
}
$scope.selectChoice(event, $scope.field.choices[position]);
elements[position].tabIndex = 0;
elements[position].focus();
}
};
$scope.getTabIndex = function(index, choice) {
if ($scope.field.value)
return $scope.field.value === choice.value ? "0" : "-1";
return index === 0 ? "0" : "-1";
};
function unselectOtherChoices() {
var choices = $scope.field.choices;
for (var i = 0; i < choices.length; i++) {
var choice = choices[i];
choice.initialOpacity = 0;
if ($scope.field.value != choice.value)
if ($scope.isKioskSurvey)
choice.opacity =  0.15;
else if (!$scope.field.unselected_image_all_present)
choice.opacity = 0.5;
}
}
function initChoiceForMobile() {
if (!$scope.isMobile)
return;
$scope.mobileChoice = $scope.field.choices[0];
for (var i = 0; i < $scope.field.choices.length; i++) {
var choice = $scope.field.choices[i];
if ($scope.field.value == choice.value) {
$scope.mobileChoice = choice;
break;
}
}
}
initChoiceForMobile();
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentAttachment.js */
angular.module('sn.$sp').directive('spAssessmentAttachment', function(getTemplateUrl, i18n, nowAttachmentHandler, spAttachmentUpload, $timeout, spAriaUtil, cabrillo, spModal) {
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl('sp_assessment_attachment.xml'),
scope: {
field: '=?',
snChange: '&'
},
controller: function($scope, $element) {
$scope.isNative = cabrillo.isNative();
$scope.errorMessages = [];
var field = $scope.field;
var attachedMsg = i18n.getMessage("Attached");
$timeout(function() {
var ah = $scope.attachmentHandler = new nowAttachmentHandler($scope.setAttachments, $scope.appendError);
ah.setParams(field.recordTableName, field.recordSysId);
ah.getAttachmentList();
});
$scope.showAttachOptions = function() {
var handler = $scope.attachmentHandler;
cabrillo.attachments.addFile(
field.recordTableName,
field.recordSysId,
null,
{maxWidth: 1000, maxHeight: 1000}
).then(function(data) {
handler.getAttachmentList(handler.ADDED);
}, function() {
console.log('Failed to attach new file');
});
};
$scope.onAttachmentSelect = function($files) {
if ($files.length == 0)
return;
spAttachmentUpload.uploadAttachments($scope.attachmentHandler, $files);
$files = '';
};
$scope.openAttachmentSelector = function($event) {
$event.stopPropagation();
var input = $element.find('input[type=file]');
if (input)
input.click();
};
$scope.setFocus = function(id) {
var ele = document.getElementById(id);
if (ele)
ele.focus();
};
$scope.setAttachments = function(attachments) {
var fileNames = "";
attachments.forEach(function(attachment) {
attachment.canWrite = false;
fileNames += attachment.file_name + ',';
});
field.attachments = attachments;
if ($scope.snChange) {
var change = {};
change["newValue"] = fileNames;
$scope.snChange(change);
}
};
$scope.appendError = function(error) {
$scope.errorMessages.push(error);
spAriaUtil.sendLiveMessage(error.msg);
};
$scope.getAttachmentTemplate = function() {
return getTemplateUrl('sp_attachment_single_line.xml');
}
$scope.confirmDeleteAttachment = function(attachment) {
if ($scope.isNative) {
if (confirm(i18n.getMessage("Delete Attachment?"))) {
$scope.attachmentHandler.deleteAttachment(attachment);
$scope.setFocus('sp_asmt_formfield_' + field.name);
}
} else {
spModal.confirm(i18n.getMessage("Delete Attachment?")).then(function() {
$scope.attachmentHandler.deleteAttachment(attachment);
$scope.setFocus('sp_asmt_formfield_' + field.name);
});
}
}
$scope.$on('attachment.upload.success', function(evt, args) {
$timeout(function() {
spAriaUtil.sendLiveMessage(args.names + " " + attachedMsg);
}, 500);
});
$scope.$on('attachment.delete.success', function(evt, args) {
$timeout(function() {
spAriaUtil.sendLiveMessage(i18n.getMessage('Attachment deleted successfully'));
}, 500);
});
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentTemplate.js */
angular.module('sn.$sp').directive('spAssessmentTemplate', function(getTemplateUrl, $timeout) {
return {
restrict: 'E',
templateUrl: getTemplateUrl('sp_assessment_template.xml'),
scope: {
field: '=?',
fields: '=?',
templateGroup: '=?',
getGlideForm: '&glideForm'
},
controller: function($scope) {
var numChoices = $scope.field.choices.length;
if (numChoices > 0 && numChoices <= 5) {
$scope.questionWidth = 40;
$scope.choiceWidth = 100 / numChoices;
} else if (numChoices > 5) {
$scope.questionWidth = 15;
$scope.choiceWidth = 100 / numChoices;
}
$scope.selectChoice = function(name, value) {
if (angular.isDefined(value)) {
$scope.getGlideForm().setValue(name, value, value);
}
};
}
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/directive.spAssessmentDetails.js */
angular.module('sn.$sp').directive('spAssessmentDetails', function(getTemplateUrl, $sce, i18n, $timeout, cabrillo) {
'use strict';
return {
restrict : 'E',
templateUrl: getTemplateUrl('sp_assessment_details.xml'),
scope: {
htmlDetails: '=',
paddingRequired: '=?',
clampLine: '=',
isMobile: '=?',
fieldId: '=',
isCategory: '=',
label : '='
},
link: function(scope, element) {
function init(fieldName) {
$timeout(function () {
var elm;
if (fieldName)
elm = element.find('#sp_assessment_details_' + fieldName);
else
elm = element.find('.show-more-box');
if (!elm || !elm[0])
return;
var showMoreText = $(elm[0]);
var showMoreButton = $(element.find('.show-more-control'));
var elementLineHeight = parseInt(elm.css('line-height'));
showMoreText[0].style.maxHeight = '';
var allowedHeight = elm[0].offsetHeight/elementLineHeight;
if (allowedHeight > scope.clampLine) {
scope.showMore = true;
showMoreText.addClass('details-text');
showMoreText[0].style.maxHeight = elementLineHeight * scope.clampLine + 'px';
showMoreButton.removeClass('hide-button');
}
else {
scope.showMore = false;
showMoreText.removeClass('details-text');
showMoreText[0].style.maxHeight = '';
showMoreButton.addClass('hide-button');
}
});
}
init();
scope.$on("sp.assessment.details.visible", function (evt, fieldName) {
init(fieldName);
});
},
controller : function($scope, $element) {
$scope.isNative = cabrillo.isNative();
$scope.showMore = true;
$scope.controlMessages = [];
i18n.getMessages([ 'Show less', 'Show more'], function(msgs) {
$scope.controlMessages = msgs;
});
$scope.showMoreMsg = i18n.format(i18n.getMessage("{0} details show more"), $scope.label);
$scope.showLessMsg = i18n.format(i18n.getMessage("{0} details show less"), $scope.label);
$scope.showMoreClicked = function() {
$scope.showMore = !$scope.showMore;
$timeout(function () {
var elm = $element.find('.show-more-box');
if (!elm)
return;
elm[0].style.maxHeight = $scope.showMore ? parseInt(elm.css('line-height')) * $scope.clampLine + 'px' : '';
var scrollElm;
if ($scope.isCategory)
scrollElm = $element.closest('.category-container').find('.category-heading-section');
else
scrollElm = $element.closest('.asmt-question-border');
if (scrollElm && $scope.showMore) {
$element.focus();
scrollElm[0].scrollIntoView();
}
});
}
$scope.trustedHTML = function(html) {
return $sce.trustAsHtml(html);
}
}
};
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/service.spAsmtFieldPropertyDecorator.js */
angular.module('sn.$sp').factory('spAsmtFieldPropertyDecorator', function() {
"use strict";
function decorateAssessmentFields(fields, g_form) {
var _fields = fields;
_fields.forEach(function (field) {
switch(field.type) {
case 'number':
_overLoadNumberInvalidProperty(field, g_form);
return;
case 'string':
case 'textarea':
_overLoadStringInvalidProperty(field, g_form);
return;
}
});
}
function _overLoadNumberInvalidProperty(field, g_form) {
Object.defineProperty(field, 'isInvalid', {
set: function (isInvalid) {
field._isInvalid = isInvalid;
},
get: function() {
return field._isInvalid || field.isInvalidInput;
},
configurable: true
});
}
function _overLoadStringInvalidProperty(field, g_form) {
Object.defineProperty(field, 'isInvalid', {
set: function (isInvalid) {
field._isInvalid = isInvalid;
},
get: function() {
return field._isInvalid || field.isServerInvalid;
},
configurable: true
});
}
return {
decorate : decorateAssessmentFields
}
});
;
/*! RESOURCE: /scripts/app.$sp/assessment/service.spAsmtDirtyFormManager.js */
angular.module('sn.$sp').factory('spAsmtDirtyFormManager', function($rootScope, $window, spModal, i18n, cabrillo) {
'use strict';
var registeredForms = {};
var nativeMobile;
var isModalOpen = false;
function registerForm (form) {
registeredForms[form.getSysId()] = form;
}
function isNative (native) {
nativeMobile = native;
}
function unregisterForms (sysIds) {
sysIds.forEach(function (sysId) {
delete registeredForms[sysId];
});
}
function checkForDirtyForms() {
var includedForms = Object.keys(registeredForms);
var isFormDirty = false;
for (var i in includedForms) {
var fieldNames = registeredForms[includedForms[i]].getFieldNames();
isFormDirty = fieldNames.some(function(fieldName){
var field = registeredForms[includedForms[i]].getField(fieldName);
if ((typeof field.original_add_info !== 'undefined' && field.original_add_info !== field.add_info) || (field.type !== 'attachment' && field.originalValue !== field.value))
return true;
});
if (isFormDirty)
break;
}
return isFormDirty;
}
function clearCabrilloButtons() {
if (cabrillo.isNative() && nativeMobile) {
cabrillo.viewLayout.setTitle('');
cabrillo.viewLayout.setNavigationBarButtons();
cabrillo.viewLayout.setBottomButtons();
}
}
$rootScope.$on('$locationChangeStart', function(event, next) {
if (Object.keys(registeredForms).length == 0)
return;
if (checkForDirtyForms()) {
event.preventDefault();
var options = {
title:i18n.getMessage("Leave page?"),
headerStyle: {border: 'none', 'padding-bottom': 0},
footerStyle: {border: 'none', 'padding-top': 0},
message: i18n.getMessage("Changes you made will be lost."),
buttons: [
{label: i18n.getMessage("Cancel"), value: "cancel"},
{label: i18n.getMessage("Leave"), primary: true, value: "leave"}
]
};
if (cabrillo.isNative() && nativeMobile) {
var title = i18n.format("{0} {1}", options.title, options.message);
if (confirm(title)) {
clearCabrilloButtons();
$window.location = next;
}
} else {
isModalOpen = true;
spModal.open(options).then(function(confirm) {
if(confirm.value == "leave") {
$window.location = next;
}
isModalOpen = false;
}, function() {
isModalOpen = false;
});
}
} else {
clearCabrilloButtons();
}
});
$window.onbeforeunload = function() {
if (Object.keys(registeredForms).length != 0 && (checkForDirtyForms() && !isModalOpen))
return true;
}
return {
register: registerForm,
unregisterForms: unregisterForms,
isNative: isNative
}
});
;
;
/*! RESOURCE: /scripts/app.$sp/app.config.js */
angular.module('sn.$sp').config(function(
$compileProvider,
$controllerProvider,
$locationProvider,
lazyLoaderProvider,
$provide,
$httpProvider,
$ariaProvider) {
$locationProvider.html5Mode({enabled: true, requireBase: false});
$httpProvider.interceptors.push('spInterceptor');
lazyLoaderProvider.set({
register: $controllerProvider.register,
directive: $compileProvider.directive,
factory: $provide.factory,
value: $provide.value,
service: $provide.service
});
$ariaProvider.config({
ariaHidden: true,
ariaChecked: true,
ariaReadonly: true,
ariaDisabled: true,
ariaRequired: true,
ariaInvalid: false,
ariaValue: true,
tabindex: false,
bindKeydown: true,
bindRoleForClick: true
});
}).run(function($rootScope, spPageData, spConf, spUtil) {
$rootScope.portal = spPageData.getPortal();
$rootScope.portal.logoutUrl = spUtil.format(spConf.logoutUrl, {
url_suffix: $rootScope.portal.url_suffix
});
});
;
;