Snippet:
Filter
Source
Rendered
linky filter
<div ng-bind-html="snippet | linky"> </div>
linky target
<div ng-bind-html="snippetWithSingleURL | linky:'_blank'"> </div>
linky custom attributes
<div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"> </div>
no filter
<div ng-bind="snippet"> </div>
angular.module('linkyExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.snippet =
'Pretty text with some links:\n' +
'http://angularjs.org/,\n' +
'mailto:us@somewhere.org,\n' +
'another@somewhere.org,\n' +
'and one more: ftp://127.0.0.1/.';
$scope.snippetWithSingleURL = 'http://angularjs.org/';
}]);
it('should linkify the snippet with urls', function() {
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
});
it('should not linkify snippet without the linky filter', function() {
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new http://link.');
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('new http://link.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
.toBe('new http://link.');
});
it('should work with the target property', function() {
expect(element(by.id('linky-target')).
element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
});
it('should optionally add custom attributes', function() {
expect(element(by.id('linky-custom-attributes')).
element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
});
*/
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
var LINKY_URL_REGEXP =
/((s?ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
MAILTO_REGEXP = /^mailto:/i;
var linkyMinErr = angular.$$minErr('linky');
var isDefined = angular.isDefined;
var isFunction = angular.isFunction;
var isObject = angular.isObject;
var isString = angular.isString;
return function(text, target, attributes) {
if (text == null || text === '') return text;
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
var attributesFn =
isFunction(attributes) ? attributes :
isObject(attributes) ? function getAttributesObject() {return attributes;} :
function getEmptyAttributesObject() {return {};};
var match;
var raw = text;
var html = [];
var url;
var i;
while ((match = raw.match(LINKY_URL_REGEXP))) {
// We can not end in these as they are sometimes found at the end of the sentence
url = match[0];
// if we did not match ftp/http/www/mailto then assume mailto
if (!match[2] && !match[4]) {
url = (match[3] ? 'http://' : 'mailto:') + url;
}
i = match.index;
addText(raw.substr(0, i));
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
raw = raw.substring(i + match[0].length);
}
addText(raw);
return $sanitize(html.join(''));
function addText(text) {
if (!text) {
return;
}
html.push(sanitizeText(text));
}
function addLink(url, text) {
var key, linkAttributes = attributesFn(url);
html.push('
');
addText(text);
html.push(' ');
}
};
}]);
})(window, window.angular);
/**
* @license AngularJS v1.7.8
* (c) 2010-2018 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular) {'use strict';
/**
* @ngdoc module
* @name ngTouch
* @description
*
* The `ngTouch` module provides helpers for touch-enabled devices.
* The implementation is based on jQuery Mobile touch event handling
* ([jquerymobile.com](http://jquerymobile.com/)). *
*
* See {@link ngTouch.$swipe `$swipe`} for usage.
*
* @deprecated
* sinceVersion="1.7.0"
* The ngTouch module with the {@link ngTouch.$swipe `$swipe`} service and
* the {@link ngTouch.ngSwipeLeft} and {@link ngTouch.ngSwipeRight} directives are
* deprecated. Instead, stand-alone libraries for touch handling and gesture interaction
* should be used, for example [HammerJS](https://hammerjs.github.io/) (which is also used by
* Angular).
*/
// define ngTouch module
/* global ngTouch */
var ngTouch = angular.module('ngTouch', []);
ngTouch.info({ angularVersion: '1.7.8' });
function nodeName_(element) {
return angular.$$lowercase(element.nodeName || (element[0] && element[0].nodeName));
}
/* global ngTouch: false */
/**
* @ngdoc service
* @name $swipe
*
* @deprecated
* sinceVersion="1.7.0"
*
* See the {@link ngTouch module} documentation for more information.
*
* @description
* The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
* behavior, to make implementing swipe-related directives more convenient.
*
* Requires the {@link ngTouch `ngTouch`} module to be installed.
*
* `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`.
*
* # Usage
* The `$swipe` service is an object with a single method: `bind`. `bind` takes an element
* which is to be watched for swipes, and an object with four handler functions. See the
* documentation for `bind` below.
*/
ngTouch.factory('$swipe', [function() {
// The total distance in any direction before we make the call on swipe vs. scroll.
var MOVE_BUFFER_RADIUS = 10;
var POINTER_EVENTS = {
'mouse': {
start: 'mousedown',
move: 'mousemove',
end: 'mouseup'
},
'touch': {
start: 'touchstart',
move: 'touchmove',
end: 'touchend',
cancel: 'touchcancel'
},
'pointer': {
start: 'pointerdown',
move: 'pointermove',
end: 'pointerup',
cancel: 'pointercancel'
}
};
function getCoordinates(event) {
var originalEvent = event.originalEvent || event;
var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];
return {
x: e.clientX,
y: e.clientY
};
}
function getEvents(pointerTypes, eventType) {
var res = [];
angular.forEach(pointerTypes, function(pointerType) {
var eventName = POINTER_EVENTS[pointerType][eventType];
if (eventName) {
res.push(eventName);
}
});
return res.join(' ');
}
return {
/**
* @ngdoc method
* @name $swipe#bind
*
* @description
* The main method of `$swipe`. It takes an element to be watched for swipe motions, and an
* object containing event handlers.
* The pointer types that should be used can be specified via the optional
* third argument, which is an array of strings `'mouse'`, `'touch'` and `'pointer'`. By default,
* `$swipe` will listen for `mouse`, `touch` and `pointer` events.
*
* The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end`
* receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }` and the raw
* `event`. `cancel` receives the raw `event` as its single parameter.
*
* `start` is called on either `mousedown`, `touchstart` or `pointerdown`. After this event, `$swipe` is
* watching for `touchmove`, `mousemove` or `pointermove` events. These events are ignored until the total
* distance moved in either dimension exceeds a small threshold.
*
* Once this threshold is exceeded, either the horizontal or vertical delta is greater.
* - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.
* - If the vertical distance is greater, this is a scroll, and we let the browser take over.
* A `cancel` event is sent.
*
* `move` is called on `mousemove`, `touchmove` and `pointermove` after the above logic has determined that
* a swipe is in progress.
*
* `end` is called when a swipe is successfully completed with a `touchend`, `mouseup` or `pointerup`.
*
* `cancel` is called either on a `touchcancel` or `pointercancel` from the browser, or when we begin scrolling
* as described above.
*
*/
bind: function(element, eventHandlers, pointerTypes) {
// Absolute total movement, used to control swipe vs. scroll.
var totalX, totalY;
// Coordinates of the start position.
var startCoords;
// Last event's position.
var lastPos;
// Whether a swipe is active.
var active = false;
pointerTypes = pointerTypes || ['mouse', 'touch', 'pointer'];
element.on(getEvents(pointerTypes, 'start'), function(event) {
startCoords = getCoordinates(event);
active = true;
totalX = 0;
totalY = 0;
lastPos = startCoords;
if (eventHandlers['start']) {
eventHandlers['start'](startCoords, event);
}
});
var events = getEvents(pointerTypes, 'cancel');
if (events) {
element.on(events, function(event) {
active = false;
if (eventHandlers['cancel']) {
eventHandlers['cancel'](event);
}
});
}
element.on(getEvents(pointerTypes, 'move'), function(event) {
if (!active) return;
// Android will send a touchcancel if it thinks we're starting to scroll.
// So when the total distance (+ or - or both) exceeds 10px in either direction,
// we either:
// - On totalX > totalY, we send preventDefault() and treat this as a swipe.
// - On totalY > totalX, we let the browser handle it as a scroll.
if (!startCoords) return;
var coords = getCoordinates(event);
totalX += Math.abs(coords.x - lastPos.x);
totalY += Math.abs(coords.y - lastPos.y);
lastPos = coords;
if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {
return;
}
// One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.
if (totalY > totalX) {
// Allow native scrolling to take over.
active = false;
if (eventHandlers['cancel']) {
eventHandlers['cancel'](event);
}
return;
} else {
// Prevent the browser from scrolling.
event.preventDefault();
if (eventHandlers['move']) {
eventHandlers['move'](coords, event);
}
}
});
element.on(getEvents(pointerTypes, 'end'), function(event) {
if (!active) return;
active = false;
if (eventHandlers['end']) {
eventHandlers['end'](getCoordinates(event), event);
}
});
}
};
}]);
/* global ngTouch: false */
/**
* @ngdoc directive
* @name ngSwipeLeft
*
* @deprecated
* sinceVersion="1.7.0"
*
* See the {@link ngTouch module} documentation for more information.
*
* @description
* Specify custom behavior when an element is swiped to the left on a touchscreen device.
* A leftward swipe is a quick, right-to-left slide of the finger.
* Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag
* too.
*
* To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to
* the `ng-swipe-left` or `ng-swipe-right` DOM Element.
*
* Requires the {@link ngTouch `ngTouch`} module to be installed.
*
* @element ANY
* @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate
* upon left swipe. (Event object is available as `$event`)
*
* @example
Some list content, like an email in the inbox
Reply
Delete
angular.module('ngSwipeLeftExample', ['ngTouch']);
*/
/**
* @ngdoc directive
* @name ngSwipeRight
*
* @deprecated
* sinceVersion="1.7.0"
*
* See the {@link ngTouch module} documentation for more information.
*
* @description
* Specify custom behavior when an element is swiped to the right on a touchscreen device.
* A rightward swipe is a quick, left-to-right slide of the finger.
* Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag
* too.
*
* Requires the {@link ngTouch `ngTouch`} module to be installed.
*
* @element ANY
* @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate
* upon right swipe. (Event object is available as `$event`)
*
* @example
Some list content, like an email in the inbox
Reply
Delete
angular.module('ngSwipeRightExample', ['ngTouch']);
*/
function makeSwipeDirective(directiveName, direction, eventName) {
ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
// The maximum vertical delta for a swipe should be less than 75px.
var MAX_VERTICAL_DISTANCE = 75;
// Vertical distance should not be more than a fraction of the horizontal distance.
var MAX_VERTICAL_RATIO = 0.3;
// At least a 30px lateral motion is necessary for a swipe.
var MIN_HORIZONTAL_DISTANCE = 30;
return function(scope, element, attr) {
var swipeHandler = $parse(attr[directiveName]);
var startCoords, valid;
function validSwipe(coords) {
// Check that it's within the coordinates.
// Absolute vertical distance must be within tolerances.
// Horizontal distance, we take the current X - the starting X.
// This is negative for leftward swipes and positive for rightward swipes.
// After multiplying by the direction (-1 for left, +1 for right), legal swipes
// (ie. same direction as the directive wants) will have a positive delta and
// illegal ones a negative delta.
// Therefore this delta must be positive, and larger than the minimum.
if (!startCoords) return false;
var deltaY = Math.abs(coords.y - startCoords.y);
var deltaX = (coords.x - startCoords.x) * direction;
return valid && // Short circuit for already-invalidated swipes.
deltaY < MAX_VERTICAL_DISTANCE &&
deltaX > 0 &&
deltaX > MIN_HORIZONTAL_DISTANCE &&
deltaY / deltaX < MAX_VERTICAL_RATIO;
}
var pointerTypes = ['touch'];
if (!angular.isDefined(attr['ngSwipeDisableMouse'])) {
pointerTypes.push('mouse');
}
$swipe.bind(element, {
'start': function(coords, event) {
startCoords = coords;
valid = true;
},
'cancel': function(event) {
valid = false;
},
'end': function(coords, event) {
if (validSwipe(coords)) {
scope.$apply(function() {
element.triggerHandler(eventName);
swipeHandler(scope, {$event: event});
});
}
}
}, pointerTypes);
};
}]);
}
// Left is negative X-coordinate, right is positive.
makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');
makeSwipeDirective('ngSwipeRight', 1, 'swiperight');
})(window, window.angular);
/*!
* angular-loading-bar v0.9.0
* https://chieffancypants.github.io/angular-loading-bar
* Copyright (c) 2016 Wes Cruver
* License: MIT
*/
!function(){"use strict";angular.module("angular-loading-bar",["cfp.loadingBarInterceptor"]),angular.module("chieffancypants.loadingBar",["cfp.loadingBarInterceptor"]),angular.module("cfp.loadingBarInterceptor",["cfp.loadingBar"]).config(["$httpProvider",function(a){var b=["$q","$cacheFactory","$timeout","$rootScope","$log","cfpLoadingBar",function(b,c,d,e,f,g){function h(){d.cancel(j),g.complete(),l=0,k=0}function i(b){var d,e=c.get("$http"),f=a.defaults;!b.cache&&!f.cache||b.cache===!1||"GET"!==b.method&&"JSONP"!==b.method||(d=angular.isObject(b.cache)?b.cache:angular.isObject(f.cache)?f.cache:e);var g=void 0!==d?void 0!==d.get(b.url):!1;return void 0!==b.cached&&g!==b.cached?b.cached:(b.cached=g,g)}var j,k=0,l=0,m=g.latencyThreshold;return{request:function(a){return a.ignoreLoadingBar||i(a)||(e.$broadcast("cfpLoadingBar:loading",{url:a.url}),0===k&&(j=d(function(){g.start()},m)),k++,g.set(l/k)),a},response:function(a){return a&&a.config?(a.config.ignoreLoadingBar||i(a.config)||(l++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url,result:a}),l>=k?h():g.set(l/k)),a):(f.error("Broken interceptor detected: Config object not supplied in response:\n https://github.com/chieffancypants/angular-loading-bar/pull/50"),a)},responseError:function(a){return a&&a.config?(a.config.ignoreLoadingBar||i(a.config)||(l++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url,result:a}),l>=k?h():g.set(l/k)),b.reject(a)):(f.error("Broken interceptor detected: Config object not supplied in rejection:\n https://github.com/chieffancypants/angular-loading-bar/pull/50"),b.reject(a))}}}];a.interceptors.push(b)}]),angular.module("cfp.loadingBar",[]).provider("cfpLoadingBar",function(){this.autoIncrement=!0,this.includeSpinner=!0,this.includeBar=!0,this.latencyThreshold=100,this.startSize=.02,this.parentSelector="body",this.spinnerTemplate='
',this.loadingBarTemplate='
',this.$get=["$injector","$document","$timeout","$rootScope",function(a,b,c,d){function e(){if(k||(k=a.get("$animate")),c.cancel(m),!r){var e=b[0],g=e.querySelector?e.querySelector(n):b.find(n)[0];g||(g=e.getElementsByTagName("body")[0]);var h=angular.element(g),i=g.lastChild&&angular.element(g.lastChild);d.$broadcast("cfpLoadingBar:started"),r=!0,v&&k.enter(o,h,i),u&&k.enter(q,h,o),f(w)}}function f(a){if(r){var b=100*a+"%";p.css("width",b),s=a,t&&(c.cancel(l),l=c(function(){g()},250))}}function g(){if(!(h()>=1)){var a=0,b=h();a=b>=0&&.25>b?(3*Math.random()+3)/100:b>=.25&&.65>b?3*Math.random()/100:b>=.65&&.9>b?2*Math.random()/100:b>=.9&&.99>b?.005:0;var c=h()+a;f(c)}}function h(){return s}function i(){s=0,r=!1}function j(){k||(k=a.get("$animate")),d.$broadcast("cfpLoadingBar:completed"),f(1),c.cancel(m),m=c(function(){var a=k.leave(o,i);a&&a.then&&a.then(i),k.leave(q)},500)}var k,l,m,n=this.parentSelector,o=angular.element(this.loadingBarTemplate),p=o.find("div").eq(0),q=angular.element(this.spinnerTemplate),r=!1,s=0,t=this.autoIncrement,u=this.includeSpinner,v=this.includeBar,w=this.startSize;return{start:e,set:f,status:h,inc:g,complete:j,autoIncrement:this.autoIncrement,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})}();
/*
* angular-ui-bootstrap
* http://angular-ui.github.io/bootstrap/
* Version: 2.5.0 - 2017-01-28
* License: MIT
*/angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.collapse", "ui.bootstrap.tabindex", "ui.bootstrap.accordion", "ui.bootstrap.alert", "ui.bootstrap.buttons", "ui.bootstrap.carousel", "ui.bootstrap.dateparser", "ui.bootstrap.isClass", "ui.bootstrap.datepicker", "ui.bootstrap.position", "ui.bootstrap.datepickerPopup", "ui.bootstrap.debounce", "ui.bootstrap.multiMap", "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/year.html", "uib/template/datepickerPopup/popup.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 (a, b, c, d) { var e = d.has("$animateCss") ? d.get("$animateCss") : null; return { link: function (d, f, g) { function h() { r = !!("horizontal" in g), r ? (s = { width: "" }, t = { width: "0" }) : (s = { height: "" }, t = { height: "0" }), d.$eval(g.uibCollapse) || f.addClass("in").addClass("collapse").attr("aria-expanded", !0).attr("aria-hidden", !1).css(s) } function i(a) { return r ? { width: a.scrollWidth + "px" } : { height: a.scrollHeight + "px" } } function j() { f.hasClass("collapse") && f.hasClass("in") || b.resolve(n(d)).then(function () { f.removeClass("collapse").addClass("collapsing").attr("aria-expanded", !0).attr("aria-hidden", !1), e ? e(f, { addClass: "in", easing: "ease", css: { overflow: "hidden" }, to: i(f[0]) }).start()["finally"](k) : a.addClass(f, "in", { css: { overflow: "hidden" }, to: i(f[0]) }).then(k) }, angular.noop) } function k() { f.removeClass("collapsing").addClass("collapse").css(s), o(d) } function l() { return f.hasClass("collapse") || f.hasClass("in") ? void b.resolve(p(d)).then(function () { f.css(i(f[0])).removeClass("collapse").addClass("collapsing").attr("aria-expanded", !1).attr("aria-hidden", !0), e ? e(f, { removeClass: "in", to: t }).start()["finally"](m) : a.removeClass(f, "in", { to: t }).then(m) }, angular.noop) : m() } function m() { f.css(t), f.removeClass("collapsing").addClass("collapse"), q(d) } var n = c(g.expanding), o = c(g.expanded), p = c(g.collapsing), q = c(g.collapsed), r = !1, s = {}, t = {}; h(), d.$watch(g.uibCollapse, function (a) { a ? l() : j() }) } } }]), angular.module("ui.bootstrap.tabindex", []).directive("uibTabindexToggle", function () { return { restrict: "A", link: function (a, b, c) { c.$observe("disabled", function (a) { c.$set("tabindex", a ? -1 : null) }) } } }), angular.module("ui.bootstrap.accordion", ["ui.bootstrap.collapse", "ui.bootstrap.tabindex"]).constant("uibAccordionConfig", { closeOthers: !0 }).controller("UibAccordionController", ["$scope", "$attrs", "uibAccordionConfig", function (a, b, c) { this.groups = [], this.closeOthers = function (d) { var e = angular.isDefined(b.closeOthers) ? a.$eval(b.closeOthers) : c.closeOthers; e && angular.forEach(this.groups, function (a) { a !== d && (a.isOpen = !1) }) }, this.addGroup = function (a) { var b = this; this.groups.push(a), a.$on("$destroy", function (c) { b.removeGroup(a) }) }, this.removeGroup = function (a) { var b = this.groups.indexOf(a); -1 !== b && this.groups.splice(b, 1) } }]).directive("uibAccordion", function () { return { controller: "UibAccordionController", controllerAs: "accordion", transclude: !0, templateUrl: function (a, b) { return b.templateUrl || "uib/template/accordion/accordion.html" } } }).directive("uibAccordionGroup", function () { return { require: "^uibAccordion", transclude: !0, restrict: "A", templateUrl: function (a, b) { return b.templateUrl || "uib/template/accordion/accordion-group.html" }, scope: { heading: "@", panelClass: "@?", isOpen: "=?", isDisabled: "=?" }, controller: function () { this.setHeading = function (a) { this.heading = a } }, link: function (a, b, c, d) { b.addClass("panel"), d.addGroup(a), a.openClass = c.openClass || "panel-open", a.panelClass = c.panelClass || "panel-default", a.$watch("isOpen", function (c) { b.toggleClass(a.openClass, !!c), c && d.closeOthers(a) }), a.toggleOpen = function (b) { a.isDisabled || b && 32 !== b.which || (a.isOpen = !a.isOpen) }; var e = "accordiongroup-" + a.$id + "-" + Math.floor(1e4 * Math.random()); a.headingId = e + "-tab", a.panelId = e + "-panel" } } }).directive("uibAccordionHeading", function () { return { transclude: !0, template: "", replace: !0, require: "^uibAccordionGroup", link: function (a, b, c, d, e) { d.setHeading(e(a, angular.noop)) } } }).directive("uibAccordionTransclude", function () { function a() { return "uib-accordion-header,data-uib-accordion-header,x-uib-accordion-header,uib\\:accordion-header,[uib-accordion-header],[data-uib-accordion-header],[x-uib-accordion-header]" } return { require: "^uibAccordionGroup", link: function (b, c, d, e) { b.$watch(function () { return e[d.uibAccordionTransclude] }, function (b) { if (b) { var d = angular.element(c[0].querySelector(a())); d.html(""), d.append(b) } }) } } }), angular.module("ui.bootstrap.alert", []).controller("UibAlertController", ["$scope", "$element", "$attrs", "$interpolate", "$timeout", function (a, b, c, d, e) { a.closeable = !!c.close, b.addClass("alert"), c.$set("role", "alert"), a.closeable && b.addClass("alert-dismissible"); var f = angular.isDefined(c.dismissOnTimeout) ? d(c.dismissOnTimeout)(a.$parent) : null; f && e(function () { a.close() }, parseInt(f, 10)) }]).directive("uibAlert", function () { return { controller: "UibAlertController", controllerAs: "alert", restrict: "A", templateUrl: function (a, b) { return b.templateUrl || "uib/template/alert/alert.html" }, transclude: !0, scope: { close: "&" } } }), angular.module("ui.bootstrap.buttons", []).constant("uibButtonConfig", { activeClass: "active", toggleEvent: "click" }).controller("UibButtonsController", ["uibButtonConfig", function (a) { this.activeClass = a.activeClass || "active", this.toggleEvent = a.toggleEvent || "click" }]).directive("uibBtnRadio", ["$parse", function (a) { return { require: ["uibBtnRadio", "ngModel"], controller: "UibButtonsController", controllerAs: "buttons", link: function (b, c, d, e) { var f = e[0], g = e[1], h = a(d.uibUncheckable); c.find("input").css({ display: "none" }), g.$render = function () { c.toggleClass(f.activeClass, angular.equals(g.$modelValue, b.$eval(d.uibBtnRadio))) }, c.on(f.toggleEvent, function () { if (!d.disabled) { var a = c.hasClass(f.activeClass); a && !angular.isDefined(d.uncheckable) || b.$apply(function () { g.$setViewValue(a ? null : b.$eval(d.uibBtnRadio)), g.$render() }) } }), d.uibUncheckable && b.$watch(h, function (a) { d.$set("uncheckable", a ? "" : void 0) }) } } }]).directive("uibBtnCheckbox", function () { return { require: ["uibBtnCheckbox", "ngModel"], controller: "UibButtonsController", controllerAs: "button", link: function (a, b, c, d) { function e() { return g(c.btnCheckboxTrue, !0) } function f() { return g(c.btnCheckboxFalse, !1) } function g(b, c) { return angular.isDefined(b) ? a.$eval(b) : c } var h = d[0], i = d[1]; b.find("input").css({ display: "none" }), i.$render = function () { b.toggleClass(h.activeClass, angular.equals(i.$modelValue, e())) }, b.on(h.toggleEvent, function () { c.disabled || a.$apply(function () { i.$setViewValue(b.hasClass(h.activeClass) ? f() : e()), i.$render() }) }) } } }), angular.module("ui.bootstrap.carousel", []).controller("UibCarouselController", ["$scope", "$element", "$interval", "$timeout", "$animate", function (a, b, c, d, e) { function f(a) { for (var b = 0; b < p.length; b++) p[b].slide.active = b === a } function g(c, d, g) { if (!s) { if (angular.extend(c, { direction: g }), angular.extend(p[r].slide || {}, { direction: g }), e.enabled(b) && !a.$currentTransition && p[d].element && o.slides.length > 1) { p[d].element.data(q, c.direction); var h = o.getCurrentIndex(); angular.isNumber(h) && p[h].element && p[h].element.data(q, c.direction), a.$currentTransition = !0, e.on("addClass", p[d].element, function (b, c) { "close" === c && (a.$currentTransition = null, e.off("addClass", b)) }) } a.active = c.index, r = c.index, f(d), k() } } function h(a) { for (var b = 0; b < p.length; b++) if (p[b].slide === a) return b } function i() { m && (c.cancel(m), m = null) } function j(b) { b.length || (a.$currentTransition = null) } function k() { i(); var b = +a.interval; !isNaN(b) && b > 0 && (m = c(l, b)) } function l() { var b = +a.interval; n && !isNaN(b) && b > 0 && p.length ? a.next() : a.pause() } var m, n, o = this, p = o.slides = a.slides = [], q = "uib-slideDirection", r = a.active, s = !1; b.addClass("carousel"), o.addSlide = function (b, c) { p.push({ slide: b, element: c }), p.sort(function (a, b) { return +a.slide.index - +b.slide.index }), (b.index === a.active || 1 === p.length && !angular.isNumber(a.active)) && (a.$currentTransition && (a.$currentTransition = null), r = b.index, a.active = b.index, f(r), o.select(p[h(b)]), 1 === p.length && a.play()) }, o.getCurrentIndex = function () { for (var a = 0; a < p.length; a++) if (p[a].slide.index === r) return a }, o.next = a.next = function () { var b = (o.getCurrentIndex() + 1) % p.length; return 0 === b && a.noWrap() ? void a.pause() : o.select(p[b], "next") }, o.prev = a.prev = function () { var b = o.getCurrentIndex() - 1 < 0 ? p.length - 1 : o.getCurrentIndex() - 1; return a.noWrap() && b === p.length - 1 ? void a.pause() : o.select(p[b], "prev") }, o.removeSlide = function (b) { var c = h(b); p.splice(c, 1), p.length > 0 && r === c ? c >= p.length ? (r = p.length - 1, a.active = r, f(r), o.select(p[p.length - 1])) : (r = c, a.active = r, f(r), o.select(p[c])) : r > c && (r--, a.active = r), 0 === p.length && (r = null, a.active = null) }, o.select = a.select = function (b, c) { var d = h(b.slide); void 0 === c && (c = d > o.getCurrentIndex() ? "next" : "prev"), b.slide.index === r || a.$currentTransition || g(b.slide, d, c) }, a.indexOfSlide = function (a) { return +a.slide.index }, a.isActive = function (b) { return a.active === b.slide.index }, a.isPrevDisabled = function () { return 0 === a.active && a.noWrap() }, a.isNextDisabled = function () { return a.active === p.length - 1 && a.noWrap() }, a.pause = function () { a.noPause || (n = !1, i()) }, a.play = function () { n || (n = !0, k()) }, b.on("mouseenter", a.pause), b.on("mouseleave", a.play), a.$on("$destroy", function () { s = !0, i() }), a.$watch("noTransition", function (a) { e.enabled(b, !a) }), a.$watch("interval", k), a.$watchCollection("slides", j), a.$watch("active", function (a) { if (angular.isNumber(a) && r !== a) { for (var b = 0; b < p.length; b++) if (p[b].slide.index === a) { a = b; break } var c = p[a]; c && (f(a), o.select(p[a]), r = a) } }) }]).directive("uibCarousel", function () { return { transclude: !0, controller: "UibCarouselController", controllerAs: "carousel", restrict: "A", templateUrl: function (a, b) { return b.templateUrl || "uib/template/carousel/carousel.html" }, scope: { active: "=", interval: "=", noTransition: "=", noPause: "=", noWrap: "&" } } }).directive("uibSlide", ["$animate", function (a) { return { require: "^uibCarousel", restrict: "A", transclude: !0, templateUrl: function (a, b) { return b.templateUrl || "uib/template/carousel/slide.html" }, scope: { actual: "=?", index: "=?" }, link: function (b, c, d, e) { c.addClass("item"), e.addSlide(b, c), b.$on("$destroy", function () { e.removeSlide(b) }), b.$watch("active", function (b) { a[b ? "addClass" : "removeClass"](c, "active") }) } } }]).animation(".item", ["$animateCss", function (a) { function b(a, b, c) { a.removeClass(b), c && c() } var c = "uib-slideDirection"; return { beforeAddClass: function (d, e, f) { if ("active" === e) { var g = !1, h = d.data(c), i = "next" === h ? "left" : "right", j = b.bind(this, d, i + " " + h, f); return d.addClass(h), a(d, { addClass: i }).start().done(j), function () { g = !0 } } f() }, beforeRemoveClass: function (d, e, f) { if ("active" === e) { var g = !1, h = d.data(c), i = "next" === h ? "left" : "right", j = b.bind(this, d, i, f); return a(d, { addClass: i }).start().done(j), function () { g = !0 } } f() } } }]), angular.module("ui.bootstrap.dateparser", []).service("uibDateParser", ["$log", "$locale", "dateFilter", "orderByFilter", "filterFilter", function (a, b, c, d, e) { function f(a) { return e(s, { key: a }, !0)[0] } function g(a) { var b = [], c = a.split(""), e = a.indexOf("'"); if (e > -1) { var f = !1; a = a.split(""); for (var g = e; g < a.length; g++) f ? ("'" === a[g] && (g + 1 < a.length && "'" === a[g + 1] ? (a[g + 1] = "$", c[g + 1] = "") : (c[g] = "", f = !1)), a[g] = "$") : "'" === a[g] && (a[g] = "$", c[g] = "", f = !0); a = a.join("") } return angular.forEach(s, function (d) { var e = a.indexOf(d.key); if (e > -1) { a = a.split(""), c[e] = "(" + d.regex + ")", a[e] = "$"; for (var f = e + 1, g = e + d.key.length; g > f; f++) c[f] = "", a[f] = "$"; a = a.join(""), b.push({ index: e, key: d.key, apply: d.apply, matcher: d.regex }) } }), { regex: new RegExp("^" + c.join("") + "$"), map: d(b, "index") } } function h(a) { for (var b, c, d = [], e = 0; e < a.length;) if (angular.isNumber(c)) { if ("'" === a.charAt(e)) (e + 1 >= a.length || "'" !== a.charAt(e + 1)) && (d.push(i(a, c, e)), c = null); else if (e === a.length) for (; c < a.length;) b = j(a, c), d.push(b), c = b.endIdx; e++ } else "'" !== a.charAt(e) ? (b = j(a, e), d.push(b.parser), e = b.endIdx) : (c = e, e++); return d } function i(a, b, c) { return function () { return a.substr(b + 1, c - b - 1) } } function j(a, b) { for (var c = a.substr(b), d = 0; d < s.length; d++) if (new RegExp("^" + s[d].key).test(c)) { var e = s[d]; return { endIdx: b + e.key.length, parser: e.formatter } } return { endIdx: b + 1, parser: function () { return c.charAt(0) } } } function k(a, b, c) { return 1 > c ? !1 : 1 === b && c > 28 ? 29 === c && (a % 4 === 0 && a % 100 !== 0 || a % 400 === 0) : 3 === b || 5 === b || 8 === b || 10 === b ? 31 > c : !0 } function l(a) { return parseInt(a, 10) } function m(a, b) { return a && b ? q(a, b) : a } function n(a, b) { return a && b ? q(a, b, !0) : a } function o(a, b) { a = a.replace(/:/g, ""); var c = Date.parse("Jan 01, 1970 00:00:00 " + a) / 6e4; return isNaN(c) ? b : c } function p(a, b) { return a = new Date(a.getTime()), a.setMinutes(a.getMinutes() + b), a } function q(a, b, c) { c = c ? -1 : 1; var d = a.getTimezoneOffset(), e = o(b, d); return p(a, c * (e - d)) } var r, s, t = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; this.init = function () { r = b.id, this.parsers = {}, this.formatters = {}, s = [{ key: "yyyy", regex: "\\d{4}", apply: function (a) { this.year = +a }, formatter: function (a) { var b = new Date; return b.setFullYear(Math.abs(a.getFullYear())), c(b, "yyyy") } }, { key: "yy", regex: "\\d{2}", apply: function (a) { a = +a, this.year = 69 > a ? a + 2e3 : a + 1900 }, formatter: function (a) { var b = new Date; return b.setFullYear(Math.abs(a.getFullYear())), c(b, "yy") } }, { key: "y", regex: "\\d{1,4}", apply: function (a) { this.year = +a }, formatter: function (a) { var b = new Date; return b.setFullYear(Math.abs(a.getFullYear())), c(b, "y") } }, { key: "M!", regex: "0?[1-9]|1[0-2]", apply: function (a) { this.month = a - 1 }, formatter: function (a) { var b = a.getMonth(); return /^[0-9]$/.test(b) ? c(a, "MM") : c(a, "M") } }, { key: "MMMM", regex: b.DATETIME_FORMATS.MONTH.join("|"), apply: function (a) { this.month = b.DATETIME_FORMATS.MONTH.indexOf(a) }, formatter: function (a) { return c(a, "MMMM") } }, { key: "MMM", regex: b.DATETIME_FORMATS.SHORTMONTH.join("|"), apply: function (a) { this.month = b.DATETIME_FORMATS.SHORTMONTH.indexOf(a) }, formatter: function (a) { return c(a, "MMM") } }, { key: "MM", regex: "0[1-9]|1[0-2]", apply: function (a) { this.month = a - 1 }, formatter: function (a) { return c(a, "MM") } }, { key: "M", regex: "[1-9]|1[0-2]", apply: function (a) { this.month = a - 1 }, formatter: function (a) { return c(a, "M") } }, { key: "d!", regex: "[0-2]?[0-9]{1}|3[0-1]{1}", apply: function (a) { this.date = +a }, formatter: function (a) { var b = a.getDate(); return /^[1-9]$/.test(b) ? c(a, "dd") : c(a, "d") } }, { key: "dd", regex: "[0-2][0-9]{1}|3[0-1]{1}", apply: function (a) { this.date = +a }, formatter: function (a) { return c(a, "dd") } }, { key: "d", regex: "[1-2]?[0-9]{1}|3[0-1]{1}", apply: function (a) { this.date = +a }, formatter: function (a) { return c(a, "d") } }, { key: "EEEE", regex: b.DATETIME_FORMATS.DAY.join("|"), formatter: function (a) { return c(a, "EEEE") } }, { key: "EEE", regex: b.DATETIME_FORMATS.SHORTDAY.join("|"), formatter: function (a) { return c(a, "EEE") } }, { key: "HH", regex: "(?:0|1)[0-9]|2[0-3]", apply: function (a) { this.hours = +a }, formatter: function (a) { return c(a, "HH") } }, { key: "hh", regex: "0[0-9]|1[0-2]", apply: function (a) { this.hours = +a }, formatter: function (a) { return c(a, "hh") } }, { key: "H", regex: "1?[0-9]|2[0-3]", apply: function (a) { this.hours = +a }, formatter: function (a) { return c(a, "H") } }, { key: "h", regex: "[0-9]|1[0-2]", apply: function (a) { this.hours = +a }, formatter: function (a) { return c(a, "h") } }, { key: "mm", regex: "[0-5][0-9]", apply: function (a) { this.minutes = +a }, formatter: function (a) { return c(a, "mm") } }, { key: "m", regex: "[0-9]|[1-5][0-9]", apply: function (a) { this.minutes = +a }, formatter: function (a) { return c(a, "m") } }, { key: "sss", regex: "[0-9][0-9][0-9]", apply: function (a) { this.milliseconds = +a }, formatter: function (a) { return c(a, "sss") } }, { key: "ss", regex: "[0-5][0-9]", apply: function (a) { this.seconds = +a }, formatter: function (a) { return c(a, "ss") } }, { key: "s", regex: "[0-9]|[1-5][0-9]", apply: function (a) { this.seconds = +a }, formatter: function (a) { return c(a, "s") } }, { key: "a", regex: b.DATETIME_FORMATS.AMPMS.join("|"), apply: function (a) { 12 === this.hours && (this.hours = 0), "PM" === a && (this.hours += 12) }, formatter: function (a) { return c(a, "a") } }, { key: "Z", regex: "[+-]\\d{4}", apply: function (a) { var b = a.match(/([+-])(\d{2})(\d{2})/), c = b[1], d = b[2], e = b[3]; this.hours += l(c + d), this.minutes += l(c + e) }, formatter: function (a) { return c(a, "Z") } }, { key: "ww", regex: "[0-4][0-9]|5[0-3]", formatter: function (a) { return c(a, "ww") } }, { key: "w", regex: "[0-9]|[1-4][0-9]|5[0-3]", formatter: function (a) { return c(a, "w") } }, { key: "GGGG", regex: b.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g, "\\s"), formatter: function (a) { return c(a, "GGGG") } }, { key: "GGG", regex: b.DATETIME_FORMATS.ERAS.join("|"), formatter: function (a) { return c(a, "GGG") } }, { key: "GG", regex: b.DATETIME_FORMATS.ERAS.join("|"), formatter: function (a) { return c(a, "GG") } }, { key: "G", regex: b.DATETIME_FORMATS.ERAS.join("|"), formatter: function (a) { return c(a, "G") } }], angular.version.major >= 1 && angular.version.minor > 4 && s.push({ key: "LLLL", regex: b.DATETIME_FORMATS.STANDALONEMONTH.join("|"), apply: function (a) { this.month = b.DATETIME_FORMATS.STANDALONEMONTH.indexOf(a) }, formatter: function (a) { return c(a, "LLLL") } }) }, this.init(), this.getParser = function (a) { var b = f(a); return b && b.apply || null }, this.overrideParser = function (a, b) { var c = f(a); c && angular.isFunction(b) && (this.parsers = {}, c.apply = b) }.bind(this), this.filter = function (a, c) { if (!angular.isDate(a) || isNaN(a) || !c) return ""; c = b.DATETIME_FORMATS[c] || c, b.id !== r && this.init(), this.formatters[c] || (this.formatters[c] = h(c)); var d = this.formatters[c]; return d.reduce(function (b, c) { return b + c(a) }, "") }, this.parse = function (c, d, e) { if (!angular.isString(c) || !d) return c; d = b.DATETIME_FORMATS[d] || d, d = d.replace(t, "\\$&"), b.id !== r && this.init(), this.parsers[d] || (this.parsers[d] = g(d, "apply")); var f = this.parsers[d], h = f.regex, i = f.map, j = c.match(h), l = !1; if (j && j.length) { var m, n; angular.isDate(e) && !isNaN(e.getTime()) ? m = { year: e.getFullYear(), month: e.getMonth(), date: e.getDate(), hours: e.getHours(), minutes: e.getMinutes(), seconds: e.getSeconds(), milliseconds: e.getMilliseconds() } : (e && a.warn("dateparser:", "baseDate is not a valid date"), m = { year: 1900, month: 0, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }); for (var o = 1, p = j.length; p > o; o++) { var q = i[o - 1]; "Z" === q.matcher && (l = !0), q.apply && q.apply.call(m, j[o]) } var s = l ? Date.prototype.setUTCFullYear : Date.prototype.setFullYear, u = l ? Date.prototype.setUTCHours : Date.prototype.setHours; return k(m.year, m.month, m.date) && (!angular.isDate(e) || isNaN(e.getTime()) || l ? (n = new Date(0), s.call(n, m.year, m.month, m.date), u.call(n, m.hours || 0, m.minutes || 0, m.seconds || 0, m.milliseconds || 0)) : (n = new Date(e), s.call(n, m.year, m.month, m.date), u.call(n, m.hours, m.minutes, m.seconds, m.milliseconds))), n } }, this.toTimezone = m, this.fromTimezone = n, this.timezoneToOffset = o, this.addDateMinutes = p, this.convertTimezoneToLocal = q }]), angular.module("ui.bootstrap.isClass", []).directive("uibIsClass", ["$animate", function (a) { var b = /^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/, c = /^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/; return { restrict: "A", compile: function (d, e) { function f(a, b, c) { i.push(a), j.push({ scope: a, element: b }), o.forEach(function (b, c) { g(b, a) }), a.$on("$destroy", h) } function g(b, d) { var e = b.match(c), f = d.$eval(e[1]), g = e[2], h = k[b]; if (!h) { var i = function (b) { var c = null; j.some(function (a) { var d = a.scope.$eval(m); return d === b ? (c = a, !0) : void 0 }), h.lastActivated !== c && (h.lastActivated && a.removeClass(h.lastActivated.element, f), c && a.addClass(c.element, f), h.lastActivated = c) }; k[b] = h = { lastActivated: null, scope: d, watchFn: i, compareWithExp: g, watcher: d.$watch(g, i) } } h.watchFn(d.$eval(g)) } function h(a) { var b = a.targetScope, c = i.indexOf(b); if (i.splice(c, 1), j.splice(c, 1), i.length) { var d = i[0]; angular.forEach(k, function (a) { a.scope === b && (a.watcher = d.$watch(a.compareWithExp, a.watchFn), a.scope = d) }) } else k = {} } var i = [], j = [], k = {}, l = e.uibIsClass.match(b), m = l[2], n = l[1], o = n.split(","); return f } } }]), angular.module("ui.bootstrap.datepicker", ["ui.bootstrap.dateparser", "ui.bootstrap.isClass"]).value("$datepickerSuppressError", !1).value("$datepickerLiteralWarning", !0).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", monthColumns: 3, ngModelOptions: {}, shortcutPropagation: !1, showWeeks: !0, yearColumns: 5, yearRows: 4 }).controller("UibDatepickerController", ["$scope", "$element", "$attrs", "$parse", "$interpolate", "$locale", "$log", "dateFilter", "uibDatepickerConfig", "$datepickerLiteralWarning", "$datepickerSuppressError", "uibDateParser", function (a, b, c, d, e, f, g, h, i, j, k, l) { function m(b) { a.datepickerMode = b, a.datepickerOptions.datepickerMode = b } function n(b) { var c; if (angular.version.minor < 6) c = b.$options || a.datepickerOptions.ngModelOptions || i.ngModelOptions || {}, c.getOption = function (a) { return c[a] }; else { var d = b.$options.getOption("timezone") || (a.datepickerOptions.ngModelOptions ? a.datepickerOptions.ngModelOptions.timezone : null) || (i.ngModelOptions ? i.ngModelOptions.timezone : null); c = b.$options.createChild(i.ngModelOptions).createChild(a.datepickerOptions.ngModelOptions).createChild(b.$options).createChild({ timezone: d }) } return c } var o = this, p = { $setViewValue: angular.noop }, q = {}, r = []; b.addClass("uib-datepicker"), c.$set("role", "application"), a.datepickerOptions || (a.datepickerOptions = {}), this.modes = ["day", "month", "year"], ["customClass", "dateDisabled", "datepickerMode", "formatDay", "formatDayHeader", "formatDayTitle", "formatMonth", "formatMonthTitle", "formatYear", "maxDate", "maxMode", "minDate", "minMode", "monthColumns", "showWeeks", "shortcutPropagation", "startingDay", "yearColumns", "yearRows"].forEach(function (b) { switch (b) { case "customClass": case "dateDisabled": a[b] = a.datepickerOptions[b] || angular.noop; break; case "datepickerMode": a.datepickerMode = angular.isDefined(a.datepickerOptions.datepickerMode) ? a.datepickerOptions.datepickerMode : i.datepickerMode; break; case "formatDay": case "formatDayHeader": case "formatDayTitle": case "formatMonth": case "formatMonthTitle": case "formatYear": o[b] = angular.isDefined(a.datepickerOptions[b]) ? e(a.datepickerOptions[b])(a.$parent) : i[b]; break; case "monthColumns": case "showWeeks": case "shortcutPropagation": case "yearColumns": case "yearRows": o[b] = angular.isDefined(a.datepickerOptions[b]) ? a.datepickerOptions[b] : i[b]; break; case "startingDay": angular.isDefined(a.datepickerOptions.startingDay) ? o.startingDay = a.datepickerOptions.startingDay : angular.isNumber(i.startingDay) ? o.startingDay = i.startingDay : o.startingDay = (f.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7; break; case "maxDate": case "minDate": a.$watch("datepickerOptions." + b, function (a) { a ? angular.isDate(a) ? o[b] = l.fromTimezone(new Date(a), q.getOption("timezone")) : (j && g.warn("Literal date support has been deprecated, please switch to date object usage"), o[b] = new Date(h(a, "medium"))) : o[b] = i[b] ? l.fromTimezone(new Date(i[b]), q.getOption("timezone")) : null, o.refreshView() }); break; case "maxMode": case "minMode": a.datepickerOptions[b] ? a.$watch(function () { return a.datepickerOptions[b] }, function (c) { o[b] = a[b] = angular.isDefined(c) ? c : a.datepickerOptions[b], ("minMode" === b && o.modes.indexOf(a.datepickerOptions.datepickerMode) < o.modes.indexOf(o[b]) || "maxMode" === b && o.modes.indexOf(a.datepickerOptions.datepickerMode) > o.modes.indexOf(o[b])) && (a.datepickerMode = o[b], a.datepickerOptions.datepickerMode = o[b]) }) : o[b] = a[b] = i[b] || null } }), a.uniqueId = "datepicker-" + a.$id + "-" + Math.floor(1e4 * Math.random()), a.disabled = angular.isDefined(c.disabled) || !1, angular.isDefined(c.ngDisabled) && r.push(a.$parent.$watch(c.ngDisabled, function (b) { a.disabled = b, o.refreshView() })), a.isActive = function (b) { return 0 === o.compare(b.date, o.activeDate) ? (a.activeDateId = b.uid, !0) : !1 }, this.init = function (b) { p = b, q = n(p), a.datepickerOptions.initDate ? (o.activeDate = l.fromTimezone(a.datepickerOptions.initDate, q.getOption("timezone")) || new Date, a.$watch("datepickerOptions.initDate", function (a) { a && (p.$isEmpty(p.$modelValue) || p.$invalid) && (o.activeDate = l.fromTimezone(a, q.getOption("timezone")), o.refreshView()) })) : o.activeDate = new Date; var c = p.$modelValue ? new Date(p.$modelValue) : new Date; this.activeDate = isNaN(c) ? l.fromTimezone(new Date, q.getOption("timezone")) : l.fromTimezone(c, q.getOption("timezone")), p.$render = function () { o.render() } }, this.render = function () { if (p.$viewValue) { var a = new Date(p.$viewValue), b = !isNaN(a); b ? this.activeDate = l.fromTimezone(a, q.getOption("timezone")) : k || g.error('Datepicker directive: "ng-model" value must be a Date object') } this.refreshView() }, this.refreshView = function () { if (this.element) { a.selectedDt = null, this._refreshView(), a.activeDt && (a.activeDateId = a.activeDt.uid); var b = p.$viewValue ? new Date(p.$viewValue) : null; b = l.fromTimezone(b, q.getOption("timezone")), p.$setValidity("dateDisabled", !b || this.element && !this.isDisabled(b)) } }, this.createDateObject = function (b, c) { var d = p.$viewValue ? new Date(p.$viewValue) : null; d = l.fromTimezone(d, q.getOption("timezone")); var e = new Date; e = l.fromTimezone(e, q.getOption("timezone")); var f = this.compare(b, e), g = { date: b, label: l.filter(b, c), selected: d && 0 === this.compare(b, d), disabled: this.isDisabled(b), past: 0 > f, current: 0 === f, future: f > 0, customClass: this.customClass(b) || null }; return d && 0 === this.compare(b, d) && (a.selectedDt = g), o.activeDate && 0 === this.compare(g.date, o.activeDate) && (a.activeDt = g), g }, this.isDisabled = function (b) { return a.disabled || this.minDate && this.compare(b, this.minDate) < 0 || this.maxDate && this.compare(b, this.maxDate) > 0 || a.dateDisabled && a.dateDisabled({ date: b, mode: a.datepickerMode }) }, this.customClass = function (b) { return a.customClass({ date: b, mode: a.datepickerMode }) }, this.split = function (a, b) { for (var c = []; a.length > 0;) c.push(a.splice(0, b)); return c }, a.select = function (b) { if (a.datepickerMode === o.minMode) { var c = p.$viewValue ? l.fromTimezone(new Date(p.$viewValue), q.getOption("timezone")) : new Date(0, 0, 0, 0, 0, 0, 0); c.setFullYear(b.getFullYear(), b.getMonth(), b.getDate()), c = l.toTimezone(c, q.getOption("timezone")), p.$setViewValue(c), p.$render() } else o.activeDate = b, m(o.modes[o.modes.indexOf(a.datepickerMode) - 1]), a.$emit("uib:datepicker.mode"); a.$broadcast("uib:datepicker.focus") }, a.move = function (a) { var b = o.activeDate.getFullYear() + a * (o.step.years || 0), c = o.activeDate.getMonth() + a * (o.step.months || 0); o.activeDate.setFullYear(b, c, 1), o.refreshView() }, a.toggleMode = function (b) { b = b || 1, a.datepickerMode === o.maxMode && 1 === b || a.datepickerMode === o.minMode && -1 === b || (m(o.modes[o.modes.indexOf(a.datepickerMode) + b]), a.$emit("uib:datepicker.mode")) }, a.keys = { 13: "enter", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", 37: "left", 38: "up", 39: "right", 40: "down" }; var s = function () { o.element[0].focus() }; a.$on("uib:datepicker.focus", s), a.keydown = function (b) { var c = a.keys[b.which]; if (c && !b.shiftKey && !b.altKey && !a.disabled) if (b.preventDefault(), o.shortcutPropagation || b.stopPropagation(), "enter" === c || "space" === c) { if (o.isDisabled(o.activeDate)) return; a.select(o.activeDate) } else !b.ctrlKey || "up" !== c && "down" !== c ? (o.handleKeyDown(c, b), o.refreshView()) : a.toggleMode("up" === c ? 1 : -1) }, b.on("keydown", function (b) { a.$apply(function () { a.keydown(b) }) }), a.$on("$destroy", function () { for (; r.length;) r.shift()() }) }]).controller("UibDaypickerController", ["$scope", "$element", "dateFilter", function (a, b, c) { function d(a, b) { return 1 !== b || a % 4 !== 0 || a % 100 === 0 && a % 400 !== 0 ? f[b] : 29 } function e(a) { var b = new Date(a); b.setDate(b.getDate() + 4 - (b.getDay() || 7)); var c = b.getTime(); return b.setMonth(0), b.setDate(1), Math.floor(Math.round((c - b) / 864e5) / 7) + 1 } var f = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; this.step = { months: 1 }, this.element = b, this.init = function (b) { angular.extend(b, this), a.showWeeks = b.showWeeks, b.refreshView() }, this.getDates = function (a, b) { for (var c, d = new Array(b), e = new Date(a), f = 0; b > f;) c = new Date(e), d[f++] = c, e.setDate(e.getDate() + 1); return d }, this._refreshView = function () { var b = this.activeDate.getFullYear(), d = this.activeDate.getMonth(), f = new Date(this.activeDate); f.setFullYear(b, d, 1); var g = this.startingDay - f.getDay(), h = g > 0 ? 7 - g : -g, i = new Date(f); h > 0 && i.setDate(-h + 1); for (var j = this.getDates(i, 42), k = 0; 42 > k; k++) j[k] = angular.extend(this.createDateObject(j[k], this.formatDay), { secondary: j[k].getMonth() !== d, uid: a.uniqueId + "-" + k }); a.labels = new Array(7); for (var l = 0; 7 > l; l++) a.labels[l] = { abbr: c(j[l].date, this.formatDayHeader), full: c(j[l].date, "EEEE") }; if (a.title = c(this.activeDate, this.formatDayTitle), a.rows = this.split(j, 7), a.showWeeks) { a.weekNumbers = []; for (var m = (11 - this.startingDay) % 7, n = a.rows.length, o = 0; n > o; o++) a.weekNumbers.push(e(a.rows[o][m].date)) } }, this.compare = function (a, b) { var c = new Date(a.getFullYear(), a.getMonth(), a.getDate()), d = new Date(b.getFullYear(), b.getMonth(), b.getDate()); return c.setFullYear(a.getFullYear()), d.setFullYear(b.getFullYear()), c - d }, this.handleKeyDown = function (a, b) { var c = this.activeDate.getDate(); if ("left" === a) c -= 1; else if ("up" === a) c -= 7; else if ("right" === a) c += 1; else if ("down" === a) c += 7; else if ("pageup" === a || "pagedown" === a) { var e = this.activeDate.getMonth() + ("pageup" === a ? -1 : 1); this.activeDate.setMonth(e, 1), c = Math.min(d(this.activeDate.getFullYear(), this.activeDate.getMonth()), c) } else "home" === a ? c = 1 : "end" === a && (c = d(this.activeDate.getFullYear(), this.activeDate.getMonth())); this.activeDate.setDate(c) } }]).controller("UibMonthpickerController", ["$scope", "$element", "dateFilter", function (a, b, c) { this.step = { years: 1 }, this.element = b, this.init = function (a) { angular.extend(a, this), a.refreshView() }, this._refreshView = function () { for (var b, d = new Array(12), e = this.activeDate.getFullYear(), f = 0; 12 > f; f++) b = new Date(this.activeDate), b.setFullYear(e, f, 1), d[f] = angular.extend(this.createDateObject(b, this.formatMonth), { uid: a.uniqueId + "-" + f }); a.title = c(this.activeDate, this.formatMonthTitle), a.rows = this.split(d, this.monthColumns), a.yearHeaderColspan = this.monthColumns > 3 ? this.monthColumns - 2 : 1 }, this.compare = function (a, b) { var c = new Date(a.getFullYear(), a.getMonth()), d = new Date(b.getFullYear(), b.getMonth()); return c.setFullYear(a.getFullYear()), d.setFullYear(b.getFullYear()), c - d }, this.handleKeyDown = function (a, b) { var c = this.activeDate.getMonth(); if ("left" === a) c -= 1; else if ("up" === a) c -= this.monthColumns; else if ("right" === a) c += 1; else if ("down" === a) c += this.monthColumns; else if ("pageup" === a || "pagedown" === a) { var d = this.activeDate.getFullYear() + ("pageup" === a ? -1 : 1); this.activeDate.setFullYear(d) } else "home" === a ? c = 0 : "end" === a && (c = 11); this.activeDate.setMonth(c) } }]).controller("UibYearpickerController", ["$scope", "$element", "dateFilter", function (a, b, c) { function d(a) { return parseInt((a - 1) / f, 10) * f + 1 } var e, f; this.element = b, this.yearpickerInit = function () { e = this.yearColumns, f = this.yearRows * e, this.step = { years: f } }, this._refreshView = function () { for (var b, c = new Array(f), g = 0, h = d(this.activeDate.getFullYear()) ; f > g; g++) b = new Date(this.activeDate), b.setFullYear(h + g, 0, 1), c[g] = angular.extend(this.createDateObject(b, this.formatYear), { uid: a.uniqueId + "-" + g }); a.title = [c[0].label, c[f - 1].label].join(" - "), a.rows = this.split(c, e), a.columns = e }, this.compare = function (a, b) { return a.getFullYear() - b.getFullYear() }, this.handleKeyDown = function (a, b) { var c = this.activeDate.getFullYear(); "left" === a ? c -= 1 : "up" === a ? c -= e : "right" === a ? c += 1 : "down" === a ? c += e : "pageup" === a || "pagedown" === a ? c += ("pageup" === a ? -1 : 1) * f : "home" === a ? c = d(this.activeDate.getFullYear()) : "end" === a && (c = d(this.activeDate.getFullYear()) + f - 1), this.activeDate.setFullYear(c) } }]).directive("uibDatepicker", function () { return { templateUrl: function (a, b) { return b.templateUrl || "uib/template/datepicker/datepicker.html" }, scope: { datepickerOptions: "=?" }, require: ["uibDatepicker", "^ngModel"], restrict: "A", controller: "UibDatepickerController", controllerAs: "datepicker", link: function (a, b, c, d) { var e = d[0], f = d[1]; e.init(f) } } }).directive("uibDaypicker", function () {
return {
templateUrl: function (a, b) { return b.templateUrl || "uib/template/datepicker/day.html" },
require: ["^uibDatepicker", "uibDaypicker"], restrict: "A", controller: "UibDaypickerController", link: function (a, b, c, d) { var e = d[0], f = d[1]; f.init(e) }
}
}).directive("uibMonthpicker", function () { return { templateUrl: function (a, b) { return b.templateUrl || "uib/template/datepicker/month.html" }, require: ["^uibDatepicker", "uibMonthpicker"], restrict: "A", controller: "UibMonthpickerController", link: function (a, b, c, d) { var e = d[0], f = d[1]; f.init(e) } } }).directive("uibYearpicker", function () { return { templateUrl: function (a, b) { return b.templateUrl || "uib/template/datepicker/year.html" }, require: ["^uibDatepicker", "uibYearpicker"], restrict: "A", controller: "UibYearpickerController", link: function (a, b, c, d) { var e = d[0]; angular.extend(e, d[1]), e.yearpickerInit(), e.refreshView() } } }), angular.module("ui.bootstrap.position", []).factory("$uibPosition", ["$document", "$window", function (a, b) { var c, d, e = { normal: /(auto|scroll)/, hidden: /(auto|scroll|hidden)/ }, f = { auto: /\s?auto?\s?/i, primary: /^(top|bottom|left|right)$/, secondary: /^(top|bottom|left|right|center)$/, vertical: /^(top|bottom)$/ }, g = /(HTML|BODY)/; return { getRawNode: function (a) { return a.nodeName ? a : a[0] || a }, parseStyle: function (a) { return a = parseFloat(a), isFinite(a) ? a : 0 }, offsetParent: function (c) { function d(a) { return "static" === (b.getComputedStyle(a).position || "static") } c = this.getRawNode(c); for (var e = c.offsetParent || a[0].documentElement; e && e !== a[0].documentElement && d(e) ;) e = e.offsetParent; return e || a[0].documentElement }, scrollbarWidth: function (e) { if (e) { if (angular.isUndefined(d)) { var f = a.find("body"); f.addClass("uib-position-body-scrollbar-measure"), d = b.innerWidth - f[0].clientWidth, d = isFinite(d) ? d : 0, f.removeClass("uib-position-body-scrollbar-measure") } return d } if (angular.isUndefined(c)) { var g = angular.element('
'); a.find("body").append(g), c = g[0].offsetWidth - g[0].clientWidth, c = isFinite(c) ? c : 0, g.remove() } return c }, scrollbarPadding: function (a) { a = this.getRawNode(a); var c = b.getComputedStyle(a), d = this.parseStyle(c.paddingRight), e = this.parseStyle(c.paddingBottom), f = this.scrollParent(a, !1, !0), h = this.scrollbarWidth(g.test(f.tagName)); return { scrollbarWidth: h, widthOverflow: f.scrollWidth > f.clientWidth, right: d + h, originalRight: d, heightOverflow: f.scrollHeight > f.clientHeight, bottom: e + h, originalBottom: e } }, isScrollable: function (a, c) { a = this.getRawNode(a); var d = c ? e.hidden : e.normal, f = b.getComputedStyle(a); return d.test(f.overflow + f.overflowY + f.overflowX) }, scrollParent: function (c, d, f) { c = this.getRawNode(c); var g = d ? e.hidden : e.normal, h = a[0].documentElement, i = b.getComputedStyle(c); if (f && g.test(i.overflow + i.overflowY + i.overflowX)) return c; var j = "absolute" === i.position, k = c.parentElement || h; if (k === h || "fixed" === i.position) return h; for (; k.parentElement && k !== h;) { var l = b.getComputedStyle(k); if (j && "static" !== l.position && (j = !1), !j && g.test(l.overflow + l.overflowY + l.overflowX)) break; k = k.parentElement } return k }, position: function (c, d) { c = this.getRawNode(c); var e = this.offset(c); if (d) { var f = b.getComputedStyle(c); e.top -= this.parseStyle(f.marginTop), e.left -= this.parseStyle(f.marginLeft) } var g = this.offsetParent(c), h = { top: 0, left: 0 }; return g !== a[0].documentElement && (h = this.offset(g), h.top += g.clientTop - g.scrollTop, h.left += g.clientLeft - g.scrollLeft), { width: Math.round(angular.isNumber(e.width) ? e.width : c.offsetWidth), height: Math.round(angular.isNumber(e.height) ? e.height : c.offsetHeight), top: Math.round(e.top - h.top), left: Math.round(e.left - h.left) } }, offset: function (c) { c = this.getRawNode(c); var d = c.getBoundingClientRect(); return { width: Math.round(angular.isNumber(d.width) ? d.width : c.offsetWidth), height: Math.round(angular.isNumber(d.height) ? d.height : c.offsetHeight), top: Math.round(d.top + (b.pageYOffset || a[0].documentElement.scrollTop)), left: Math.round(d.left + (b.pageXOffset || a[0].documentElement.scrollLeft)) } }, viewportOffset: function (c, d, e) { c = this.getRawNode(c), e = e !== !1; var f = c.getBoundingClientRect(), g = { top: 0, left: 0, bottom: 0, right: 0 }, h = d ? a[0].documentElement : this.scrollParent(c), i = h.getBoundingClientRect(); if (g.top = i.top + h.clientTop, g.left = i.left + h.clientLeft, h === a[0].documentElement && (g.top += b.pageYOffset, g.left += b.pageXOffset), g.bottom = g.top + h.clientHeight, g.right = g.left + h.clientWidth, e) { var j = b.getComputedStyle(h); g.top += this.parseStyle(j.paddingTop), g.bottom -= this.parseStyle(j.paddingBottom), g.left += this.parseStyle(j.paddingLeft), g.right -= this.parseStyle(j.paddingRight) } return { top: Math.round(f.top - g.top), bottom: Math.round(g.bottom - f.bottom), left: Math.round(f.left - g.left), right: Math.round(g.right - f.right) } }, parsePlacement: function (a) { var b = f.auto.test(a); return b && (a = a.replace(f.auto, "")), a = a.split("-"), a[0] = a[0] || "top", f.primary.test(a[0]) || (a[0] = "top"), a[1] = a[1] || "center", f.secondary.test(a[1]) || (a[1] = "center"), b ? a[2] = !0 : a[2] = !1, a }, positionElements: function (a, c, d, e) { a = this.getRawNode(a), c = this.getRawNode(c); var g = angular.isDefined(c.offsetWidth) ? c.offsetWidth : c.prop("offsetWidth"), h = angular.isDefined(c.offsetHeight) ? c.offsetHeight : c.prop("offsetHeight"); d = this.parsePlacement(d); var i = e ? this.offset(a) : this.position(a), j = { top: 0, left: 0, placement: "" }; if (d[2]) { var k = this.viewportOffset(a, e), l = b.getComputedStyle(c), m = { width: g + Math.round(Math.abs(this.parseStyle(l.marginLeft) + this.parseStyle(l.marginRight))), height: h + Math.round(Math.abs(this.parseStyle(l.marginTop) + this.parseStyle(l.marginBottom))) }; if (d[0] = "top" === d[0] && m.height > k.top && m.height <= k.bottom ? "bottom" : "bottom" === d[0] && m.height > k.bottom && m.height <= k.top ? "top" : "left" === d[0] && m.width > k.left && m.width <= k.right ? "right" : "right" === d[0] && m.width > k.right && m.width <= k.left ? "left" : d[0], d[1] = "top" === d[1] && m.height - i.height > k.bottom && m.height - i.height <= k.top ? "bottom" : "bottom" === d[1] && m.height - i.height > k.top && m.height - i.height <= k.bottom ? "top" : "left" === d[1] && m.width - i.width > k.right && m.width - i.width <= k.left ? "right" : "right" === d[1] && m.width - i.width > k.left && m.width - i.width <= k.right ? "left" : d[1], "center" === d[1]) if (f.vertical.test(d[0])) { var n = i.width / 2 - g / 2; k.left + n < 0 && m.width - i.width <= k.right ? d[1] = "left" : k.right + n < 0 && m.width - i.width <= k.left && (d[1] = "right") } else { var o = i.height / 2 - m.height / 2; k.top + o < 0 && m.height - i.height <= k.bottom ? d[1] = "top" : k.bottom + o < 0 && m.height - i.height <= k.top && (d[1] = "bottom") } } switch (d[0]) { case "top": j.top = i.top - h; break; case "bottom": j.top = i.top + i.height; break; case "left": j.left = i.left - g; break; case "right": j.left = i.left + i.width } switch (d[1]) { case "top": j.top = i.top; break; case "bottom": j.top = i.top + i.height - h; break; case "left": j.left = i.left; break; case "right": j.left = i.left + i.width - g; break; case "center": f.vertical.test(d[0]) ? j.left = i.left + i.width / 2 - g / 2 : j.top = i.top + i.height / 2 - h / 2 } return j.top = Math.round(j.top), j.left = Math.round(j.left), j.placement = "center" === d[1] ? d[0] : d[0] + "-" + d[1], j }, adjustTop: function (a, b, c, d) { return -1 !== a.indexOf("top") && c !== d ? { top: b.top - d + "px" } : void 0 }, positionArrow: function (a, c) { a = this.getRawNode(a); var d = a.querySelector(".tooltip-inner, .popover-inner"); if (d) { var e = angular.element(d).hasClass("tooltip-inner"), g = e ? a.querySelector(".tooltip-arrow") : a.querySelector(".arrow"); if (g) { var h = { top: "", bottom: "", left: "", right: "" }; if (c = this.parsePlacement(c), "center" === c[1]) return void angular.element(g).css(h); var i = "border-" + c[0] + "-width", j = b.getComputedStyle(g)[i], k = "border-"; k += f.vertical.test(c[0]) ? c[0] + "-" + c[1] : c[1] + "-" + c[0], k += "-radius"; var l = b.getComputedStyle(e ? d : a)[k]; switch (c[0]) { case "top": h.bottom = e ? "0" : "-" + j; break; case "bottom": h.top = e ? "0" : "-" + j; break; case "left": h.right = e ? "0" : "-" + j; break; case "right": h.left = e ? "0" : "-" + j } h[c[1]] = l, angular.element(g).css(h) } } } } }]), angular.module("ui.bootstrap.datepickerPopup", ["ui.bootstrap.datepicker", "ui.bootstrap.position"]).value("$datepickerPopupLiteralWarning", !0).constant("uibDatepickerPopupConfig", { altInputFormats: [], appendToBody: !1, clearText: "Clear", closeOnDateSelection: !0, closeText: "Done", currentText: "Today", datepickerPopup: "yyyy-MM-dd", datepickerPopupTemplateUrl: "uib/template/datepickerPopup/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: !0, showButtonBar: !0, placement: "auto bottom-left" }).controller("UibDatepickerPopupController", ["$scope", "$element", "$attrs", "$compile", "$log", "$parse", "$window", "$document", "$rootScope", "$uibPosition", "dateFilter", "uibDateParser", "uibDatepickerPopupConfig", "$timeout", "uibDatepickerConfig", "$datepickerPopupLiteralWarning", function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) { function q(b) { var c = l.parse(b, x, a.date); if (isNaN(c)) for (var d = 0; d < J.length; d++) if (c = l.parse(b, J[d], a.date), !isNaN(c)) return c; return c } function r(a) { if (angular.isNumber(a) && (a = new Date(a)), !a) return null; if (angular.isDate(a) && !isNaN(a)) return a; if (angular.isString(a)) { var b = q(a); if (!isNaN(b)) return l.toTimezone(b, H.getOption("timezone")) } return H.getOption("allowInvalid") ? a : void 0 } function s(a, b) { var d = a || b; return c.ngRequired || d ? (angular.isNumber(d) && (d = new Date(d)), d ? angular.isDate(d) && !isNaN(d) ? !0 : angular.isString(d) ? !isNaN(q(d)) : !1 : !0) : !0 } function t(c) { if (a.isOpen || !a.disabled) { var d = I[0], e = b[0].contains(c.target), f = void 0 !== d.contains && d.contains(c.target); !a.isOpen || e || f || a.$apply(function () { a.isOpen = !1 }) } } function u(c) { 27 === c.which && a.isOpen ? (c.preventDefault(), c.stopPropagation(), a.$apply(function () { a.isOpen = !1 }), b[0].focus()) : 40 !== c.which || a.isOpen || (c.preventDefault(), c.stopPropagation(), a.$apply(function () { a.isOpen = !0 })) } function v() { if (a.isOpen) { var d = angular.element(I[0].querySelector(".uib-datepicker-popup")), e = c.popupPlacement ? c.popupPlacement : m.placement, f = j.positionElements(b, d, e, z); d.css({ top: f.top + "px", left: f.left + "px" }), d.hasClass("uib-position-measure") && d.removeClass("uib-position-measure") } } function w(a) { var b; return angular.version.minor < 6 ? (b = angular.isObject(a.$options) ? a.$options : { timezone: null }, b.getOption = function (a) { return b[a] }) : b = a.$options, b } var x, y, z, A, B, C, D, E, F, G, H, I, J, K = !1, L = []; this.init = function (e) { if (G = e, H = w(G), y = angular.isDefined(c.closeOnDateSelection) ? a.$parent.$eval(c.closeOnDateSelection) : m.closeOnDateSelection, z = angular.isDefined(c.datepickerAppendToBody) ? a.$parent.$eval(c.datepickerAppendToBody) : m.appendToBody, A = angular.isDefined(c.onOpenFocus) ? a.$parent.$eval(c.onOpenFocus) : m.onOpenFocus, B = angular.isDefined(c.datepickerPopupTemplateUrl) ? c.datepickerPopupTemplateUrl : m.datepickerPopupTemplateUrl, C = angular.isDefined(c.datepickerTemplateUrl) ? c.datepickerTemplateUrl : m.datepickerTemplateUrl, J = angular.isDefined(c.altInputFormats) ? a.$parent.$eval(c.altInputFormats) : m.altInputFormats, a.showButtonBar = angular.isDefined(c.showButtonBar) ? a.$parent.$eval(c.showButtonBar) : m.showButtonBar, m.html5Types[c.type] ? (x = m.html5Types[c.type], K = !0) : (x = c.uibDatepickerPopup || m.datepickerPopup, c.$observe("uibDatepickerPopup", function (a, b) { var c = a || m.datepickerPopup; if (c !== x && (x = c, G.$modelValue = null, !x)) throw new Error("uibDatepickerPopup must have a date format specified.") })), !x) throw new Error("uibDatepickerPopup must have a date format specified."); if (K && c.uibDatepickerPopup) throw new Error("HTML5 date input types do not support custom formats."); D = angular.element("
"), D.attr({ "ng-model": "date", "ng-change": "dateSelection(date)", "template-url": B }), E = angular.element(D.children()[0]), E.attr("template-url", C), a.datepickerOptions || (a.datepickerOptions = {}), K && "month" === c.type && (a.datepickerOptions.datepickerMode = "month", a.datepickerOptions.minMode = "month"), E.attr("datepicker-options", "datepickerOptions"), K ? G.$formatters.push(function (b) { return a.date = l.fromTimezone(b, H.getOption("timezone")), b }) : (G.$$parserName = "date", G.$validators.date = s, G.$parsers.unshift(r), G.$formatters.push(function (b) { return G.$isEmpty(b) ? (a.date = b, b) : (angular.isNumber(b) && (b = new Date(b)), a.date = l.fromTimezone(b, H.getOption("timezone")), l.filter(a.date, x)) })), G.$viewChangeListeners.push(function () { a.date = q(G.$viewValue) }), b.on("keydown", u), I = d(D)(a), D.remove(), z ? h.find("body").append(I) : b.after(I), a.$on("$destroy", function () { for (a.isOpen === !0 && (i.$$phase || a.$apply(function () { a.isOpen = !1 })), I.remove(), b.off("keydown", u), h.off("click", t), F && F.off("scroll", v), angular.element(g).off("resize", v) ; L.length;) L.shift()() }) }, a.getText = function (b) { return a[b + "Text"] || m[b + "Text"] }, a.isDisabled = function (b) { "today" === b && (b = l.fromTimezone(new Date, H.getOption("timezone"))); var c = {}; return angular.forEach(["minDate", "maxDate"], function (b) { a.datepickerOptions[b] ? angular.isDate(a.datepickerOptions[b]) ? c[b] = new Date(a.datepickerOptions[b]) : (p && e.warn("Literal date support has been deprecated, please switch to date object usage"), c[b] = new Date(k(a.datepickerOptions[b], "medium"))) : c[b] = null }), a.datepickerOptions && c.minDate && a.compare(b, c.minDate) < 0 || c.maxDate && a.compare(b, c.maxDate) > 0 }, a.compare = function (a, b) { return new Date(a.getFullYear(), a.getMonth(), a.getDate()) - new Date(b.getFullYear(), b.getMonth(), b.getDate()) }, a.dateSelection = function (c) { a.date = c; var d = a.date ? l.filter(a.date, x) : null; b.val(d), G.$setViewValue(d), y && (a.isOpen = !1, b[0].focus()) }, a.keydown = function (c) { 27 === c.which && (c.stopPropagation(), a.isOpen = !1, b[0].focus()) }, a.select = function (b, c) { if (c.stopPropagation(), "today" === b) { var d = new Date; angular.isDate(a.date) ? (b = new Date(a.date), b.setFullYear(d.getFullYear(), d.getMonth(), d.getDate())) : (b = l.fromTimezone(d, H.getOption("timezone")), b.setHours(0, 0, 0, 0)) } a.dateSelection(b) }, a.close = function (c) { c.stopPropagation(), a.isOpen = !1, b[0].focus() }, a.disabled = angular.isDefined(c.disabled) || !1, c.ngDisabled && L.push(a.$parent.$watch(f(c.ngDisabled), function (b) { a.disabled = b })), a.$watch("isOpen", function (d) { d ? a.disabled ? a.isOpen = !1 : n(function () { v(), A && a.$broadcast("uib:datepicker.focus"), h.on("click", t); var d = c.popupPlacement ? c.popupPlacement : m.placement; z || j.parsePlacement(d)[2] ? (F = F || angular.element(j.scrollParent(b)), F && F.on("scroll", v)) : F = null, angular.element(g).on("resize", v) }, 0, !1) : (h.off("click", t), F && F.off("scroll", v), angular.element(g).off("resize", v)) }), a.$on("uib:datepicker.mode", function () { n(v, 0, !1) }) }]).directive("uibDatepickerPopup", function () { return { require: ["ngModel", "uibDatepickerPopup"], controller: "UibDatepickerPopupController", scope: { datepickerOptions: "=?", isOpen: "=?", currentText: "@", clearText: "@", closeText: "@" }, link: function (a, b, c, d) { var e = d[0], f = d[1]; f.init(e) } } }).directive("uibDatepickerPopupWrap", function () { return { restrict: "A", transclude: !0, templateUrl: function (a, b) { return b.templateUrl || "uib/template/datepickerPopup/popup.html" } } }), angular.module("ui.bootstrap.debounce", []).factory("$$debounce", ["$timeout", function (a) { return function (b, c) { var d; return function () { var e = this, f = Array.prototype.slice.call(arguments); d && a.cancel(d), d = a(function () { b.apply(e, f) }, c) } } }]), angular.module("ui.bootstrap.multiMap", []).factory("$$multiMap", function () { return { createNew: function () { var a = {}; return { entries: function () { return Object.keys(a).map(function (b) { return { key: b, value: a[b] } }) }, get: function (b) { return a[b] }, hasKey: function (b) { return !!a[b] }, keys: function () { return Object.keys(a) }, put: function (b, c) { a[b] || (a[b] = []), a[b].push(c) }, remove: function (b, c) { var d = a[b]; if (d) { var e = d.indexOf(c); -1 !== e && d.splice(e, 1), d.length || delete a[b] } } } } } }), angular.module("ui.bootstrap.dropdown", ["ui.bootstrap.multiMap", "ui.bootstrap.position"]).constant("uibDropdownConfig", { appendToOpenClass: "uib-dropdown-open", openClass: "open" }).service("uibDropdownService", ["$document", "$rootScope", "$$multiMap", function (a, b, c) { var d = null, e = c.createNew(); this.isOnlyOpen = function (a, b) { var c = e.get(b); if (c) { var d = c.reduce(function (b, c) { return c.scope === a ? c : b }, {}); if (d) return 1 === c.length } return !1 }, this.open = function (b, c, g) { if (d || a.on("click", f), d && d !== b && (d.isOpen = !1), d = b, g) { var h = e.get(g); if (h) { var i = h.map(function (a) { return a.scope }); -1 === i.indexOf(b) && e.put(g, { scope: b }) } else e.put(g, { scope: b }) } }, this.close = function (b, c, g) { if (d === b && (a.off("click", f), a.off("keydown", this.keybindFilter), d = null), g) { var h = e.get(g); if (h) { var i = h.reduce(function (a, c) { return c.scope === b ? c : a }, {}); i && e.remove(g, i) } } }; var f = function (a) { if (d && d.isOpen && !(a && "disabled" === d.getAutoClose() || a && 3 === a.which)) { var c = d.getToggleElement(); if (!(a && c && c[0].contains(a.target))) { var e = d.getDropdownElement(); a && "outsideClick" === d.getAutoClose() && e && e[0].contains(a.target) || (d.focusToggleElement(), d.isOpen = !1, b.$$phase || d.$apply()) } } }; this.keybindFilter = function (a) { if (d) { var b = d.getDropdownElement(), c = d.getToggleElement(), e = b && b[0].contains(a.target), g = c && c[0].contains(a.target); 27 === a.which ? (a.stopPropagation(), d.focusToggleElement(), f()) : d.isKeynavEnabled() && -1 !== [38, 40].indexOf(a.which) && d.isOpen && (e || g) && (a.preventDefault(), a.stopPropagation(), d.focusDropdownEntry(a.which)) } } }]).controller("UibDropdownController", ["$scope", "$element", "$attrs", "$parse", "uibDropdownConfig", "uibDropdownService", "$animate", "$uibPosition", "$document", "$compile", "$templateRequest", function (a, b, c, d, e, f, g, h, i, j, k) { function l() { b.append(o.dropdownMenu) } var m, n, o = this, p = a.$new(), q = e.appendToOpenClass, r = e.openClass, s = angular.noop, t = c.onToggle ? d(c.onToggle) : angular.noop, u = !1, v = i.find("body"); b.addClass("dropdown"), this.init = function () { c.isOpen && (n = d(c.isOpen), s = n.assign, a.$watch(n, function (a) { p.isOpen = !!a })), u = angular.isDefined(c.keyboardNav) }, this.toggle = function (a) { return p.isOpen = arguments.length ? !!a : !p.isOpen, angular.isFunction(s) && s(p, p.isOpen), p.isOpen }, this.isOpen = function () { return p.isOpen }, p.getToggleElement = function () { return o.toggleElement }, p.getAutoClose = function () { return c.autoClose || "always" }, p.getElement = function () { return b }, p.isKeynavEnabled = function () { return u }, p.focusDropdownEntry = function (a) { var c = o.dropdownMenu ? angular.element(o.dropdownMenu).find("a") : b.find("ul").eq(0).find("a"); switch (a) { case 40: angular.isNumber(o.selectedOption) ? o.selectedOption = o.selectedOption === c.length - 1 ? o.selectedOption : o.selectedOption + 1 : o.selectedOption = 0; break; case 38: angular.isNumber(o.selectedOption) ? o.selectedOption = 0 === o.selectedOption ? 0 : o.selectedOption - 1 : o.selectedOption = c.length - 1 } c[o.selectedOption].focus() }, p.getDropdownElement = function () { return o.dropdownMenu }, p.focusToggleElement = function () { o.toggleElement && o.toggleElement[0].focus() }, p.$watch("isOpen", function (e, n) { var u = null, w = !1; if (angular.isDefined(c.dropdownAppendTo)) { var x = d(c.dropdownAppendTo)(p); x && (u = angular.element(x)) } if (angular.isDefined(c.dropdownAppendToBody)) { var y = d(c.dropdownAppendToBody)(p); y !== !1 && (w = !0) } if (w && !u && (u = v), u && o.dropdownMenu && (e ? (u.append(o.dropdownMenu), b.on("$destroy", l)) : (b.off("$destroy", l), l())), u && o.dropdownMenu) { var z, A, B, C = h.positionElements(b, o.dropdownMenu, "bottom-left", !0), D = 0; if (z = { top: C.top + "px", display: e ? "block" : "none" }, A = o.dropdownMenu.hasClass("dropdown-menu-right"), A ? (z.left = "auto", B = h.scrollbarPadding(u), B.heightOverflow && B.scrollbarWidth && (D = B.scrollbarWidth), z.right = window.innerWidth - D - (C.left + b.prop("offsetWidth")) + "px") : (z.left = C.left + "px", z.right = "auto"), !w) { var E = h.offset(u); z.top = C.top - E.top + "px", A ? z.right = window.innerWidth - (C.left - E.left + b.prop("offsetWidth")) + "px" : z.left = C.left - E.left + "px" } o.dropdownMenu.css(z) } var F = u ? u : b, G = u ? q : r, H = F.hasClass(G), I = f.isOnlyOpen(a, u); if (H === !e) { var J; J = u ? I ? "removeClass" : "addClass" : e ? "addClass" : "removeClass", g[J](F, G).then(function () { angular.isDefined(e) && e !== n && t(a, { open: !!e }) }) } if (e) o.dropdownMenuTemplateUrl ? k(o.dropdownMenuTemplateUrl).then(function (a) { m = p.$new(), j(a.trim())(m, function (a) { var b = a; o.dropdownMenu.replaceWith(b), o.dropdownMenu = b, i.on("keydown", f.keybindFilter) }) }) : i.on("keydown", f.keybindFilter), p.focusToggleElement(), f.open(p, b, u); else { if (f.close(p, b, u), o.dropdownMenuTemplateUrl) { m && m.$destroy(); var K = angular.element(''); o.dropdownMenu.replaceWith(K), o.dropdownMenu = K } o.selectedOption = null } angular.isFunction(s) && s(a, e) }) }]).directive("uibDropdown", function () { return { controller: "UibDropdownController", link: function (a, b, c, d) { d.init() } } }).directive("uibDropdownMenu", function () { return { restrict: "A", require: "?^uibDropdown", link: function (a, b, c, d) { if (d && !angular.isDefined(c.dropdownNested)) { b.addClass("dropdown-menu"); var e = c.templateUrl; e && (d.dropdownMenuTemplateUrl = e), d.dropdownMenu || (d.dropdownMenu = b) } } } }).directive("uibDropdownToggle", function () { return { require: "?^uibDropdown", link: function (a, b, c, d) { if (d) { b.addClass("dropdown-toggle"), d.toggleElement = b; var e = function (e) { e.preventDefault(), b.hasClass("disabled") || c.disabled || a.$apply(function () { d.toggle() }) }; b.on("click", e), b.attr({ "aria-haspopup": !0, "aria-expanded": !1 }), a.$watch(d.isOpen, function (a) { b.attr("aria-expanded", !!a) }), a.$on("$destroy", function () { b.off("click", e) }) } } } }), angular.module("ui.bootstrap.stackedMap", []).factory("$$stackedMap", function () { return { createNew: function () { var a = []; return { add: function (b, c) { a.push({ key: b, value: c }) }, get: function (b) { for (var c = 0; c < a.length; c++) if (b === a[c].key) return a[c] }, keys: function () { for (var b = [], c = 0; c < a.length; c++) b.push(a[c].key); return b }, top: function () { return a[a.length - 1] }, remove: function (b) { for (var c = -1, d = 0; d < a.length; d++) if (b === a[d].key) { c = d; break } return a.splice(c, 1)[0] }, removeTop: function () { return a.pop() }, length: function () { return a.length } } } } }), angular.module("ui.bootstrap.modal", ["ui.bootstrap.multiMap", "ui.bootstrap.stackedMap", "ui.bootstrap.position"]).provider("$uibResolve", function () { var a = this; this.resolver = null, this.setResolver = function (a) { this.resolver = a }, this.$get = ["$injector", "$q", function (b, c) { var d = a.resolver ? b.get(a.resolver) : null; return { resolve: function (a, e, f, g) { if (d) return d.resolve(a, e, f, g); var h = []; return angular.forEach(a, function (a) { angular.isFunction(a) || angular.isArray(a) ? h.push(c.resolve(b.invoke(a))) : angular.isString(a) ? h.push(c.resolve(b.get(a))) : h.push(c.resolve(a)) }), c.all(h).then(function (b) { var c = {}, d = 0; return angular.forEach(a, function (a, e) { c[e] = b[d++] }), c }) } } }] }).directive("uibModalBackdrop", ["$animate", "$injector", "$uibModalStack", function (a, b, c) { function d(b, d, e) { e.modalInClass && (a.addClass(d, e.modalInClass), b.$on(c.NOW_CLOSING_EVENT, function (c, f) { var g = f(); b.modalOptions.animation ? a.removeClass(d, e.modalInClass).then(g) : g() })) } return { restrict: "A", compile: function (a, b) { return a.addClass(b.backdropClass), d } } }]).directive("uibModalWindow", ["$uibModalStack", "$q", "$animateCss", "$document", function (a, b, c, d) { return { scope: { index: "@" }, restrict: "A", transclude: !0, templateUrl: function (a, b) { return b.templateUrl || "uib/template/modal/window.html" }, link: function (e, f, g) { f.addClass(g.windowTopClass || ""), e.size = g.size, e.close = function (b) { var c = a.getTop(); c && c.value.backdrop && "static" !== c.value.backdrop && b.target === b.currentTarget && (b.preventDefault(), b.stopPropagation(), a.dismiss(c.key, "backdrop click")) }, f.on("click", e.close), e.$isRendered = !0; var h = b.defer(); e.$$postDigest(function () { h.resolve() }), h.promise.then(function () { var h = null; g.modalInClass && (h = c(f, { addClass: g.modalInClass }).start(), e.$on(a.NOW_CLOSING_EVENT, function (a, b) { var d = b(); c(f, { removeClass: g.modalInClass }).start().then(d) })), b.when(h).then(function () { var b = a.getTop(); if (b && a.modalRendered(b.key), !d[0].activeElement || !f[0].contains(d[0].activeElement)) { var c = f[0].querySelector("[autofocus]"); c ? c.focus() : f[0].focus() } }) }) } } }]).directive("uibModalAnimationClass", function () { return { compile: function (a, b) { b.modalAnimation && a.addClass(b.uibModalAnimationClass) } } }).directive("uibModalTransclude", ["$animate", function (a) { return { link: function (b, c, d, e, f) { f(b.$parent, function (b) { c.empty(), a.enter(b, c) }) } } }]).factory("$uibModalStack", ["$animate", "$animateCss", "$document", "$compile", "$rootScope", "$q", "$$multiMap", "$$stackedMap", "$uibPosition", function (a, b, c, d, e, f, g, h, i) { function j(a) { var b = "-"; return a.replace(E, function (a, c) { return (c ? b : "") + a.toLowerCase() }) } function k(a) { return !!(a.offsetWidth || a.offsetHeight || a.getClientRects().length) } function l() { for (var a = -1, b = x.keys(), c = 0; c < b.length; c++) x.get(b[c]).value.backdrop && (a = c); return a > -1 && A > a && (a = A), a } function m(a, b) { var c = x.get(a).value, d = c.appendTo; x.remove(a), B = x.top(), B && (A = parseInt(B.value.modalDomEl.attr("index"), 10)), p(c.modalDomEl, c.modalScope, function () { var b = c.openedClass || w; y.remove(b, a); var e = y.hasKey(b); d.toggleClass(b, e), !e && v && v.heightOverflow && v.scrollbarWidth && (v.originalRight ? d.css({ paddingRight: v.originalRight + "px" }) : d.css({ paddingRight: "" }), v = null), n(!0) }, c.closedDeferred), o(), b && b.focus ? b.focus() : d.focus && d.focus() } function n(a) { var b; x.length() > 0 && (b = x.top().value, b.modalDomEl.toggleClass(b.windowTopClass || "", a)) } function o() { if (t && -1 === l()) { var a = u; p(t, u, function () { a = null }), t = void 0, u = void 0 } } function p(b, c, d, e) { function g() { g.done || (g.done = !0, a.leave(b).then(function () { d && d(), b.remove(), e && e.resolve() }), c.$destroy()) } var h, i = null, j = function () { return h || (h = f.defer(), i = h.promise), function () { h.resolve() } }; return c.$broadcast(z.NOW_CLOSING_EVENT, j), f.when(i).then(g) } function q(a) { if (a.isDefaultPrevented()) return a; var b = x.top(); if (b) switch (a.which) { case 27: b.value.keyboard && (a.preventDefault(), e.$apply(function () { z.dismiss(b.key, "escape key press") })); break; case 9: var c = z.loadFocusElementList(b), d = !1; a.shiftKey ? (z.isFocusInFirstItem(a, c) || z.isModalFocused(a, b)) && (d = z.focusLastFocusableElement(c)) : z.isFocusInLastItem(a, c) && (d = z.focusFirstFocusableElement(c)), d && (a.preventDefault(), a.stopPropagation()) } } function r(a, b, c) { return !a.value.modalScope.$broadcast("modal.closing", b, c).defaultPrevented } function s() { Array.prototype.forEach.call(document.querySelectorAll("[" + C + "]"), function (a) { var b = parseInt(a.getAttribute(C), 10), c = b - 1; a.setAttribute(C, c), c || (a.removeAttribute(C), a.removeAttribute("aria-hidden")) }) } var t, u, v, w = "modal-open", x = h.createNew(), y = g.createNew(), z = { NOW_CLOSING_EVENT: "modal.stack.now-closing" }, A = 0, B = null, C = "data-bootstrap-modal-aria-hidden-count", D = "a[href], area[href], input:not([disabled]):not([tabindex='-1']), button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']), textarea:not([disabled]):not([tabindex='-1']), iframe, object, embed, *[tabindex]:not([tabindex='-1']), *[contenteditable=true]", E = /[A-Z]/g; return e.$watch(l, function (a) { u && (u.index = a) }), c.on("keydown", q), e.$on("$destroy", function () { c.off("keydown", q) }), z.open = function (b, f) { function g(a) { function b(a) { var b = a.parent() ? a.parent().children() : []; return Array.prototype.filter.call(b, function (b) { return b !== a[0] }) } if (a && "BODY" !== a[0].tagName) return b(a).forEach(function (a) { var b = "true" === a.getAttribute("aria-hidden"), c = parseInt(a.getAttribute(C), 10); c || (c = b ? 1 : 0), a.setAttribute(C, c + 1), a.setAttribute("aria-hidden", "true") }), g(a.parent()) } var h = c[0].activeElement, k = f.openedClass || w; n(!1), B = x.top(), x.add(b, { deferred: f.deferred, renderDeferred: f.renderDeferred, closedDeferred: f.closedDeferred, modalScope: f.scope, backdrop: f.backdrop, keyboard: f.keyboard, openedClass: f.openedClass, windowTopClass: f.windowTopClass, animation: f.animation, appendTo: f.appendTo }), y.put(k, b); var m = f.appendTo, o = l(); o >= 0 && !t && (u = e.$new(!0), u.modalOptions = f, u.index = o, t = angular.element('
'), t.attr({ "class": "modal-backdrop", "ng-style": "{'z-index': 1040 + (index && 1 || 0) + index*10}", "uib-modal-animation-class": "fade", "modal-in-class": "in" }), f.backdropClass && t.addClass(f.backdropClass), f.animation && t.attr("modal-animation", "true"), d(t)(u), a.enter(t, m), i.isScrollable(m) && (v = i.scrollbarPadding(m), v.heightOverflow && v.scrollbarWidth && m.css({ paddingRight: v.right + "px" }))); var p; f.component ? (p = document.createElement(j(f.component.name)), p = angular.element(p), p.attr({ resolve: "$resolve", "modal-instance": "$uibModalInstance", close: "$close($value)", dismiss: "$dismiss($value)" })) : p = f.content, A = B ? parseInt(B.value.modalDomEl.attr("index"), 10) + 1 : 0; var q = angular.element('
'); q.attr({ "class": "modal", "template-url": f.windowTemplateUrl, "window-top-class": f.windowTopClass, role: "dialog", "aria-labelledby": f.ariaLabelledBy, "aria-describedby": f.ariaDescribedBy, size: f.size, index: A, animate: "animate", "ng-style": "{'z-index': 1050 + $$topModalIndex*10, display: 'block'}", tabindex: -1, "uib-modal-animation-class": "fade", "modal-in-class": "in" }).append(p), f.windowClass && q.addClass(f.windowClass), f.animation && q.attr("modal-animation", "true"), m.addClass(k), f.scope && (f.scope.$$topModalIndex = A), a.enter(d(q)(f.scope), m), x.top().value.modalDomEl = q, x.top().value.modalOpener = h, g(q) }, z.close = function (a, b) { var c = x.get(a); return s(), c && r(c, b, !0) ? (c.value.modalScope.$$uibDestructionScheduled = !0, c.value.deferred.resolve(b), m(a, c.value.modalOpener), !0) : !c }, z.dismiss = function (a, b) { var c = x.get(a); return s(), c && r(c, b, !1) ? (c.value.modalScope.$$uibDestructionScheduled = !0, c.value.deferred.reject(b), m(a, c.value.modalOpener), !0) : !c }, z.dismissAll = function (a) { for (var b = this.getTop() ; b && this.dismiss(b.key, a) ;) b = this.getTop() }, z.getTop = function () { return x.top() }, z.modalRendered = function (a) { var b = x.get(a); b && b.value.renderDeferred.resolve() }, z.focusFirstFocusableElement = function (a) { return a.length > 0 ? (a[0].focus(), !0) : !1 }, z.focusLastFocusableElement = function (a) { return a.length > 0 ? (a[a.length - 1].focus(), !0) : !1 }, z.isModalFocused = function (a, b) { if (a && b) { var c = b.value.modalDomEl; if (c && c.length) return (a.target || a.srcElement) === c[0] } return !1 }, z.isFocusInFirstItem = function (a, b) { return b.length > 0 ? (a.target || a.srcElement) === b[0] : !1 }, z.isFocusInLastItem = function (a, b) { return b.length > 0 ? (a.target || a.srcElement) === b[b.length - 1] : !1 }, z.loadFocusElementList = function (a) { if (a) { var b = a.value.modalDomEl; if (b && b.length) { var c = b[0].querySelectorAll(D); return c ? Array.prototype.filter.call(c, function (a) { return k(a) }) : c } } }, z }]).provider("$uibModal", function () { var a = { options: { animation: !0, backdrop: !0, keyboard: !0 }, $get: ["$rootScope", "$q", "$document", "$templateRequest", "$controller", "$uibResolve", "$uibModalStack", function (b, c, d, e, f, g, h) { function i(a) { return a.template ? c.when(a.template) : e(angular.isFunction(a.templateUrl) ? a.templateUrl() : a.templateUrl) } var j = {}, k = null; return j.getPromiseChain = function () { return k }, j.open = function (e) { function j() { return q } var l = c.defer(), m = c.defer(), n = c.defer(), o = c.defer(), p = { result: l.promise, opened: m.promise, closed: n.promise, rendered: o.promise, close: function (a) { return h.close(p, a) }, dismiss: function (a) { return h.dismiss(p, a) } }; if (e = angular.extend({}, a.options, e), e.resolve = e.resolve || {}, e.appendTo = e.appendTo || d.find("body").eq(0), !e.appendTo.length) throw new Error("appendTo element not found. Make sure that the element passed is in DOM."); if (!e.component && !e.template && !e.templateUrl) throw new Error("One of component or template or templateUrl options is required."); var q; q = e.component ? c.when(g.resolve(e.resolve, {}, null, null)) : c.all([i(e), g.resolve(e.resolve, {}, null, null)]); var r; return r = k = c.all([k]).then(j, j).then(function (a) { function c(b, c, d, e) { b.$scope = g, b.$scope.$resolve = {}, d ? b.$scope.$uibModalInstance = p : b.$uibModalInstance = p; var f = c ? a[1] : a; angular.forEach(f, function (a, c) { e && (b[c] = a), b.$scope.$resolve[c] = a }) } var d = e.scope || b, g = d.$new(); g.$close = p.close, g.$dismiss = p.dismiss, g.$on("$destroy", function () { g.$$uibDestructionScheduled || g.$dismiss("$uibUnscheduledDestruction") }); var i, j, k = { scope: g, deferred: l, renderDeferred: o, closedDeferred: n, animation: e.animation, backdrop: e.backdrop, keyboard: e.keyboard, backdropClass: e.backdropClass, windowTopClass: e.windowTopClass, windowClass: e.windowClass, windowTemplateUrl: e.windowTemplateUrl, ariaLabelledBy: e.ariaLabelledBy, ariaDescribedBy: e.ariaDescribedBy, size: e.size, openedClass: e.openedClass, appendTo: e.appendTo }, q = {}, r = {}; e.component ? (c(q, !1, !0, !1), q.name = e.component, k.component = q) : e.controller && (c(r, !0, !1, !0), j = f(e.controller, r, !0, e.controllerAs), e.controllerAs && e.bindToController && (i = j.instance, i.$close = g.$close, i.$dismiss = g.$dismiss, angular.extend(i, { $resolve: r.$scope.$resolve }, d)), i = j(), angular.isFunction(i.$onInit) && i.$onInit()), e.component || (k.content = a[0]), h.open(p, k), m.resolve(!0) }, function (a) { m.reject(a), l.reject(a) })["finally"](function () { k === r && (k = null) }), p }, j }] }; return a }), angular.module("ui.bootstrap.paging", []).factory("uibPaging", ["$parse", function (a) {
return {
create: function (b, c, d) {
b.setNumPages = d.numPages ? a(d.numPages).assign : angular.noop, b.ngModelCtrl = { $setViewValue: angular.noop }, b._watchers = [], b.init = function (a, e) {
b.ngModelCtrl = a, b.config = e, a.$render = function () { b.render() }, d.itemsPerPage ? b._watchers.push(c.$parent.$watch(d.itemsPerPage, function (a) {
b.itemsPerPage = parseInt(a, 10), c.totalPages = b.calculateTotalPages(), b.updatePage()
})) : b.itemsPerPage = e.itemsPerPage, c.$watch("totalItems", function (a, d) { (angular.isDefined(a) || a !== d) && (c.totalPages = b.calculateTotalPages(), b.updatePage()) })
}, b.calculateTotalPages = function () { var a = b.itemsPerPage < 1 ? 1 : Math.ceil(c.totalItems / b.itemsPerPage); return Math.max(a || 0, 1) }, b.render = function () { c.page = parseInt(b.ngModelCtrl.$viewValue, 10) || 1 }, c.selectPage = function (a, d) { d && d.preventDefault(); var e = !c.ngDisabled || !d; e && c.page !== a && a > 0 && a <= c.totalPages && (d && d.target && d.target.blur(), b.ngModelCtrl.$setViewValue(a), b.ngModelCtrl.$render()) }, c.getText = function (a) { return c[a + "Text"] || b.config[a + "Text"] }, c.noPrevious = function () { return 1 === c.page }, c.noNext = function () { return c.page === c.totalPages }, b.updatePage = function () { b.setNumPages(c.$parent, c.totalPages), c.page > c.totalPages ? c.selectPage(c.totalPages) : b.ngModelCtrl.$render() }, c.$on("$destroy", function () { for (; b._watchers.length;) b._watchers.shift()() })
}
}
}]), angular.module("ui.bootstrap.pager", ["ui.bootstrap.paging", "ui.bootstrap.tabindex"]).controller("UibPagerController", ["$scope", "$attrs", "uibPaging", "uibPagerConfig", function (a, b, c, d) { a.align = angular.isDefined(b.align) ? a.$parent.$eval(b.align) : d.align, c.create(this, a, b) }]).constant("uibPagerConfig", { itemsPerPage: 10, previousText: "« Previous", nextText: "Next »", align: !0 }).directive("uibPager", ["uibPagerConfig", function (a) { return { scope: { totalItems: "=", previousText: "@", nextText: "@", ngDisabled: "=" }, require: ["uibPager", "?ngModel"], restrict: "A", controller: "UibPagerController", controllerAs: "pager", templateUrl: function (a, b) { return b.templateUrl || "uib/template/pager/pager.html" }, link: function (b, c, d, e) { c.addClass("pager"); var f = e[0], g = e[1]; g && f.init(g, a) } } }]), angular.module("ui.bootstrap.pagination", ["ui.bootstrap.paging", "ui.bootstrap.tabindex"]).controller("UibPaginationController", ["$scope", "$attrs", "$parse", "uibPaging", "uibPaginationConfig", function (a, b, c, d, e) { function f(a, b, c) { return { number: a, text: b, active: c } } function g(a, b) { var c = [], d = 1, e = b, g = angular.isDefined(i) && b > i; g && (j ? (d = Math.max(a - Math.floor(i / 2), 1), e = d + i - 1, e > b && (e = b, d = e - i + 1)) : (d = (Math.ceil(a / i) - 1) * i + 1, e = Math.min(d + i - 1, b))); for (var h = d; e >= h; h++) { var n = f(h, m(h), h === a); c.push(n) } if (g && i > 0 && (!j || k || l)) { if (d > 1) { if (!l || d > 3) { var o = f(d - 1, "...", !1); c.unshift(o) } if (l) { if (3 === d) { var p = f(2, "2", !1); c.unshift(p) } var q = f(1, "1", !1); c.unshift(q) } } if (b > e) { if (!l || b - 2 > e) { var r = f(e + 1, "...", !1); c.push(r) } if (l) { if (e === b - 2) { var s = f(b - 1, b - 1, !1); c.push(s) } var t = f(b, b, !1); c.push(t) } } } return c } var h = this, i = angular.isDefined(b.maxSize) ? a.$parent.$eval(b.maxSize) : e.maxSize, j = angular.isDefined(b.rotate) ? a.$parent.$eval(b.rotate) : e.rotate, k = angular.isDefined(b.forceEllipses) ? a.$parent.$eval(b.forceEllipses) : e.forceEllipses, l = angular.isDefined(b.boundaryLinkNumbers) ? a.$parent.$eval(b.boundaryLinkNumbers) : e.boundaryLinkNumbers, m = angular.isDefined(b.pageLabel) ? function (c) { return a.$parent.$eval(b.pageLabel, { $page: c }) } : angular.identity; a.boundaryLinks = angular.isDefined(b.boundaryLinks) ? a.$parent.$eval(b.boundaryLinks) : e.boundaryLinks, a.directionLinks = angular.isDefined(b.directionLinks) ? a.$parent.$eval(b.directionLinks) : e.directionLinks, b.$set("role", "menu"), d.create(this, a, b), b.maxSize && h._watchers.push(a.$parent.$watch(c(b.maxSize), function (a) { i = parseInt(a, 10), h.render() })); var n = this.render; this.render = function () { n(), a.page > 0 && a.page <= a.totalPages && (a.pages = g(a.page, a.totalPages)) } }]).constant("uibPaginationConfig", { itemsPerPage: 10, boundaryLinks: !1, boundaryLinkNumbers: !1, directionLinks: !0, firstText: "First", previousText: "Previous", nextText: "Next", lastText: "Last", rotate: !0, forceEllipses: !1 }).directive("uibPagination", ["$parse", "uibPaginationConfig", function (a, b) { return { scope: { totalItems: "=", firstText: "@", previousText: "@", nextText: "@", lastText: "@", ngDisabled: "=" }, require: ["uibPagination", "?ngModel"], restrict: "A", controller: "UibPaginationController", controllerAs: "pagination", templateUrl: function (a, b) { return b.templateUrl || "uib/template/pagination/pagination.html" }, link: function (a, c, d, e) { c.addClass("pagination"); var f = e[0], g = e[1]; g && f.init(g, b) } } }]), angular.module("ui.bootstrap.tooltip", ["ui.bootstrap.position", "ui.bootstrap.stackedMap"]).provider("$uibTooltip", function () { function a(a) { var b = /[A-Z]/g, c = "-"; return a.replace(b, function (a, b) { return (b ? c : "") + a.toLowerCase() }) } var b = { placement: "top", placementClassPrefix: "", animation: !0, popupDelay: 0, popupCloseDelay: 0, useContentExp: !1 }, c = { mouseenter: "mouseleave", click: "click", outsideClick: "outsideClick", focus: "blur", none: "" }, d = {}; this.options = function (a) { angular.extend(d, a) }, this.setTriggers = function (a) { angular.extend(c, a) }, this.$get = ["$window", "$compile", "$timeout", "$document", "$uibPosition", "$interpolate", "$rootScope", "$parse", "$$stackedMap", function (e, f, g, h, i, j, k, l, m) { function n(a) { if (27 === a.which) { var b = o.top(); b && (b.value.close(), b = null) } } var o = m.createNew(); return h.on("keyup", n), k.$on("$destroy", function () { h.off("keyup", n) }), function (e, k, m, n) { function p(a) { var b = (a || n.trigger || m).split(" "), d = b.map(function (a) { return c[a] || a }); return { show: b, hide: d } } n = angular.extend({}, b, d, n); var q = a(e), r = j.startSymbol(), s = j.endSymbol(), t = "
'; return { compile: function (a, b) { var c = f(t); return function (a, b, d, f) { function j() { P.isOpen ? q() : m() } function m() { O && !a.$eval(d[k + "Enable"]) || (u(), x(), P.popupDelay ? H || (H = g(r, P.popupDelay, !1)) : r()) } function q() { s(), P.popupCloseDelay ? I || (I = g(t, P.popupCloseDelay, !1)) : t() } function r() { return s(), u(), P.content ? (v(), void P.$evalAsync(function () { P.isOpen = !0, y(!0), U() })) : angular.noop } function s() { H && (g.cancel(H), H = null), J && (g.cancel(J), J = null) } function t() { P && P.$evalAsync(function () { P && (P.isOpen = !1, y(!1), P.animation ? G || (G = g(w, 150, !1)) : w()) }) } function u() { I && (g.cancel(I), I = null), G && (g.cancel(G), G = null) } function v() { E || (F = P.$new(), E = c(F, function (a) { M ? h.find("body").append(a) : b.after(a) }), o.add(P, { close: t }), z()) } function w() { s(), u(), A(), E && (E.remove(), E = null, K && g.cancel(K)), o.remove(P), F && (F.$destroy(), F = null) } function x() { P.title = d[k + "Title"], S ? P.content = S(a) : P.content = d[e], P.popupClass = d[k + "Class"], P.placement = angular.isDefined(d[k + "Placement"]) ? d[k + "Placement"] : n.placement; var b = i.parsePlacement(P.placement); L = b[1] ? b[0] + "-" + b[1] : b[0]; var c = parseInt(d[k + "PopupDelay"], 10), f = parseInt(d[k + "PopupCloseDelay"], 10); P.popupDelay = isNaN(c) ? n.popupDelay : c, P.popupCloseDelay = isNaN(f) ? n.popupCloseDelay : f } function y(b) { R && angular.isFunction(R.assign) && R.assign(a, b) } function z() { T.length = 0, S ? (T.push(a.$watch(S, function (a) { P.content = a, !a && P.isOpen && t() })), T.push(F.$watch(function () { Q || (Q = !0, F.$$postDigest(function () { Q = !1, P && P.isOpen && U() })) }))) : T.push(d.$observe(e, function (a) { P.content = a, !a && P.isOpen ? t() : U() })), T.push(d.$observe(k + "Title", function (a) { P.title = a, P.isOpen && U() })), T.push(d.$observe(k + "Placement", function (a) { P.placement = a ? a : n.placement, P.isOpen && U() })) } function A() { T.length && (angular.forEach(T, function (a) { a() }), T.length = 0) } function B(a) { P && P.isOpen && E && (b[0].contains(a.target) || E[0].contains(a.target) || q()) } function C(a) { 27 === a.which && q() } function D() { var c = [], e = [], f = a.$eval(d[k + "Trigger"]); V(), angular.isObject(f) ? (Object.keys(f).forEach(function (a) { c.push(a), e.push(f[a]) }), N = { show: c, hide: e }) : N = p(f), "none" !== N.show && N.show.forEach(function (a, c) { "outsideClick" === a ? (b.on("click", j), h.on("click", B)) : a === N.hide[c] ? b.on(a, j) : a && (b.on(a, m), b.on(N.hide[c], q)), b.on("keypress", C) }) } var E, F, G, H, I, J, K, L, M = angular.isDefined(n.appendToBody) ? n.appendToBody : !1, N = p(void 0), O = angular.isDefined(d[k + "Enable"]), P = a.$new(!0), Q = !1, R = angular.isDefined(d[k + "IsOpen"]) ? l(d[k + "IsOpen"]) : !1, S = n.useContentExp ? l(d[e]) : !1, T = [], U = function () { E && E.html() && (J || (J = g(function () { var a = i.positionElements(b, E, P.placement, M), c = angular.isDefined(E.offsetHeight) ? E.offsetHeight : E.prop("offsetHeight"), d = M ? i.offset(b) : i.position(b); E.css({ top: a.top + "px", left: a.left + "px" }); var e = a.placement.split("-"); E.hasClass(e[0]) || (E.removeClass(L.split("-")[0]), E.addClass(e[0])), E.hasClass(n.placementClassPrefix + a.placement) || (E.removeClass(n.placementClassPrefix + L), E.addClass(n.placementClassPrefix + a.placement)), K = g(function () { var a = angular.isDefined(E.offsetHeight) ? E.offsetHeight : E.prop("offsetHeight"), b = i.adjustTop(e, d, c, a); b && E.css(b), K = null }, 0, !1), E.hasClass("uib-position-measure") ? (i.positionArrow(E, a.placement), E.removeClass("uib-position-measure")) : L !== a.placement && i.positionArrow(E, a.placement), L = a.placement, J = null }, 0, !1))) }; P.origScope = a, P.isOpen = !1, P.contentExp = function () { return P.content }, d.$observe("disabled", function (a) { a && s(), a && P.isOpen && t() }), R && a.$watch(R, function (a) { P && !a === P.isOpen && j() }); var V = function () { N.show.forEach(function (a) { "outsideClick" === a ? b.off("click", j) : (b.off(a, m), b.off(a, j)), b.off("keypress", C) }), N.hide.forEach(function (a) { "outsideClick" === a ? h.off("click", B) : b.off(a, q) }) }; D(); var W = a.$eval(d[k + "Animation"]); P.animation = angular.isDefined(W) ? !!W : n.animation; var X, Y = k + "AppendToBody"; X = Y in d && void 0 === d[Y] ? !0 : a.$eval(d[Y]), M = angular.isDefined(X) ? X : M, a.$on("$destroy", function () { V(), w(), P = null }) } } } } }] }).directive("uibTooltipTemplateTransclude", ["$animate", "$sce", "$compile", "$templateRequest", function (a, b, c, d) { return { link: function (e, f, g) { var h, i, j, k = e.$eval(g.tooltipTemplateTranscludeScope), l = 0, m = function () { i && (i.remove(), i = null), h && (h.$destroy(), h = null), j && (a.leave(j).then(function () { i = null }), i = j, j = null) }; e.$watch(b.parseAsResourceUrl(g.uibTooltipTemplateTransclude), function (b) { var g = ++l; b ? (d(b, !0).then(function (d) { if (g === l) { var e = k.$new(), i = d, n = c(i)(e, function (b) { m(), a.enter(b, f) }); h = e, j = n, h.$emit("$includeContentLoaded", b) } }, function () { g === l && (m(), e.$emit("$includeContentError", b)) }), e.$emit("$includeContentRequested", b)) : m() }), e.$on("$destroy", m) } } }]).directive("uibTooltipClasses", ["$uibPosition", function (a) { return { restrict: "A", link: function (b, c, d) { if (b.placement) { var e = a.parsePlacement(b.placement); c.addClass(e[0]) } b.popupClass && c.addClass(b.popupClass), b.animation && c.addClass(d.tooltipAnimationClass) } } }]).directive("uibTooltipPopup", function () { return { restrict: "A", scope: { content: "@" }, templateUrl: "uib/template/tooltip/tooltip-popup.html" } }).directive("uibTooltip", ["$uibTooltip", function (a) { return a("uibTooltip", "tooltip", "mouseenter") }]).directive("uibTooltipTemplatePopup", function () { return { restrict: "A", scope: { contentExp: "&", originScope: "&" }, templateUrl: "uib/template/tooltip/tooltip-template-popup.html" } }).directive("uibTooltipTemplate", ["$uibTooltip", function (a) { return a("uibTooltipTemplate", "tooltip", "mouseenter", { useContentExp: !0 }) }]).directive("uibTooltipHtmlPopup", function () { return { restrict: "A", scope: { contentExp: "&" }, templateUrl: "uib/template/tooltip/tooltip-html-popup.html" } }).directive("uibTooltipHtml", ["$uibTooltip", function (a) { return a("uibTooltipHtml", "tooltip", "mouseenter", { useContentExp: !0 }) }]), angular.module("ui.bootstrap.popover", ["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup", function () { return { restrict: "A", scope: { uibTitle: "@", contentExp: "&", originScope: "&" }, templateUrl: "uib/template/popover/popover-template.html" } }).directive("uibPopoverTemplate", ["$uibTooltip", function (a) { return a("uibPopoverTemplate", "popover", "click", { useContentExp: !0 }) }]).directive("uibPopoverHtmlPopup", function () { return { restrict: "A", scope: { contentExp: "&", uibTitle: "@" }, templateUrl: "uib/template/popover/popover-html.html" } }).directive("uibPopoverHtml", ["$uibTooltip", function (a) { return a("uibPopoverHtml", "popover", "click", { useContentExp: !0 }) }]).directive("uibPopoverPopup", function () { return { restrict: "A", scope: { uibTitle: "@", content: "@" }, templateUrl: "uib/template/popover/popover.html" } }).directive("uibPopover", ["$uibTooltip", function (a) { return a("uibPopover", "popover", "click") }]), angular.module("ui.bootstrap.progressbar", []).constant("uibProgressConfig", { animate: !0, max: 100 }).controller("UibProgressController", ["$scope", "$attrs", "uibProgressConfig", function (a, b, c) { function d() { return angular.isDefined(a.maxParam) ? a.maxParam : c.max } var e = this, f = angular.isDefined(b.animate) ? a.$parent.$eval(b.animate) : c.animate; this.bars = [], a.max = d(), this.addBar = function (a, b, c) { f || b.css({ transition: "none" }), this.bars.push(a), a.max = d(), a.title = c && angular.isDefined(c.title) ? c.title : "progressbar", a.$watch("value", function (b) { a.recalculatePercentage() }), a.recalculatePercentage = function () { var b = e.bars.reduce(function (a, b) { return b.percent = +(100 * b.value / b.max).toFixed(2), a + b.percent }, 0); b > 100 && (a.percent -= b - 100) }, a.$on("$destroy", function () { b = null, e.removeBar(a) }) }, this.removeBar = function (a) { this.bars.splice(this.bars.indexOf(a), 1), this.bars.forEach(function (a) { a.recalculatePercentage() }) }, a.$watch("maxParam", function (a) { e.bars.forEach(function (a) { a.max = d(), a.recalculatePercentage() }) }) }]).directive("uibProgress", function () { return { replace: !0, transclude: !0, controller: "UibProgressController", require: "uibProgress", scope: { maxParam: "=?max" }, templateUrl: "uib/template/progressbar/progress.html" } }).directive("uibBar", function () { return { replace: !0, transclude: !0, require: "^uibProgress", scope: { value: "=", type: "@" }, templateUrl: "uib/template/progressbar/bar.html", link: function (a, b, c, d) { d.addBar(a, b, c) } } }).directive("uibProgressbar", function () { return { replace: !0, transclude: !0, controller: "UibProgressController", scope: { value: "=", maxParam: "=?max", type: "@" }, templateUrl: "uib/template/progressbar/progressbar.html", link: function (a, b, c, d) { d.addBar(a, angular.element(b.children()[0]), { title: c.title }) } } }), angular.module("ui.bootstrap.rating", []).constant("uibRatingConfig", { max: 5, stateOn: null, stateOff: null, enableReset: !0, titles: ["one", "two", "three", "four", "five"] }).controller("UibRatingController", ["$scope", "$attrs", "uibRatingConfig", function (a, b, c) { var d = { $setViewValue: angular.noop }, e = this; this.init = function (e) { d = e, d.$render = this.render, d.$formatters.push(function (a) { return angular.isNumber(a) && a << 0 !== a && (a = Math.round(a)), a }), this.stateOn = angular.isDefined(b.stateOn) ? a.$parent.$eval(b.stateOn) : c.stateOn, this.stateOff = angular.isDefined(b.stateOff) ? a.$parent.$eval(b.stateOff) : c.stateOff, this.enableReset = angular.isDefined(b.enableReset) ? a.$parent.$eval(b.enableReset) : c.enableReset; var f = angular.isDefined(b.titles) ? a.$parent.$eval(b.titles) : c.titles; this.titles = angular.isArray(f) && f.length > 0 ? f : c.titles; var g = angular.isDefined(b.ratingStates) ? a.$parent.$eval(b.ratingStates) : new Array(angular.isDefined(b.max) ? a.$parent.$eval(b.max) : c.max); a.range = this.buildTemplateObjects(g) }, this.buildTemplateObjects = function (a) { for (var b = 0, c = a.length; c > b; b++) a[b] = angular.extend({ index: b }, { stateOn: this.stateOn, stateOff: this.stateOff, title: this.getTitle(b) }, a[b]); return a }, this.getTitle = function (a) { return a >= this.titles.length ? a + 1 : this.titles[a] }, a.rate = function (b) { if (!a.readonly && b >= 0 && b <= a.range.length) { var c = e.enableReset && d.$viewValue === b ? 0 : b; d.$setViewValue(c), d.$render() } }, a.enter = function (b) { a.readonly || (a.value = b), a.onHover({ value: b }) }, a.reset = function () { a.value = d.$viewValue, a.onLeave() }, a.onKeydown = function (b) { /(37|38|39|40)/.test(b.which) && (b.preventDefault(), b.stopPropagation(), a.rate(a.value + (38 === b.which || 39 === b.which ? 1 : -1))) }, this.render = function () { a.value = d.$viewValue, a.title = e.getTitle(a.value - 1) } }]).directive("uibRating", function () { return { require: ["uibRating", "ngModel"], restrict: "A", scope: { readonly: "=?readOnly", onHover: "&", onLeave: "&" }, controller: "UibRatingController", templateUrl: "uib/template/rating/rating.html", link: function (a, b, c, d) { var e = d[0], f = d[1]; e.init(f) } } }), angular.module("ui.bootstrap.tabs", []).controller("UibTabsetController", ["$scope", function (a) { function b(a) { for (var b = 0; b < d.tabs.length; b++) if (d.tabs[b].index === a) return b } var c, d = this; d.tabs = [], d.select = function (a, f) { if (!e) { var g = b(c), h = d.tabs[g]; if (h) { if (h.tab.onDeselect({ $event: f, $selectedIndex: a }), f && f.isDefaultPrevented()) return; h.tab.active = !1 } var i = d.tabs[a]; i ? (i.tab.onSelect({ $event: f }), i.tab.active = !0, d.active = i.index, c = i.index) : !i && angular.isDefined(c) && (d.active = null, c = null) } }, d.addTab = function (a) { if (d.tabs.push({ tab: a, index: a.index }), d.tabs.sort(function (a, b) { return a.index > b.index ? 1 : a.index < b.index ? -1 : 0 }), a.index === d.active || !angular.isDefined(d.active) && 1 === d.tabs.length) { var c = b(a.index); d.select(c) } }, d.removeTab = function (a) { for (var b, c = 0; c < d.tabs.length; c++) if (d.tabs[c].tab === a) { b = c; break } if (d.tabs[b].index === d.active) { var e = b === d.tabs.length - 1 ? b - 1 : b + 1 % d.tabs.length; d.select(e) } d.tabs.splice(b, 1) }, a.$watch("tabset.active", function (a) { angular.isDefined(a) && a !== c && d.select(b(a)) }); var e; a.$on("$destroy", function () { e = !0 }) }]).directive("uibTabset", function () { return { transclude: !0, replace: !0, scope: {}, bindToController: { active: "=?", type: "@" }, controller: "UibTabsetController", controllerAs: "tabset", templateUrl: function (a, b) { return b.templateUrl || "uib/template/tabs/tabset.html" }, link: function (a, b, c) { a.vertical = angular.isDefined(c.vertical) ? a.$parent.$eval(c.vertical) : !1, a.justified = angular.isDefined(c.justified) ? a.$parent.$eval(c.justified) : !1 } } }).directive("uibTab", ["$parse", function (a) { return { require: "^uibTabset", replace: !0, templateUrl: function (a, b) { return b.templateUrl || "uib/template/tabs/tab.html" }, transclude: !0, scope: { heading: "@", index: "=?", classes: "@?", onSelect: "&select", onDeselect: "&deselect" }, controller: function () { }, controllerAs: "tab", link: function (b, c, d, e, f) { b.disabled = !1, d.disable && b.$parent.$watch(a(d.disable), function (a) { b.disabled = !!a }), angular.isUndefined(d.index) && (e.tabs && e.tabs.length ? b.index = Math.max.apply(null, e.tabs.map(function (a) { return a.index })) + 1 : b.index = 0), angular.isUndefined(d.classes) && (b.classes = ""), b.select = function (a) { if (!b.disabled) { for (var c, d = 0; d < e.tabs.length; d++) if (e.tabs[d].tab === b) { c = d; break } e.select(c, a) } }, e.addTab(b), b.$on("$destroy", function () { e.removeTab(b) }), b.$transcludeFn = f } } }]).directive("uibTabHeadingTransclude", function () { return { restrict: "A", require: "^uibTab", link: function (a, b) { a.$watch("headingElement", function (a) { a && (b.html(""), b.append(a)) }) } } }).directive("uibTabContentTransclude", function () { function a(a) { return a.tagName && (a.hasAttribute("uib-tab-heading") || a.hasAttribute("data-uib-tab-heading") || a.hasAttribute("x-uib-tab-heading") || "uib-tab-heading" === a.tagName.toLowerCase() || "data-uib-tab-heading" === a.tagName.toLowerCase() || "x-uib-tab-heading" === a.tagName.toLowerCase() || "uib:tab-heading" === a.tagName.toLowerCase()) } return { restrict: "A", require: "^uibTabset", link: function (b, c, d) { var e = b.$eval(d.uibTabContentTransclude).tab; e.$transcludeFn(e.$parent, function (b) { angular.forEach(b, function (b) { a(b) ? e.headingElement = b : c.append(b) }) }) } } }), angular.module("ui.bootstrap.timepicker", []).constant("uibTimepickerConfig", { hourStep: 1, minuteStep: 1, secondStep: 1, showMeridian: !0, showSeconds: !1, meridians: null, readonlyInput: !1, mousewheel: !0, arrowkeys: !0, showSpinners: !0, templateUrl: "uib/template/timepicker/timepicker.html" }).controller("UibTimepickerController", ["$scope", "$element", "$attrs", "$parse", "$log", "$locale", "uibTimepickerConfig", function (a, b, c, d, e, f, g) { function h() { var b = +a.hours, c = a.showMeridian ? b > 0 && 13 > b : b >= 0 && 24 > b; return c && "" !== a.hours ? (a.showMeridian && (12 === b && (b = 0), a.meridian === y[1] && (b += 12)), b) : void 0 } function i() { var b = +a.minutes, c = b >= 0 && 60 > b; return c && "" !== a.minutes ? b : void 0 } function j() { var b = +a.seconds; return b >= 0 && 60 > b ? b : void 0 } function k(a, b) { return null === a ? "" : angular.isDefined(a) && a.toString().length < 2 && !b ? "0" + a : a.toString() } function l(a) { m(), x.$setViewValue(new Date(v)), n(a) } function m() { s && s.$setValidity("hours", !0), t && t.$setValidity("minutes", !0), u && u.$setValidity("seconds", !0), x.$setValidity("time", !0), a.invalidHours = !1, a.invalidMinutes = !1, a.invalidSeconds = !1 } function n(b) { if (x.$modelValue) { var c = v.getHours(), d = v.getMinutes(), e = v.getSeconds(); a.showMeridian && (c = 0 === c || 12 === c ? 12 : c % 12), a.hours = "h" === b ? c : k(c, !z), "m" !== b && (a.minutes = k(d)), a.meridian = v.getHours() < 12 ? y[0] : y[1], "s" !== b && (a.seconds = k(e)), a.meridian = v.getHours() < 12 ? y[0] : y[1] } else a.hours = null, a.minutes = null, a.seconds = null, a.meridian = y[0] } function o(a) { v = q(v, a), l() } function p(a, b) { return q(a, 60 * b) } function q(a, b) { var c = new Date(a.getTime() + 1e3 * b), d = new Date(a); return d.setHours(c.getHours(), c.getMinutes(), c.getSeconds()), d } function r() { return (null === a.hours || "" === a.hours) && (null === a.minutes || "" === a.minutes) && (!a.showSeconds || a.showSeconds && (null === a.seconds || "" === a.seconds)) } var s, t, u, v = new Date, w = [], x = { $setViewValue: angular.noop }, y = angular.isDefined(c.meridians) ? a.$parent.$eval(c.meridians) : g.meridians || f.DATETIME_FORMATS.AMPMS, z = angular.isDefined(c.padHours) ? a.$parent.$eval(c.padHours) : !0; a.tabindex = angular.isDefined(c.tabindex) ? c.tabindex : 0, b.removeAttr("tabindex"), this.init = function (b, d) { x = b, x.$render = this.render, x.$formatters.unshift(function (a) { return a ? new Date(a) : null }); var e = d.eq(0), f = d.eq(1), h = d.eq(2); s = e.controller("ngModel"), t = f.controller("ngModel"), u = h.controller("ngModel"); var i = angular.isDefined(c.mousewheel) ? a.$parent.$eval(c.mousewheel) : g.mousewheel; i && this.setupMousewheelEvents(e, f, h); var j = angular.isDefined(c.arrowkeys) ? a.$parent.$eval(c.arrowkeys) : g.arrowkeys; j && this.setupArrowkeyEvents(e, f, h), a.readonlyInput = angular.isDefined(c.readonlyInput) ? a.$parent.$eval(c.readonlyInput) : g.readonlyInput, this.setupInputEvents(e, f, h) }; var A = g.hourStep; c.hourStep && w.push(a.$parent.$watch(d(c.hourStep), function (a) { A = +a })); var B = g.minuteStep; c.minuteStep && w.push(a.$parent.$watch(d(c.minuteStep), function (a) { B = +a })); var C; w.push(a.$parent.$watch(d(c.min), function (a) { var b = new Date(a); C = isNaN(b) ? void 0 : b })); var D; w.push(a.$parent.$watch(d(c.max), function (a) { var b = new Date(a); D = isNaN(b) ? void 0 : b })); var E = !1; c.ngDisabled && w.push(a.$parent.$watch(d(c.ngDisabled), function (a) { E = a })), a.noIncrementHours = function () { var a = p(v, 60 * A); return E || a > D || v > a && C > a }, a.noDecrementHours = function () { var a = p(v, 60 * -A); return E || C > a || a > v && a > D }, a.noIncrementMinutes = function () { var a = p(v, B); return E || a > D || v > a && C > a }, a.noDecrementMinutes = function () { var a = p(v, -B); return E || C > a || a > v && a > D }, a.noIncrementSeconds = function () { var a = q(v, F); return E || a > D || v > a && C > a }, a.noDecrementSeconds = function () { var a = q(v, -F); return E || C > a || a > v && a > D }, a.noToggleMeridian = function () { return v.getHours() < 12 ? E || p(v, 720) > D : E || p(v, -720) < C }; var F = g.secondStep; c.secondStep && w.push(a.$parent.$watch(d(c.secondStep), function (a) { F = +a })), a.showSeconds = g.showSeconds, c.showSeconds && w.push(a.$parent.$watch(d(c.showSeconds), function (b) { a.showSeconds = !!b })), a.showMeridian = g.showMeridian, c.showMeridian && w.push(a.$parent.$watch(d(c.showMeridian), function (b) { if (a.showMeridian = !!b, x.$error.time) { var c = h(), d = i(); angular.isDefined(c) && angular.isDefined(d) && (v.setHours(c), l()) } else n() })), this.setupMousewheelEvents = function (b, c, d) { var e = function (a) { a.originalEvent && (a = a.originalEvent); var b = a.wheelDelta ? a.wheelDelta : -a.deltaY; return a.detail || b > 0 }; b.on("mousewheel wheel", function (b) { E || a.$apply(e(b) ? a.incrementHours() : a.decrementHours()), b.preventDefault() }), c.on("mousewheel wheel", function (b) { E || a.$apply(e(b) ? a.incrementMinutes() : a.decrementMinutes()), b.preventDefault() }), d.on("mousewheel wheel", function (b) { E || a.$apply(e(b) ? a.incrementSeconds() : a.decrementSeconds()), b.preventDefault() }) }, this.setupArrowkeyEvents = function (b, c, d) { b.on("keydown", function (b) { E || (38 === b.which ? (b.preventDefault(), a.incrementHours(), a.$apply()) : 40 === b.which && (b.preventDefault(), a.decrementHours(), a.$apply())) }), c.on("keydown", function (b) { E || (38 === b.which ? (b.preventDefault(), a.incrementMinutes(), a.$apply()) : 40 === b.which && (b.preventDefault(), a.decrementMinutes(), a.$apply())) }), d.on("keydown", function (b) { E || (38 === b.which ? (b.preventDefault(), a.incrementSeconds(), a.$apply()) : 40 === b.which && (b.preventDefault(), a.decrementSeconds(), a.$apply())) }) }, this.setupInputEvents = function (b, c, d) { if (a.readonlyInput) return a.updateHours = angular.noop, a.updateMinutes = angular.noop, void (a.updateSeconds = angular.noop); var e = function (b, c, d) { x.$setViewValue(null), x.$setValidity("time", !1), angular.isDefined(b) && (a.invalidHours = b, s && s.$setValidity("hours", !1)), angular.isDefined(c) && (a.invalidMinutes = c, t && t.$setValidity("minutes", !1)), angular.isDefined(d) && (a.invalidSeconds = d, u && u.$setValidity("seconds", !1)) }; a.updateHours = function () { var a = h(), b = i(); x.$setDirty(), angular.isDefined(a) && angular.isDefined(b) ? (v.setHours(a), v.setMinutes(b), C > v || v > D ? e(!0) : l("h")) : e(!0) }, b.on("blur", function (b) { x.$setTouched(), r() ? m() : null === a.hours || "" === a.hours ? e(!0) : !a.invalidHours && a.hours < 10 && a.$apply(function () { a.hours = k(a.hours, !z) }) }), a.updateMinutes = function () { var a = i(), b = h(); x.$setDirty(), angular.isDefined(a) && angular.isDefined(b) ? (v.setHours(b), v.setMinutes(a), C > v || v > D ? e(void 0, !0) : l("m")) : e(void 0, !0) }, c.on("blur", function (b) { x.$setTouched(), r() ? m() : null === a.minutes ? e(void 0, !0) : !a.invalidMinutes && a.minutes < 10 && a.$apply(function () { a.minutes = k(a.minutes) }) }), a.updateSeconds = function () { var a = j(); x.$setDirty(), angular.isDefined(a) ? (v.setSeconds(a), l("s")) : e(void 0, void 0, !0) }, d.on("blur", function (b) { r() ? m() : !a.invalidSeconds && a.seconds < 10 && a.$apply(function () { a.seconds = k(a.seconds) }) }) }, this.render = function () { var b = x.$viewValue; isNaN(b) ? (x.$setValidity("time", !1), e.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.')) : (b && (v = b), C > v || v > D ? (x.$setValidity("time", !1), a.invalidHours = !0, a.invalidMinutes = !0) : m(), n()) }, a.showSpinners = angular.isDefined(c.showSpinners) ? a.$parent.$eval(c.showSpinners) : g.showSpinners, a.incrementHours = function () { a.noIncrementHours() || o(60 * A * 60) }, a.decrementHours = function () { a.noDecrementHours() || o(60 * -A * 60) }, a.incrementMinutes = function () { a.noIncrementMinutes() || o(60 * B) }, a.decrementMinutes = function () { a.noDecrementMinutes() || o(60 * -B) }, a.incrementSeconds = function () { a.noIncrementSeconds() || o(F) }, a.decrementSeconds = function () { a.noDecrementSeconds() || o(-F) }, a.toggleMeridian = function () { var b = i(), c = h(); a.noToggleMeridian() || (angular.isDefined(b) && angular.isDefined(c) ? o(720 * (v.getHours() < 12 ? 60 : -60)) : a.meridian = a.meridian === y[0] ? y[1] : y[0]) }, a.blur = function () { x.$setTouched() }, a.$on("$destroy", function () { for (; w.length;) w.shift()() }) }]).directive("uibTimepicker", ["uibTimepickerConfig", function (a) { return { require: ["uibTimepicker", "?^ngModel"], restrict: "A", controller: "UibTimepickerController", controllerAs: "timepicker", scope: {}, templateUrl: function (b, c) { return c.templateUrl || a.templateUrl }, link: function (a, b, c, d) { var e = d[0], f = d[1]; f && e.init(f, b.find("input")) } } }]), angular.module("ui.bootstrap.typeahead", ["ui.bootstrap.debounce", "ui.bootstrap.position"]).factory("uibTypeaheadParser", ["$parse", function (a) { var b = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/; return { parse: function (c) { var d = c.match(b); if (!d) throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "' + c + '".'); return { itemName: d[3], source: a(d[4]), viewMapper: a(d[2] || d[1]), modelMapper: a(d[1]) } } } }]).controller("UibTypeaheadController", ["$scope", "$element", "$attrs", "$compile", "$parse", "$q", "$timeout", "$document", "$window", "$rootScope", "$$debounce", "$uibPosition", "uibTypeaheadParser", function (a, b, c, d, e, f, g, h, i, j, k, l, m) {
function n() { P.moveInProgress || (P.moveInProgress = !0, P.$digest()), $() } function o() { P.position = F ? l.offset(b) : l.position(b), P.position.top += b.prop("offsetHeight") } function p(a) { var b; return angular.version.minor < 6 ? (b = a.$options || {}, b.getOption = function (a) { return b[a] }) : b = a.$options, b } var q, r, s = [9, 13, 27, 38, 40], t = 200, u = a.$eval(c.typeaheadMinLength); u || 0 === u || (u = 1), a.$watch(c.typeaheadMinLength, function (a) { u = a || 0 === a ? a : 1 }); var v = a.$eval(c.typeaheadWaitMs) || 0, w = a.$eval(c.typeaheadEditable) !== !1; a.$watch(c.typeaheadEditable, function (a) { w = a !== !1 }); var x, y, z = e(c.typeaheadLoading).assign || angular.noop, A = c.typeaheadShouldSelect ? e(c.typeaheadShouldSelect) : function (a, b) { var c = b.$event; return 13 === c.which || 9 === c.which }, B = e(c.typeaheadOnSelect), C = angular.isDefined(c.typeaheadSelectOnBlur) ? a.$eval(c.typeaheadSelectOnBlur) : !1, D = e(c.typeaheadNoResults).assign || angular.noop, E = c.typeaheadInputFormatter ? e(c.typeaheadInputFormatter) : void 0, F = c.typeaheadAppendToBody ? a.$eval(c.typeaheadAppendToBody) : !1, G = c.typeaheadAppendTo ? a.$eval(c.typeaheadAppendTo) : null, H = a.$eval(c.typeaheadFocusFirst) !== !1, I = c.typeaheadSelectOnExact ? a.$eval(c.typeaheadSelectOnExact) : !1, J = e(c.typeaheadIsOpen).assign || angular.noop, K = a.$eval(c.typeaheadShowHint) || !1, L = e(c.ngModel), M = e(c.ngModel + "($$$p)"), N = function (b, c) { return angular.isFunction(L(a)) && r.getOption("getterSetter") ? M(b, { $$$p: c }) : L.assign(b, c) }, O = m.parse(c.uibTypeahead), P = a.$new(), Q = a.$on("$destroy", function () { P.$destroy() }); P.$on("$destroy", Q); var R = "typeahead-" + P.$id + "-" + Math.floor(1e4 * Math.random()); b.attr({ "aria-autocomplete": "list", "aria-expanded": !1, "aria-owns": R }); var S, T; K && (S = angular.element("
"), S.css("position", "relative"), b.after(S), T = b.clone(), T.attr("placeholder", ""), T.attr("tabindex", "-1"), T.val(""), T.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" }), b.css({ position: "relative", "vertical-align": "top", "background-color": "transparent" }), T.attr("id") && T.removeAttr("id"), S.append(T), T.after(b)); var U = angular.element("
"); U.attr({ id: R, matches: "matches", active: "activeIdx", select: "select(activeIdx, evt)", "move-in-progress": "moveInProgress", query: "query", position: "position", "assign-is-open": "assignIsOpen(isOpen)", debounce: "debounceUpdate" }), angular.isDefined(c.typeaheadTemplateUrl) && U.attr("template-url", c.typeaheadTemplateUrl), angular.isDefined(c.typeaheadPopupTemplateUrl) && U.attr("popup-template-url", c.typeaheadPopupTemplateUrl); var V = function () { K && T.val("") }, W = function () { P.matches = [], P.activeIdx = -1, b.attr("aria-expanded", !1), V() }, X = function (a) { return R + "-option-" + a }; P.$watch("activeIdx", function (a) { 0 > a ? b.removeAttr("aria-activedescendant") : b.attr("aria-activedescendant", X(a)) }); var Y = function (a, b) { return P.matches.length > b && a ? a.toUpperCase() === P.matches[b].label.toUpperCase() : !1 }, Z = function (c, d) { var e = { $viewValue: c }; z(a, !0), D(a, !1), f.when(O.source(a, e)).then(function (f) { var g = c === q.$viewValue; if (g && x) if (f && f.length > 0) { P.activeIdx = H ? 0 : -1, D(a, !1), P.matches.length = 0; for (var h = 0; h < f.length; h++) e[O.itemName] = f[h], P.matches.push({ id: X(h), label: O.viewMapper(P, e), model: f[h] }); if (P.query = c, o(), b.attr("aria-expanded", !0), I && 1 === P.matches.length && Y(c, 0) && (angular.isNumber(P.debounceUpdate) || angular.isObject(P.debounceUpdate) ? k(function () { P.select(0, d) }, angular.isNumber(P.debounceUpdate) ? P.debounceUpdate : P.debounceUpdate["default"]) : P.select(0, d)), K) { var i = P.matches[0].label; angular.isString(c) && c.length > 0 && i.slice(0, c.length).toUpperCase() === c.toUpperCase() ? T.val(c + i.slice(c.length)) : T.val("") } } else W(), D(a, !0); g && z(a, !1) }, function () { W(), z(a, !1), D(a, !0) }) }; F && (angular.element(i).on("resize", n), h.find("body").on("scroll", n)); var $ = k(function () { P.matches.length && o(), P.moveInProgress = !1 }, t); P.moveInProgress = !1, P.query = void 0; var _, aa = function (a) { _ = g(function () { Z(a) }, v) }, ba = function () { _ && g.cancel(_) }; W(), P.assignIsOpen = function (b) { J(a, b) }, P.select = function (d, e) { var f, h, i = {}; y = !0, i[O.itemName] = h = P.matches[d].model, f = O.modelMapper(a, i), N(a, f), q.$setValidity("editable", !0), q.$setValidity("parse", !0), B(a, { $item: h, $model: f, $label: O.viewMapper(a, i), $event: e }), W(), P.$eval(c.typeaheadFocusOnSelect) !== !1 && g(function () { b[0].focus() }, 0, !1) }, b.on("keydown", function (b) {
if (0 !== P.matches.length && -1 !== s.indexOf(b.which)) {
var c = A(a, { $event: b }); if (-1 === P.activeIdx && c || 9 === b.which && b.shiftKey) return W(), void P.$digest(); b.preventDefault(); var d; switch (b.which) {
case 27: b.stopPropagation(), W(), a.$digest(); break; case 38: P.activeIdx = (P.activeIdx > 0 ? P.activeIdx : P.matches.length) - 1, P.$digest(), d = U[0].querySelectorAll(".uib-typeahead-match")[P.activeIdx], d.parentNode.scrollTop = d.offsetTop; break; case 40: P.activeIdx = (P.activeIdx + 1) % P.matches.length, P.$digest(), d = U[0].querySelectorAll(".uib-typeahead-match")[P.activeIdx],
d.parentNode.scrollTop = d.offsetTop; break; default: c && P.$apply(function () { angular.isNumber(P.debounceUpdate) || angular.isObject(P.debounceUpdate) ? k(function () { P.select(P.activeIdx, b) }, angular.isNumber(P.debounceUpdate) ? P.debounceUpdate : P.debounceUpdate["default"]) : P.select(P.activeIdx, b) })
}
}
}), b.on("focus", function (a) { x = !0, 0 !== u || q.$viewValue || g(function () { Z(q.$viewValue, a) }, 0) }), b.on("blur", function (a) { C && P.matches.length && -1 !== P.activeIdx && !y && (y = !0, P.$apply(function () { angular.isObject(P.debounceUpdate) && angular.isNumber(P.debounceUpdate.blur) ? k(function () { P.select(P.activeIdx, a) }, P.debounceUpdate.blur) : P.select(P.activeIdx, a) })), !w && q.$error.editable && (q.$setViewValue(), P.$apply(function () { q.$setValidity("editable", !0), q.$setValidity("parse", !0) }), b.val("")), x = !1, y = !1 }); var ca = function (c) { b[0] !== c.target && 3 !== c.which && 0 !== P.matches.length && (W(), j.$$phase || a.$digest()) }; h.on("click", ca), a.$on("$destroy", function () { h.off("click", ca), (F || G) && da.remove(), F && (angular.element(i).off("resize", n), h.find("body").off("scroll", n)), U.remove(), K && S.remove() }); var da = d(U)(P); F ? h.find("body").append(da) : G ? angular.element(G).eq(0).append(da) : b.after(da), this.init = function (b) { q = b, r = p(q), P.debounceUpdate = e(r.getOption("debounce"))(a), q.$parsers.unshift(function (b) { return x = !0, 0 === u || b && b.length >= u ? v > 0 ? (ba(), aa(b)) : Z(b) : (z(a, !1), ba(), W()), w ? b : b ? void q.$setValidity("editable", !1) : (q.$setValidity("editable", !0), null) }), q.$formatters.push(function (b) { var c, d, e = {}; return w || q.$setValidity("editable", !0), E ? (e.$model = b, E(a, e)) : (e[O.itemName] = b, c = O.viewMapper(a, e), e[O.itemName] = void 0, d = O.viewMapper(a, e), c !== d ? c : b) }) }
}]).directive("uibTypeahead", function () { return { controller: "UibTypeaheadController", require: ["ngModel", "uibTypeahead"], link: function (a, b, c, d) { d[1].init(d[0]) } } }).directive("uibTypeaheadPopup", ["$$debounce", function (a) { return { scope: { matches: "=", query: "=", active: "=", position: "&", moveInProgress: "=", select: "&", assignIsOpen: "&", debounce: "&" }, replace: !0, templateUrl: function (a, b) { return b.popupTemplateUrl || "uib/template/typeahead/typeahead-popup.html" }, link: function (b, c, d) { b.templateUrl = d.templateUrl, b.isOpen = function () { var a = b.matches.length > 0; return b.assignIsOpen({ isOpen: a }), a }, b.isActive = function (a) { return b.active === a }, b.selectActive = function (a) { b.active = a }, b.selectMatch = function (c, d) { var e = b.debounce(); angular.isNumber(e) || angular.isObject(e) ? a(function () { b.select({ activeIdx: c, evt: d }) }, angular.isNumber(e) ? e : e["default"]) : b.select({ activeIdx: c, evt: d }) } } } }]).directive("uibTypeaheadMatch", ["$templateRequest", "$compile", "$parse", function (a, b, c) { return { scope: { index: "=", match: "=", query: "=" }, link: function (d, e, f) { var g = c(f.templateUrl)(d.$parent) || "uib/template/typeahead/typeahead-match.html"; a(g).then(function (a) { var c = angular.element(a.trim()); e.replaceWith(c), b(c)(d) }) } } }]).filter("uibTypeaheadHighlight", ["$sce", "$injector", "$log", function (a, b, c) { function d(a) { return a.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1") } function e(a) { return /<.*>/g.test(a) } var f; return f = b.has("$sanitize"), function (b, g) { return !f && e(b) && c.warn("Unsafe use of typeahead please use ngSanitize"), b = g ? ("" + b).replace(new RegExp(d(g), "gi"), "
$& ") : b, f || (b = a.trustAsHtml(b)), b } }]), angular.module("uib/template/accordion/accordion-group.html", []).run(["$templateCache", function (a) { a.put("uib/template/accordion/accordion-group.html", '
\n
\n') }]), angular.module("uib/template/accordion/accordion.html", []).run(["$templateCache", function (a) { a.put("uib/template/accordion/accordion.html", '
') }]), angular.module("uib/template/alert/alert.html", []).run(["$templateCache", function (a) { a.put("uib/template/alert/alert.html", '
\n × \n Close \n \n
\n') }]), angular.module("uib/template/carousel/carousel.html", []).run(["$templateCache", function (a) { a.put("uib/template/carousel/carousel.html", '
\n
\n \n previous \n \n
\n \n next \n \n
\n \n slide {{ $index + 1 }} of {{ slides.length }}, currently active \n \n \n') }]), angular.module("uib/template/carousel/slide.html", []).run(["$templateCache", function (a) { a.put("uib/template/carousel/slide.html", '
\n') }]), angular.module("uib/template/datepicker/datepicker.html", []).run(["$templateCache", function (a) { a.put("uib/template/datepicker/datepicker.html", '
\n') }]), angular.module("uib/template/datepicker/day.html", []).run(["$templateCache", function (a) { a.put("uib/template/datepicker/day.html", '
\n \n \n previous \n {{title}} \n next \n \n \n \n {{::label.abbr}} \n \n \n \n \n {{ weekNumbers[$index] }} \n \n {{::dt.label}} \n \n \n \n
\n') }]), angular.module("uib/template/datepicker/month.html", []).run(["$templateCache", function (a) { a.put("uib/template/datepicker/month.html", '
\n \n \n previous \n {{title}} \n next \n \n \n \n \n \n {{::dt.label}} \n \n \n \n
\n') }]), angular.module("uib/template/datepicker/year.html", []).run(["$templateCache", function (a) { a.put("uib/template/datepicker/year.html", '
\n \n \n previous \n {{title}} \n next \n \n \n \n \n \n {{::dt.label}} \n \n \n \n
\n') }]), angular.module("uib/template/datepickerPopup/popup.html", []).run(["$templateCache", function (a) { a.put("uib/template/datepickerPopup/popup.html", '\n') }]), angular.module("uib/template/modal/window.html", []).run(["$templateCache", function (a) { a.put("uib/template/modal/window.html", "
\n") }]), angular.module("uib/template/pager/pager.html", []).run(["$templateCache", function (a) { a.put("uib/template/pager/pager.html", '
{{::getText(\'previous\')}} \n
{{::getText(\'next\')}} \n') }]), angular.module("uib/template/pagination/pagination.html", []).run(["$templateCache", function (a) { a.put("uib/template/pagination/pagination.html", '\n\n\n\n\n') }]), angular.module("uib/template/tooltip/tooltip-html-popup.html", []).run(["$templateCache", function (a) { a.put("uib/template/tooltip/tooltip-html-popup.html", '
\n
\n') }]), angular.module("uib/template/tooltip/tooltip-popup.html", []).run(["$templateCache", function (a) { a.put("uib/template/tooltip/tooltip-popup.html", '
\n
\n') }]), angular.module("uib/template/tooltip/tooltip-template-popup.html", []).run(["$templateCache", function (a) { a.put("uib/template/tooltip/tooltip-template-popup.html", '
\n
\n') }]), angular.module("uib/template/popover/popover-html.html", []).run(["$templateCache", function (a) { a.put("uib/template/popover/popover-html.html", '
\n\n
\n') }]), angular.module("uib/template/popover/popover-template.html", []).run(["$templateCache", function (a) { a.put("uib/template/popover/popover-template.html", '
\n\n
\n') }]), angular.module("uib/template/popover/popover.html", []).run(["$templateCache", function (a) { a.put("uib/template/popover/popover.html", '
\n\n
\n') }]), angular.module("uib/template/progressbar/bar.html", []).run(["$templateCache", function (a) { a.put("uib/template/progressbar/bar.html", '
\n') }]), angular.module("uib/template/progressbar/progress.html", []).run(["$templateCache", function (a) { a.put("uib/template/progressbar/progress.html", '
') }]), angular.module("uib/template/progressbar/progressbar.html", []).run(["$templateCache", function (a) { a.put("uib/template/progressbar/progressbar.html", '
\n') }]), angular.module("uib/template/rating/rating.html", []).run(["$templateCache", function (a) { a.put("uib/template/rating/rating.html", '
\n ({{ $index < value ? \'*\' : \' \' }}) \n \n \n') }]), angular.module("uib/template/tabs/tab.html", []).run(["$templateCache", function (a) { a.put("uib/template/tabs/tab.html", '
\n {{heading}} \n \n') }]), angular.module("uib/template/tabs/tabset.html", []).run(["$templateCache", function (a) { a.put("uib/template/tabs/tabset.html", '
\n') }]), angular.module("uib/template/timepicker/timepicker.html", []).run(["$templateCache", function (a) { a.put("uib/template/timepicker/timepicker.html", '
\n') }]), angular.module("uib/template/typeahead/typeahead-match.html", []).run(["$templateCache", function (a) { a.put("uib/template/typeahead/typeahead-match.html", '
\n') }]), angular.module("uib/template/typeahead/typeahead-popup.html", []).run(["$templateCache", function (a) { a.put("uib/template/typeahead/typeahead-popup.html", '\n') }]), angular.module("ui.bootstrap.carousel").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibCarouselCss && angular.element(document).find("head").prepend(''), angular.$$uibCarouselCss = !0 }), angular.module("ui.bootstrap.datepicker").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibDatepickerCss && angular.element(document).find("head").prepend(''), angular.$$uibDatepickerCss = !0 }), angular.module("ui.bootstrap.position").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibPositionCss && angular.element(document).find("head").prepend(''), angular.$$uibPositionCss = !0 }), angular.module("ui.bootstrap.datepickerPopup").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibDatepickerpopupCss && angular.element(document).find("head").prepend(''), angular.$$uibDatepickerpopupCss = !0 }), angular.module("ui.bootstrap.tooltip").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibTooltipCss && angular.element(document).find("head").prepend(''), angular.$$uibTooltipCss = !0 }), angular.module("ui.bootstrap.timepicker").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibTimepickerCss && angular.element(document).find("head").prepend(''), angular.$$uibTimepickerCss = !0 }), angular.module("ui.bootstrap.typeahead").run(function () { !angular.$$csp().noInlineStyle && !angular.$$uibTypeaheadCss && angular.element(document).find("head").prepend(''), angular.$$uibTypeaheadCss = !0 });
/**
* State-based routing for AngularJS 1.x
* NOTICE: This monolithic bundle also bundles the @uirouter/core code.
* This causes it to be incompatible with plugins that depend on @uirouter/core.
* We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead.
* For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles
* @version v1.0.11
* @link https://ui-router.github.io
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? e(exports, require("angular")) : "function" == typeof define && define.amd ? define(["exports", "angular"], e) : e(t["@uirouter/angularjs"] = {}, t.angular) }(this, function (t, e) { "use strict"; function r(t) { function e(r) { return r.length >= n ? t.apply(null, r) : function () { return e(r.concat([].slice.apply(arguments))) } } var r = [].slice.apply(arguments, [1]), n = t.length; return e(r) } function n() { var t = arguments, e = t.length - 1; return function () { for (var r = e, n = t[e].apply(this, arguments); r--;)n = t[r].call(this, n); return n } } function i() { for (var t = [], e = 0; e < arguments.length; e++)t[e] = arguments[e]; return n.apply(null, [].slice.call(arguments).reverse()) } function o(t, e) { return function () { for (var r = [], n = 0; n < arguments.length; n++)r[n] = arguments[n]; return t.apply(null, r) && e.apply(null, r) } } function a(t, e) { return function () { for (var r = [], n = 0; n < arguments.length; n++)r[n] = arguments[n]; return t.apply(null, r) || e.apply(null, r) } } function u(t, e) { return function (r) { return r[t].apply(r, e) } } function s(t) { return function (e) { for (var r = 0; r < t.length; r++)if (t[r][0](e)) return t[r][1](e) } } function c(t) { if (te(t) && t.length) { var e = t.slice(0, -1), r = t.slice(-1); return !(e.filter(Ht(Zt)).length || r.filter(Ht(Kt)).length) } return Kt(t) } function f(t) { return t } function l() { } function h(t, e, r, n, i) { void 0 === i && (i = !1); var o = function (e) { return t()[e].bind(r()) }, a = function (t) { return function () { return e[t] = o(t), e[t].apply(null, arguments) } }; return (n = n || Object.keys(t())).reduce(function (t, e) { return t[e] = i ? a(e) : o(e), t }, e) } function p(t, e) { return -1 !== t.indexOf(e) } function d(t, e) { var r = t.indexOf(e); return r >= 0 && t.splice(r, 1), t } function v(t, e) { return t.push(e), e } function m(t) { for (var e = [], r = 1; r < arguments.length; r++)e[r - 1] = arguments[r]; var n = e.concat({}).reverse(), i = he.apply(null, n); return he({}, i, g(t || {}, Object.keys(i))) } function y(t, e) { var r = []; for (var n in t.path) { if (t.path[n] !== e.path[n]) break; r.push(t.path[n]) } return r } function g(t, e) { var r = {}; for (var n in t) -1 !== e.indexOf(n) && (r[n] = t[n]); return r } function _(t, e) { return Object.keys(t).filter(Ht(ve(e))).reduce(function (e, r) { return e[r] = t[r], e }, {}) } function w(t, e) { return b(t, jt(e)) } function $(t, e) { var r = te(t), n = r ? [] : {}, i = r ? function (t) { return n.push(t) } : function (t, e) { return n[e] = t }; return le(t, function (t, r) { e(t, r) && i(t, r) }), n } function S(t, e) { var r; return le(t, function (t, n) { r || e(t, n) && (r = t) }), r } function b(t, e) { var r = te(t) ? [] : {}; return le(t, function (t, n) { return r[n] = e(t, n) }), r } function R(t, e) { return t.push(e), t } function E(t, e) { return void 0 === e && (e = "assert failure"), function (r) { var n = t(r); if (!n) throw new Error(Kt(e) ? e(r) : e); return n } } function T() { for (var t = [], e = 0; e < arguments.length; e++)t[e] = arguments[e]; if (0 === t.length) return []; var r, n = t.reduce(function (t, e) { return Math.min(e.length, t) }, 9007199254740991), i = []; for (r = 0; r < n; r++)switch (t.length) { case 1: i.push([t[0][r]]); break; case 2: i.push([t[0][r], t[1][r]]); break; case 3: i.push([t[0][r], t[1][r], t[2][r]]); break; case 4: i.push([t[0][r], t[1][r], t[2][r], t[3][r]]); break; default: i.push(t.map(function (t) { return t[r] })) }return i } function C(t, e) { var r, n; if (te(e) && (r = e[0], n = e[1]), !Zt(r)) throw new Error("invalid parameters to applyPairs"); return t[r] = n, t } function P(t) { return t.length && t[t.length - 1] || void 0 } function k(t, e) { return e && Object.keys(e).forEach(function (t) { return delete e[t] }), e || (e = {}), he(e, t) } function O(t) { for (var e = 1; e < arguments.length; e++) { var r = arguments[e]; if (r) for (var n = Object.keys(r), i = 0; i < n.length; i++)t[n[i]] = r[n[i]] } return t } function x(t, e) { if (t === e) return !0; if (null === t || null === e) return !1; if (t !== t && e !== e) return !0; var r = typeof t; if (r !== typeof e || "object" !== r) return !1; var n = [t, e]; if (qt(te)(n)) return I(t, e); if (qt(ee)(n)) return t.getTime() === e.getTime(); if (qt(re)(n)) return t.toString() === e.toString(); if (qt(Kt)(n)) return !0; if ([Kt, te, ee, re].map(Dt).reduce(function (t, e) { return t || !!e(n) }, !1)) return !1; var i, o = {}; for (i in t) { if (!x(t[i], e[i])) return !1; o[i] = !0 } for (i in e) if (!o[i]) return !1; return !0 } function I(t, e) { return t.length === e.length && T(t, e).reduce(function (t, e) { return t && x(e[0], e[1]) }, !0) } function j(t) { if (!t) return "ui-view (defunct)"; var e = t.creationContext ? t.creationContext.name || "(root)" : "(none)"; return "[ui-view#" + t.id + " " + t.$type + ":" + t.fqn + " (" + t.name + "@" + e + ")]" } function V(e) { return Yt(e) ? t.Category[e] : t.Category[t.Category[e]] } function A(t, e) { var r = Zt(e) ? [e] : e; return !!(Kt(r) ? r : function (t) { for (var e = r, n = 0; n < e.length; n++) { var i = new Lt(e[n]); if (i && i.matches(t.name) || !i && e[n] === t.name) return !0 } return !1 })(t) } function H(t, e, r) { function n(t, n, a) { void 0 === a && (a = {}); var u = new Je(e, r, n, t, o, a); return i.push(u), u.deregister.bind(u) } var i = (t._registeredHooks = t._registeredHooks || {})[r.name] = [], o = me(i); return t[r.name] = n, n } function q(t) { return void 0 === t && (t = !1), function (e, r) { var n = t ? -1 : 1, i = (e.node.state.path.length - r.node.state.path.length) * n; return 0 !== i ? i : r.hook.priority - e.hook.priority } } function D(t, e) { function r(t) { return te(t) ? t : zt(t) ? [t] : [] } function n(t) { switch (t.length) { case 0: return; case 1: return "auto" === e ? t[0] : t; default: return t } } function i(t, e) { return function (i) { if (te(i) && 0 === i.length) return i; var o = b(r(i), t); return !0 === e ? 0 === $(o, function (t) { return !t }).length : n(o) } } function o(t) { return function (e, n) { var i = r(e), o = r(n); if (i.length !== o.length) return !1; for (var a = 0; a < i.length; a++)if (!t(i[a], o[a])) return !1; return !0 } } var a = this;["encode", "decode", "equals", "$normalize"].forEach(function (e) { var r = t[e].bind(t), n = "equals" === e ? o : i; a[e] = n(r) }), he(this, { dynamic: t.dynamic, name: t.name, pattern: t.pattern, inherit: t.inherit, is: i(t.is.bind(t), !0), $arrayMode: e }) } function F(t) { function e() { return t.value } return t = Ze(t) && { value: t } || t, e.__cacheable = !0, he(t, { $$fn: c(t.value) ? t.value : e }) } function N(e, r, n, i, o) { if (e.type && r && "string" !== r.name) throw new Error("Param '" + i + "' has two type configurations."); if (e.type && r && "string" === r.name && o.type(e.type)) return o.type(e.type); if (r) return r; if (!e.type) { var a = n === t.DefType.CONFIG ? "any" : n === t.DefType.PATH ? "path" : n === t.DefType.SEARCH ? "query" : "string"; return o.type(a) } return e.type instanceof Ke ? e.type : o.type(e.type) } function U(t, e, r) { var n = t.squash; if (!e || !1 === n) return !1; if (!zt(n) || null == n) return r; if (!0 === n || Zt(n)) return n; throw new Error("Invalid squash policy: '" + n + "'. Valid policies: false, true, or arbitrary string") } function L(t, e, r, n) { var i, o, a = [{ from: "", to: r || e ? void 0 : "" }, { from: null, to: r || e ? void 0 : "" }]; return i = te(t.replace) ? t.replace : [], Zt(n) && i.push({ from: n, to: void 0 }), o = b(i, jt("from")), $(a, function (t) { return -1 === o.indexOf(t.from) }).concat(i) } function M(t, e) { return e.length <= t ? e : e.substr(0, t - 3) + "..." } function B(t, e) { for (; e.length < t;)e += " "; return e } function G(t) { return t.replace(/^([A-Z])/, function (t) { return t.toLowerCase() }).replace(/([A-Z])/g, function (t) { return "-" + t.toLowerCase() }) } function W(t) { var e = z(t), r = e.match(/^(function [^ ]+\([^)]*\))/), n = r ? r[1] : e, i = t.name || ""; return i && n.match(/function \(/) ? "function " + i + n.substr(9) : n } function z(t) { var e = te(t) ? t.slice(-1)[0] : t; return e && e.toString() || "undefined" } function J(t) { function e(t) { if (Xt(t)) { if (-1 !== r.indexOf(t)) return "[circular ref]"; r.push(t) } return dr(t) } var r = []; return JSON.stringify(t, function (t, r) { return e(r) }).replace(/\\"/g, '"') } function Q(t) { var e = new RegExp("(" + t + ")", "g"); return function (t) { return t.split(e).filter(f) } } function K(t, e) { return Zt(P(t)) && Zt(e) ? t.slice(0, -1).concat(P(t) + e) : R(t, e) } function Y(t) { return t.name } function Z(t) { return t.self.$$state = function () { return t }, t.self } function X(t) { return t.parent && t.parent.data && (t.data = t.self.data = de(t.parent.data, t.data)), t.data } function tt(t) { return t.parent ? t.parent.path.concat(t) : [t] } function et(t) { var e = t.parent ? he({}, t.parent.includes) : {}; return e[t.name] = !0, e } function rt(t) { var e = function (t) { var e = ae.$injector; return t.$inject || e && e.annotate(t, e.strictDi) || "deferred" }, r = function (t) { return t.provide || t.token }, n = s([[jt("resolveFn"), function (t) { return new nr(r(t), t.resolveFn, t.deps, t.policy) }], [jt("useFactory"), function (t) { return new nr(r(t), t.useFactory, t.deps || t.dependencies, t.policy) }], [jt("useClass"), function (t) { return new nr(r(t), function () { return new t.useClass }, [], t.policy) }], [jt("useValue"), function (t) { return new nr(r(t), function () { return t.useValue }, [], t.policy, t.useValue) }], [jt("useExisting"), function (t) { return new nr(r(t), f, [t.useExisting], t.policy) }]]), o = s([[i(jt("val"), Zt), function (t) { return new nr(t.token, f, [t.val], t.policy) }], [i(jt("val"), te), function (t) { return new nr(t.token, P(t.val), t.val.slice(0, -1), t.policy) }], [i(jt("val"), Kt), function (t) { return new nr(t.token, t.val, e(t.val), t.policy) }]]), a = s([[Ft(nr), function (t) { return t }], [function (t) { return !(!t.token || !t.resolveFn) }, n], [function (t) { return !(!t.provide && !t.token || !(t.useValue || t.useFactory || t.useExisting || t.useClass)) }, n], [function (t) { return !!(t && t.val && (Zt(t.val) || te(t.val) || Kt(t.val))) }, o], [Ut(!0), function (t) { throw new Error("Invalid resolve value: " + J(t)) }]]), u = t.resolve; return (te(u) ? u : function (t, e) { return Object.keys(t || {}).map(function (r) { return { token: r, val: t[r], deps: void 0, policy: e[r] } }) }(u, t.resolvePolicy || {})).map(a) } function nt(t, e) { var r = ["", ""], n = t.replace(/[\\\[\]\^$*+?.()|{}]/g, "\\$&"); if (!e) return n; switch (e.squash) { case !1: r = ["(", ")" + (e.isOptional ? "?" : "")]; break; case !0: n = n.replace(/\/$/, ""), r = ["(?:/(", ")|/)?"]; break; default: r = ["(" + e.squash + "|", ")?"] }return n + r[0] + e.type.pattern.source + r[1] } function it(t, e, r, n) { return "/" === n ? t : e ? yr(n) + t : r ? n.slice(1) + t : t } function ot(t) { if (!(Kt(t) || Zt(t) || Ft(Ge)(t) || Ge.isDef(t))) throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property"); return Kt(t) ? t : Ut(t) } function at(t) { t.addResolvable({ token: tn, deps: [], resolveFn: function () { return t.router }, data: t.router }, ""), t.addResolvable({ token: hr, deps: [], resolveFn: function () { return t }, data: t }, ""), t.addResolvable({ token: "$transition$", deps: [], resolveFn: function () { return t }, data: t }, ""), t.addResolvable({ token: "$stateParams", deps: [], resolveFn: function () { return t.params() }, data: t.params() }, ""), t.entering().forEach(function (e) { t.addResolvable({ token: "$state$", deps: [], resolveFn: function () { return e }, data: e }, e) }) } function ut(t) { return function (e, r) { return (0, r.$$state()[t])(e, r) } } function st(t, e) { var r = e.$$state().lazyLoad, n = r._promise; if (!n) { n = r._promise = ae.$q.when(r(t, e)).then(function (e) { return e && Array.isArray(e.states) && e.states.forEach(function (e) { return t.router.stateRegistry.register(e) }), e }).then(function (t) { return delete e.lazyLoad, delete e.$$state().lazyLoad, delete r._promise, t }, function (t) { return delete r._promise, ae.$q.reject(t) }) } return n } function ct(t) { var e = t._ignoredReason(); if (e) { Be.traceTransitionIgnored(t); var r = t.router.globals.transition; return "SameAsCurrent" === e && r && r.abort(), He.ignored().toPromise() } } function ft(t) { if (!t.valid()) throw new Error(t.error()) } function lt(t) { var e = function (t) { return t || "" }, r = gr(t).map(e), n = r[0], i = r[1], o = _r(n).map(e); return { path: o[0], search: o[1], hash: i, url: t } } function ht(t, e, r, n) { return function (i) { var o = i.locationService = new r(i), a = i.locationConfig = new n(i, e); return { name: t, service: o, configuration: a, dispose: function (t) { t.dispose(o), t.dispose(a) } } } } function pt(t) { return ae.$injector = An, ae.$q = xn, { name: "vanilla.services", $q: xn, $injector: An, dispose: function () { return null } } } function dt() { var t = null; return function (e, r) { return t = t || ae.$injector.get("$templateFactory"), [new ei(e, r, t)] } } function vt(t) { if (!t.parent) return {}; var e = ["controller", "controllerProvider", "controllerAs", "resolveAs"], r = ["component", "bindings", "componentProvider"], n = ["templateProvider", "templateUrl", "template", "notify", "async"].concat(e), i = r.concat(n); if (zt(t.views) && Xn(i, t)) throw new Error("State '" + t.name + "' has a 'views' object. It cannot also have \"view properties\" at the state level. Move the following properties into a view (in the 'views' object): " + i.filter(function (e) { return zt(t[e]) }).join(", ")); var o = {}, a = t.views || { $default: g(t, i) }; return le(a, function (e, i) { if (i = i || "$default", Zt(e) && (e = { component: e }), e = he({}, e), Xn(r, e) && Xn(n, e)) throw new Error("Cannot combine: " + r.join("|") + " with: " + n.join("|") + " in stateview: '" + i + "@" + t.name + "'"); e.resolveAs = e.resolveAs || "$resolve", e.$type = "ng1", e.$context = t, e.$name = i; var a = Br.normalizeUIViewTarget(e.$context, e.$name); e.$uiViewName = a.uiViewName, e.$uiViewContextAnchor = a.uiViewContextAnchor, o[i] = e }), o } function mt(t) { var e = ae.$injector.get(t + "Directive"); if (!e || !e.length) throw new Error("Unable to find component named '" + t + "'"); return e.map(ni).reduce(Re, []) } function yt(t) { function e(t, e, n, i, o, a) { return r._runtimeServices(i, t, n, e), delete di.router, delete di.$get, di } (di = this.router = new tn).stateProvider = new oi(di.stateRegistry, di.stateService), di.stateRegistry.decorator("views", vt), di.stateRegistry.decorator("onExit", ai("onExit")), di.stateRegistry.decorator("onRetain", ai("onRetain")), di.stateRegistry.decorator("onEnter", ai("onEnter")), di.viewService._pluginapi._viewConfigFactory("ng1", dt()); var r = di.locationService = di.locationConfig = new ui(t); return ui.monkeyPatchPathParameterType(di), di.router = di, di.$get = e, e.$inject = ["$location", "$browser", "$sniffer", "$rootScope", "$http", "$templateCache"], di } function gt(t, e, r) { ae.$injector = t, ae.$q = e, r.stateRegistry.get().map(function (t) { return t.$$state().resolvables }).reduce(Re, []).filter(function (t) { return "deferred" === t.deps }).forEach(function (e) { return e.deps = t.annotate(e.resolveFn, t.strictDi) }) } function _t(t) { t.$watch(function () { Be.approximateDigests++ }) } function wt(t) { var e, r = t.match(/^\s*({[^}]*})\s*$/); if (r && (t = "(" + r[1] + ")"), !(e = t.replace(/\n/g, " ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/)) || 4 !== e.length) throw new Error("Invalid state ref '" + t + "'"); return { state: e[1] || null, paramExpr: e[3] || null } } function $t(t) { var e = t.parent().inheritedData("$uiView"), r = At("$cfg.path")(e); return r ? P(r).state.name : void 0 } function St(t, e, r) { var n = r.uiState || t.current.name, i = he(Et(e, t), r.uiStateOpts || {}), o = t.href(n, r.uiStateParams, i); return { uiState: n, uiStateParams: r.uiStateParams, uiStateOpts: i, href: o } } function bt(t) { var e = "[object SVGAnimatedString]" === Object.prototype.toString.call(t.prop("href")), r = "FORM" === t[0].nodeName; return { attr: r ? "action" : e ? "xlink:href" : "href", isAnchor: "A" === t.prop("tagName").toUpperCase(), clickable: !r } } function Rt(t, e, r, n, i) { return function (o) { var a = o.which || o.button, u = i(); if (!(a > 1 || o.ctrlKey || o.metaKey || o.shiftKey || t.attr("target"))) { var s = r(function () { e.go(u.uiState, u.uiStateParams, u.uiStateOpts) }); o.preventDefault(); var c = n.isAnchor && !u.href ? 1 : 0; o.preventDefault = function () { c-- <= 0 && r.cancel(s) } } } } function Et(t, e) { return { relative: $t(t) || e.$current, inherit: !0, source: "sref" } } function Tt(t, e, r, n) { var i; n && (i = n.events), te(i) || (i = ["click"]); for (var o = t.on ? "on" : "bind", a = 0, u = i; a < u.length; a++) { var s = u[a]; t[o](s, r) } e.$on("$destroy", function () { for (var e = t.off ? "off" : "unbind", n = 0, o = i; n < o.length; n++) { var a = o[n]; t[e](a, r) } }) } function Ct(t) { var e = function (e, r, n) { return t.is(e, r, n) }; return e.$stateful = !0, e } function Pt(t) { var e = function (e, r, n) { return t.includes(e, r, n) }; return e.$stateful = !0, e } function kt(t, e, r, n, i, o) { var a = At("viewDecl.controllerAs"), u = At("viewDecl.resolveAs"); return { restrict: "ECA", priority: -400, compile: function (n) { var o = n.html(); return n.empty(), function (n, s) { var c = s.data("$uiView"); if (!c) return s.html(o), void t(s.contents())(n); var f = c.$cfg || { viewDecl: {}, getTemplate: l }, h = f.path && new cr(f.path); s.html(f.getTemplate(s, h) || o), Be.traceUIViewFill(c.$uiView, s.html()); var p = t(s.contents()), d = f.controller, v = a(f), m = u(f), y = h && yi(h); if (n[m] = y, d) { var g = e(d, he({}, y, { $scope: n, $element: s })); v && (n[v] = g, n[v][m] = y), s.data("$ngControllerController", g), s.children().data("$ngControllerController", g), Ot(i, r, g, n, f) } if (Zt(f.viewDecl.component)) var _ = f.viewDecl.component, w = G(_), $ = new RegExp("^(x-|data-)?" + w + "$", "i"), S = n.$watch(function () { var t = [].slice.call(s[0].children).filter(function (t) { return t && t.tagName && $.exec(t.tagName) }); return t && It.element(t).data("$" + _ + "Controller") }, function (t) { t && (Ot(i, r, t, n, f), S()) }); p(n) } } } } function Ot(t, e, r, n, i) { !Kt(r.$onInit) || i.viewDecl.component && $i || r.$onInit(); var o = P(i.path).state.self, a = { bind: r }; if (Kt(r.uiOnParamsChanged)) { var u = new cr(i.path).getResolvable("$transition$").data; n.$on("$destroy", e.onSuccess({}, function (t) { if (t !== u && -1 === t.exiting().indexOf(o)) { var e = t.params("to"), n = t.params("from"), i = t.treeChanges().to.map(function (t) { return t.paramSchema }).reduce(Re, []), a = t.treeChanges().from.map(function (t) { return t.paramSchema }).reduce(Re, []), s = i.filter(function (t) { var r = a.indexOf(t); return -1 === r || !a[r].type.equals(e[t.id], n[t.id]) }); if (s.length) { var c = s.map(function (t) { return t.id }), f = $(e, function (t, e) { return -1 !== c.indexOf(e) }); r.uiOnParamsChanged(f, t) } } }, a)) } if (Kt(r.uiCanExit)) { var s = Si++, c = function (t) { return !!t && (t._uiCanExitIds && !0 === t._uiCanExitIds[s] || c(t.redirectedFrom())) }, f = { exiting: o.name }; n.$on("$destroy", e.onBefore(f, function (e) { var n, i = e._uiCanExitIds = e._uiCanExitIds || {}; return c(e) || (n = t.when(r.uiCanExit(e))).then(function (t) { return i[s] = !1 !== t }), n }, a)) } } var xt = angular, It = e && e.module ? e : xt, jt = function (t) { return function (e) { return e && e[t] } }, Vt = r(function (t, e, r) { return r && r[t] === e }), At = function (t) { return i.apply(null, t.split(".").map(jt)) }, Ht = function (t) { return function () { for (var e = [], r = 0; r < arguments.length; r++)e[r] = arguments[r]; return !t.apply(null, e) } }, qt = function (t) { return function (e) { return e.reduce(function (e, r) { return e && !!t(r) }, !0) } }, Dt = function (t) { return function (e) { return e.reduce(function (e, r) { return e || !!t(r) }, !1) } }, Ft = function (t) { return function (e) { return null != e && e.constructor === t || e instanceof t } }, Nt = function (t) { return function (e) { return t === e } }, Ut = function (t) { return function () { return t } }, Lt = function () { function t(t) { this.text = t, this.glob = t.split("."); var e = this.text.split(".").map(function (t) { return "**" === t ? "(?:|(?:\\.[^.]*)*)" : "*" === t ? "\\.[^.]*" : "\\." + t }).join(""); this.regexp = new RegExp("^" + e + "$") } return t.prototype.matches = function (t) { return this.regexp.test("." + t) }, t.is = function (t) { return !!/[!,*]+/.exec(t) }, t.fromString = function (e) { return t.is(e) ? new t(e) : null }, t }(), Mt = function () { function t(e) { return t.create(e || {}) } return t.create = function (e) { e = t.isStateClass(e) ? new e : e; var r = de(de(e, t.prototype)); return e.$$state = function () { return r }, r.self = e, r.__stateObjectCache = { nameGlob: Lt.fromString(r.name) }, r }, t.prototype.is = function (t) { return this === t || this.self === t || this.fqn() === t }, t.prototype.fqn = function () { if (!(this.parent && this.parent instanceof this.constructor)) return this.name; var t = this.parent.fqn(); return t ? t + "." + this.name : this.name }, t.prototype.root = function () { return this.parent && this.parent.root() || this }, t.prototype.parameters = function (t) { return ((t = m(t, { inherit: !0, matchingKeys: null })).inherit && this.parent && this.parent.parameters() || []).concat($e(this.params)).filter(function (e) { return !t.matchingKeys || t.matchingKeys.hasOwnProperty(e.id) }) }, t.prototype.parameter = function (t, e) { return void 0 === e && (e = {}), this.url && this.url.parameter(t, e) || S($e(this.params), Vt("id", t)) || e.inherit && this.parent && this.parent.parameter(t) }, t.prototype.toString = function () { return this.fqn() }, t.isStateClass = function (t) { return Kt(t) && !0 === t.__uiRouterState }, t.isState = function (t) { return Xt(t.__stateObjectCache) }, t }(), Bt = Object.prototype.toString, Gt = function (t) { return function (e) { return typeof e === t } }, Wt = Gt("undefined"), zt = Ht(Wt), Jt = function (t) { return null === t }, Qt = a(Jt, Wt), Kt = Gt("function"), Yt = Gt("number"), Zt = Gt("string"), Xt = function (t) { return null !== t && "object" == typeof t }, te = Array.isArray, ee = function (t) { return "[object Date]" === Bt.call(t) }, re = function (t) { return "[object RegExp]" === Bt.call(t) }, ne = Mt.isState, ie = o(Xt, i(jt("then"), Kt)), oe = function (t) { return function () { throw new Error(t + "(): No coreservices implementation for UI-Router is loaded.") } }, ae = { $q: void 0, $injector: void 0 }, ue = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0, se = ue.angular || {}, ce = se.fromJson || JSON.parse.bind(JSON), fe = se.toJson || JSON.stringify.bind(JSON), le = se.forEach || function (t, e, r) { if (te(t)) return t.forEach(e, r); Object.keys(t).forEach(function (r) { return e(t[r], r) }) }, he = Object.assign || O, pe = se.equals || x, de = function (t, e) { return he(Object.create(t), e) }, ve = r(p), me = r(d), ye = r(v), ge = function (t) { return t.slice().forEach(function (e) { "function" == typeof e && e(), me(t, e) }) }, _e = function (t, e) { return he(t, e) }, we = b, $e = function (t) { return Object.keys(t).map(function (e) { return t[e] }) }, Se = function (t, e) { return t && e }, be = function (t, e) { return t || e }, Re = function (t, e) { return t.concat(e) }, Ee = function (t, e) { return te(e) ? t.concat(e.reduce(Ee, [])) : R(t, e) }, Te = function (t, e) { return ve(t, e) ? t : R(t, e) }, Ce = function (t) { return t.reduce(Re, []) }, Pe = function (t) { return t.reduce(Ee, []) }, ke = E, Oe = E, xe = function (t) { return Object.keys(t).map(function (e) { return [e, t[e]] }) }, Ie = function (t) { return t.catch(function (t) { return 0 }) && t }, je = function (t) { return Ie(ae.$q.reject(t)) }, Ve = function () { function t(t, e) { void 0 === t && (t = []), void 0 === e && (e = null), this._items = t, this._limit = e } return t.prototype.enqueue = function (t) { var e = this._items; return e.push(t), this._limit && e.length > this._limit && e.shift(), t }, t.prototype.dequeue = function () { if (this.size()) return this._items.splice(0, 1)[0] }, t.prototype.clear = function () { var t = this._items; return this._items = [], t }, t.prototype.size = function () { return this._items.length }, t.prototype.remove = function (t) { var e = this._items.indexOf(t); return e > -1 && this._items.splice(e, 1)[0] }, t.prototype.peekTail = function () { return this._items[this._items.length - 1] }, t.prototype.peekHead = function () { if (this.size()) return this._items[0] }, t }(); !function (t) { t[t.SUPERSEDED = 2] = "SUPERSEDED", t[t.ABORTED = 3] = "ABORTED", t[t.INVALID = 4] = "INVALID", t[t.IGNORED = 5] = "IGNORED", t[t.ERROR = 6] = "ERROR" }(t.RejectType || (t.RejectType = {})); var Ae = 0, He = function () { function e(t, e, r) { this.$id = Ae++ , this.type = t, this.message = e, this.detail = r } return e.prototype.toString = function () { var t = function (t) { return t && t.toString !== Object.prototype.toString ? t.toString() : J(t) }(this.detail), e = this; return "Transition Rejection($id: " + e.$id + " type: " + e.type + ", message: " + e.message + ", detail: " + t + ")" }, e.prototype.toPromise = function () { return he(je(this), { _transitionRejection: this }) }, e.isRejectionPromise = function (t) { return t && "function" == typeof t.then && Ft(e)(t._transitionRejection) }, e.superseded = function (r, n) { var i = new e(t.RejectType.SUPERSEDED, "The transition has been superseded by a different transition", r); return n && n.redirected && (i.redirected = !0), i }, e.redirected = function (t) { return e.superseded(t, { redirected: !0 }) }, e.invalid = function (r) { return new e(t.RejectType.INVALID, "This transition is invalid", r) }, e.ignored = function (r) { return new e(t.RejectType.IGNORED, "The transition was ignored", r) }, e.aborted = function (r) { return new e(t.RejectType.ABORTED, "The transition has been aborted", r) }, e.errored = function (r) { return new e(t.RejectType.ERROR, "The transition errored", r) }, e.normalize = function (t) { return Ft(e)(t) ? t : e.errored(t) }, e }(), qe = function (t) { var e = t.viewDecl, r = e.$context.name || "(root)"; return "[View#" + t.$id + " from '" + r + "' state]: target ui-view: '" + e.$uiViewName + "@" + e.$uiViewContextAnchor + "'" }, De = Function.prototype.bind.call(console.log, console), Fe = Kt(console.table) ? console.table.bind(console) : De.bind(console); !function (t) { t[t.RESOLVE = 0] = "RESOLVE", t[t.TRANSITION = 1] = "TRANSITION", t[t.HOOK = 2] = "HOOK", t[t.UIVIEW = 3] = "UIVIEW", t[t.VIEWCONFIG = 4] = "VIEWCONFIG" }(t.Category || (t.Category = {})); var Ne = At("$id"), Ue = At("router.$id"), Le = function (t) { return "Transition #" + Ne(t) + "-" + Ue(t) }, Me = function () { function e() { this._enabled = {}, this.approximateDigests = 0 } return e.prototype._set = function (e, r) { var n = this; r.length || (r = Object.keys(t.Category).map(function (t) { return parseInt(t, 10) }).filter(function (t) { return !isNaN(t) }).map(function (e) { return t.Category[e] })), r.map(V).forEach(function (t) { return n._enabled[t] = e }) }, e.prototype.enable = function () { for (var t = [], e = 0; e < arguments.length; e++)t[e] = arguments[e]; this._set(!0, t) }, e.prototype.disable = function () { for (var t = [], e = 0; e < arguments.length; e++)t[e] = arguments[e]; this._set(!1, t) }, e.prototype.enabled = function (t) { return !!this._enabled[V(t)] }, e.prototype.traceTransitionStart = function (e) { this.enabled(t.Category.TRANSITION) && console.log(Le(e) + ": Started -> " + J(e)) }, e.prototype.traceTransitionIgnored = function (e) { this.enabled(t.Category.TRANSITION) && console.log(Le(e) + ": Ignored <> " + J(e)) }, e.prototype.traceHookInvocation = function (e, r, n) { if (this.enabled(t.Category.HOOK)) { var i = At("traceData.hookType")(n) || "internal", o = At("traceData.context.state.name")(n) || At("traceData.context")(n) || "unknown", a = W(e.registeredHook.callback); console.log(Le(r) + ": Hook -> " + i + " context: " + o + ", " + M(200, a)) } }, e.prototype.traceHookResult = function (e, r, n) { this.enabled(t.Category.HOOK) && console.log(Le(r) + ": <- Hook returned: " + M(200, J(e))) }, e.prototype.traceResolvePath = function (e, r, n) { this.enabled(t.Category.RESOLVE) && console.log(Le(n) + ": Resolving " + e + " (" + r + ")") }, e.prototype.traceResolvableResolved = function (e, r) { this.enabled(t.Category.RESOLVE) && console.log(Le(r) + ": <- Resolved " + e + " to: " + M(200, J(e.data))) }, e.prototype.traceError = function (e, r) { this.enabled(t.Category.TRANSITION) && console.log(Le(r) + ": <- Rejected " + J(r) + ", reason: " + e) }, e.prototype.traceSuccess = function (e, r) { this.enabled(t.Category.TRANSITION) && console.log(Le(r) + ": <- Success " + J(r) + ", final state: " + e.name) }, e.prototype.traceUIViewEvent = function (e, r, n) { void 0 === n && (n = ""), this.enabled(t.Category.UIVIEW) && console.log("ui-view: " + B(30, e) + " " + j(r) + n) }, e.prototype.traceUIViewConfigUpdated = function (e, r) { this.enabled(t.Category.UIVIEW) && this.traceUIViewEvent("Updating", e, " with ViewConfig from context='" + r + "'") }, e.prototype.traceUIViewFill = function (e, r) { this.enabled(t.Category.UIVIEW) && this.traceUIViewEvent("Fill", e, " with: " + M(200, r)) }, e.prototype.traceViewSync = function (e) { if (this.enabled(t.Category.VIEWCONFIG)) { var r = e.map(function (t) { var e = t[0], r = t[1]; return { "ui-view fqn": e.$type + ":" + e.fqn, "state: view name": r && r.viewDecl.$context.name + ": " + r.viewDecl.$name + " (" + r.viewDecl.$type + ")" } }).sort(function (t, e) { return t["ui-view fqn"].localeCompare(e["ui-view fqn"]) }); Fe(r) } }, e.prototype.traceViewServiceEvent = function (e, r) { this.enabled(t.Category.VIEWCONFIG) && console.log("VIEWCONFIG: " + e + " " + qe(r)) }, e.prototype.traceViewServiceUIViewEvent = function (e, r) { this.enabled(t.Category.VIEWCONFIG) && console.log("VIEWCONFIG: " + e + " " + j(r)) }, e }(), Be = new Me; !function (t) { t[t.CREATE = 0] = "CREATE", t[t.BEFORE = 1] = "BEFORE", t[t.RUN = 2] = "RUN", t[t.SUCCESS = 3] = "SUCCESS", t[t.ERROR = 4] = "ERROR" }(t.TransitionHookPhase || (t.TransitionHookPhase = {})), function (t) { t[t.TRANSITION = 0] = "TRANSITION", t[t.STATE = 1] = "STATE" }(t.TransitionHookScope || (t.TransitionHookScope = {})); var Ge = function () { function t(t, e, r, n) { this._stateRegistry = t, this._identifier = e, this._identifier = e, this._params = he({}, r || {}), this._options = he({}, n || {}), this._definition = t.matcher.find(e, this._options.relative) } return t.prototype.name = function () { return this._definition && this._definition.name || this._identifier }, t.prototype.identifier = function () { return this._identifier }, t.prototype.params = function () { return this._params }, t.prototype.$state = function () { return this._definition }, t.prototype.state = function () { return this._definition && this._definition.self }, t.prototype.options = function () { return this._options }, t.prototype.exists = function () { return !(!this._definition || !this._definition.self) }, t.prototype.valid = function () { return !this.error() }, t.prototype.error = function () { var t = this.options().relative; if (!this._definition && t) { var e = t.name ? t.name : t; return "Could not resolve '" + this.name() + "' from state '" + e + "'" } return this._definition ? this._definition.self ? void 0 : "State '" + this.name() + "' has an invalid definition" : "No such state '" + this.name() + "'" }, t.prototype.toString = function () { return "'" + this.name() + "'" + J(this.params()) }, t.prototype.withState = function (e) { return new t(this._stateRegistry, e, this._params, this._options) }, t.prototype.withParams = function (e, r) { void 0 === r && (r = !1); var n = r ? e : he({}, this._params, e); return new t(this._stateRegistry, this._identifier, n, this._options) }, t.prototype.withOptions = function (e, r) { void 0 === r && (r = !1); var n = r ? e : he({}, this._options, e); return new t(this._stateRegistry, this._identifier, this._params, n) }, t.isDef = function (t) { return t && t.state && (Zt(t.state) || Zt(t.state.name)) }, t }(), We = { current: l, transition: null, traceData: {}, bind: null }, ze = function () { function e(e, r, n, i) { var o = this; this.transition = e, this.stateContext = r, this.registeredHook = n, this.options = i, this.isSuperseded = function () { return o.type.hookPhase === t.TransitionHookPhase.RUN && !o.options.transition.isActive() }, this.options = m(i, We), this.type = n.eventType } return e.prototype.logError = function (t) { this.transition.router.stateService.defaultErrorHandler()(t) }, e.prototype.invokeHook = function () { var t = this, e = this.registeredHook; if (!e._deregistered) { var r = this.getNotCurrentRejection(); if (r) return r; var n = this.options; Be.traceHookInvocation(this, this.transition, n); var i = function (r) { return e.eventType.getErrorHandler(t)(r) }, o = function (r) { return e.eventType.getResultHandler(t)(r) }; try { var a = e.callback.call(n.bind, t.transition, t.stateContext); return !this.type.synchronous && ie(a) ? a.catch(function (t) { return He.normalize(t).toPromise() }).then(o, i) : o(a) } catch (t) { return i(He.normalize(t)) } finally { e.invokeLimit && ++e.invokeCount >= e.invokeLimit && e.deregister() } } }, e.prototype.handleHookResult = function (t) { var e = this, r = this.getNotCurrentRejection(); return r || (ie(t) ? t.then(function (t) { return e.handleHookResult(t) }) : (Be.traceHookResult(t, this.transition, this.options), !1 === t ? He.aborted("Hook aborted transition").toPromise() : Ft(Ge)(t) ? He.redirected(t).toPromise() : void 0)) }, e.prototype.getNotCurrentRejection = function () { var t = this.transition.router; return t._disposed ? He.aborted("UIRouter instance #" + t.$id + " has been stopped (disposed)").toPromise() : this.transition._aborted ? He.aborted().toPromise() : this.isSuperseded() ? He.superseded(this.options.current()).toPromise() : void 0 }, e.prototype.toString = function () { var t = this, e = t.options, r = t.registeredHook; return (At("traceData.hookType")(e) || "internal") + " context: " + (At("traceData.context.state.name")(e) || At("traceData.context")(e) || "unknown") + ", " + M(200, z(r.callback)) }, e.chain = function (t, e) { return t.reduce(function (t, e) { return t.then(function () { return e.invokeHook() }) }, e || ae.$q.when()) }, e.invokeHooks = function (t, r) { for (var n = 0; n < t.length; n++) { var i = t[n].invokeHook(); if (ie(i)) { var o = t.slice(n + 1); return e.chain(o, i).then(r) } } return r() }, e.runAllHooks = function (t) { t.forEach(function (t) { return t.invokeHook() }) }, e.HANDLE_RESULT = function (t) { return function (e) { return t.handleHookResult(e) } }, e.LOG_REJECTED_RESULT = function (t) { return function (e) { ie(e) && e.catch(function (e) { return t.logError(He.normalize(e)) }) } }, e.LOG_ERROR = function (t) { return function (e) { return t.logError(e) } }, e.REJECT_ERROR = function (t) { return function (t) { return je(t) } }, e.THROW_ERROR = function (t) { return function (t) { throw t } }, e }(), Je = function () { function e(t, e, r, n, i, o) { void 0 === o && (o = {}), this.tranSvc = t, this.eventType = e, this.callback = r, this.matchCriteria = n, this.removeHookFromRegistry = i, this.invokeCount = 0, this._deregistered = !1, this.priority = o.priority || 0, this.bind = o.bind || null, this.invokeLimit = o.invokeLimit } return e.prototype._matchingNodes = function (t, e) { if (!0 === e) return t; var r = t.filter(function (t) { return A(t.state, e) }); return r.length ? r : null }, e.prototype._getDefaultMatchCriteria = function () { return b(this.tranSvc._pluginapi._getPathTypes(), function () { return !0 }) }, e.prototype._getMatchingNodes = function (e) { var r = this, n = he(this._getDefaultMatchCriteria(), this.matchCriteria); return $e(this.tranSvc._pluginapi._getPathTypes()).reduce(function (i, o) { var a = o.scope === t.TransitionHookScope.STATE, u = e[o.name] || [], s = a ? u : [P(u)]; return i[o.name] = r._matchingNodes(s, n[o.name]), i }, {}) }, e.prototype.matches = function (t) { var e = this._getMatchingNodes(t); return $e(e).every(f) ? e : null }, e.prototype.deregister = function () { this.removeHookFromRegistry(this), this._deregistered = !0 }, e }(), Qe = function () { function e(t) { this.transition = t } return e.prototype.buildHooksForPhase = function (t) { var e = this; return this.transition.router.transitionService._pluginapi._getEvents(t).map(function (t) { return e.buildHooks(t) }).reduce(Re, []).filter(f) }, e.prototype.buildHooks = function (e) { var r = this.transition, n = r.treeChanges(), i = this.getMatchingHooks(e, n); if (!i) return []; var o = { transition: r, current: r.options().current }; return i.map(function (i) { return i.matches(n)[e.criteriaMatchPath.name].map(function (n) { var a = he({ bind: i.bind, traceData: { hookType: e.name, context: n } }, o), u = e.criteriaMatchPath.scope === t.TransitionHookScope.STATE ? n.state.self : null, s = new ze(r, u, i, a); return { hook: i, node: n, transitionHook: s } }) }).reduce(Re, []).sort(q(e.reverseSort)).map(function (t) { return t.transitionHook }) }, e.prototype.getMatchingHooks = function (e, r) { var n = e.hookPhase === t.TransitionHookPhase.CREATE, i = this.transition.router.transitionService; return (n ? [i] : [this.transition, i]).map(function (t) { return t.getHooks(e.name) }).filter(ke(te, "broken event named: " + e.name)).reduce(Re, []).filter(function (t) { return t.matches(r) }) }, e }(), Ke = function () { function t(t) { this.pattern = /.*/, this.inherit = !0, he(this, t) } return t.prototype.is = function (t, e) { return !0 }, t.prototype.encode = function (t, e) { return t }, t.prototype.decode = function (t, e) { return t }, t.prototype.equals = function (t, e) { return t == e }, t.prototype.$subPattern = function () { var t = this.pattern.toString(); return t.substr(1, t.length - 2) }, t.prototype.toString = function () { return "{ParamType:" + this.name + "}" }, t.prototype.$normalize = function (t) { return this.is(t) ? t : this.decode(t) }, t.prototype.$asArray = function (t, e) { if (!t) return this; if ("auto" === t && !e) throw new Error("'auto' array mode is for query parameters only"); return new D(this, t) }, t }(), Ye = Object.prototype.hasOwnProperty, Ze = function (t) { return 0 === ["value", "type", "squash", "array", "dynamic"].filter(Ye.bind(t || {})).length }; !function (t) { t[t.PATH = 0] = "PATH", t[t.SEARCH = 1] = "SEARCH", t[t.CONFIG = 2] = "CONFIG" }(t.DefType || (t.DefType = {})); var Xe = function () { function e(e, r, n, i, o) { r = N(n = F(n), r, i, e, o.paramTypes); var a = function () { var r = { array: i === t.DefType.SEARCH && "auto" }, o = e.match(/\[\]$/) ? { array: !0 } : {}; return he(r, o, n).array }(); r = a ? r.$asArray(a, i === t.DefType.SEARCH) : r; var u = void 0 !== n.value || i === t.DefType.SEARCH, s = zt(n.dynamic) ? !!n.dynamic : !!r.dynamic, c = zt(n.raw) ? !!n.raw : !!r.raw, f = U(n, u, o.defaultSquashPolicy()), l = L(n, a, u, f), h = zt(n.inherit) ? !!n.inherit : !!r.inherit; he(this, { id: e, type: r, location: i, isOptional: u, dynamic: s, raw: c, squash: f, replace: l, inherit: h, array: a, config: n }) } return e.prototype.isDefaultValue = function (t) { return this.isOptional && this.type.equals(this.value(), t) }, e.prototype.value = function (t) { var e = this; return t = function (t) { for (var r = 0, n = e.replace; r < n.length; r++) { var i = n[r]; if (i.from === t) return i.to } return t }(t), Wt(t) ? function () { if (e._defaultValueCache) return e._defaultValueCache.defaultValue; if (!ae.$injector) throw new Error("Injectable functions cannot be called at configuration time"); var t = ae.$injector.invoke(e.config.$$fn); if (null !== t && void 0 !== t && !e.type.is(t)) throw new Error("Default value (" + t + ") for parameter '" + e.id + "' is not an instance of ParamType (" + e.type.name + ")"); return e.config.$$fn.__cacheable && (e._defaultValueCache = { defaultValue: t }), t }() : this.type.$normalize(t) }, e.prototype.isSearch = function () { return this.location === t.DefType.SEARCH }, e.prototype.validates = function (t) { if ((Wt(t) || null === t) && this.isOptional) return !0; var e = this.type.$normalize(t); if (!this.type.is(e)) return !1; var r = this.type.encode(e); return !(Zt(r) && !this.type.pattern.exec(r)) }, e.prototype.toString = function () { return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}" }, e.values = function (t, e) { void 0 === e && (e = {}); for (var r = {}, n = 0, i = t; n < i.length; n++) { var o = i[n]; r[o.id] = o.value(e[o.id]) } return r }, e.changed = function (t, e, r) { return void 0 === e && (e = {}), void 0 === r && (r = {}), t.filter(function (t) { return !t.type.equals(e[t.id], r[t.id]) }) }, e.equals = function (t, r, n) { return void 0 === r && (r = {}), void 0 === n && (n = {}), 0 === e.changed(t, r, n).length }, e.validates = function (t, e) { return void 0 === e && (e = {}), t.map(function (t) { return t.validates(e[t.id]) }).reduce(Se, !0) }, e }(), tr = function () { function t(e) { if (e instanceof t) { var r = e; this.state = r.state, this.paramSchema = r.paramSchema.slice(), this.paramValues = he({}, r.paramValues), this.resolvables = r.resolvables.slice(), this.views = r.views && r.views.slice() } else { var n = e; this.state = n, this.paramSchema = n.parameters({ inherit: !1 }), this.paramValues = {}, this.resolvables = n.resolvables.map(function (t) { return t.clone() }) } } return t.prototype.applyRawParams = function (t) { var e = function (e) { return [e.id, e.value(t[e.id])] }; return this.paramValues = this.paramSchema.reduce(function (t, r) { return C(t, e(r)) }, {}), this }, t.prototype.parameter = function (t) { return S(this.paramSchema, Vt("id", t)) }, t.prototype.equals = function (t, e) { var r = this.diff(t, e); return r && 0 === r.length }, t.prototype.diff = function (t, e) { if (this.state !== t.state) return !1; var r = e ? e(this) : this.paramSchema; return Xe.changed(r, this.paramValues, t.paramValues) }, t.clone = function (e) { return new t(e) }, t }(), er = function () { function t() { } return t.makeTargetState = function (t, e) { var r = P(e).state; return new Ge(t, r, e.map(jt("paramValues")).reduce(_e, {}), {}) }, t.buildPath = function (t) { var e = t.params(); return t.$state().path.map(function (t) { return new tr(t).applyRawParams(e) }) }, t.buildToPath = function (e, r) { var n = t.buildPath(r); return r.options().inherit ? t.inheritParams(e, n, Object.keys(r.params())) : n }, t.applyViewConfigs = function (e, r, n) { r.filter(function (t) { return ve(n, t.state) }).forEach(function (n) { var i = $e(n.state.views || {}), o = t.subPath(r, function (t) { return t === n }), a = i.map(function (t) { return e.createViewConfig(o, t) }); n.views = a.reduce(Re, []) }) }, t.inheritParams = function (t, e, r) { function n(t, e) { var r = S(t, Vt("state", e)); return he({}, r && r.paramValues) } void 0 === r && (r = []); var i = t.map(function (t) { return t.paramSchema }).reduce(Re, []).filter(function (t) { return !t.inherit }).map(jt("id")); return e.map(function (e) { var o = he({}, e && e.paramValues), a = g(o, r); o = _(o, r); var u = _(n(t, e.state) || {}, i), s = he(o, u, a); return new tr(e.state).applyRawParams(s) }) }, t.treeChanges = function (e, r, n) { for (var i = 0, o = Math.min(e.length, r.length); i < o && e[i].state !== n && function (e, r) { return e.equals(r, t.nonDynamicParams) }(e[i], r[i]);)i++; var a, u, s, c, f; u = (a = e).slice(0, i), s = a.slice(i); var l = u.map(function (t, e) { var n = tr.clone(t); return n.paramValues = r[e].paramValues, n }); return c = r.slice(i), f = l.concat(c), { from: a, to: f, retained: u, exiting: s, entering: c } }, t.matching = function (t, e, r) { var n = !1; return T(t, e).reduce(function (t, e) { var i = e[0], o = e[1]; return (n = n || !i.equals(o, r)) ? t : t.concat(i) }, []) }, t.equals = function (e, r, n) { return e.length === r.length && t.matching(e, r, n).length === e.length }, t.subPath = function (t, e) { var r = S(t, e), n = t.indexOf(r); return -1 === n ? void 0 : t.slice(0, n + 1) }, t.nonDynamicParams = function (t) { return t.state.parameters({ inherit: !1 }).filter(function (t) { return !t.dynamic }) }, t.paramValues = function (t) { return t.reduce(function (t, e) { return he(t, e.paramValues) }, {}) }, t }(), rr = { when: "LAZY", async: "WAIT" }, nr = function () { function t(e, r, n, i, o) { if (this.resolved = !1, this.promise = void 0, e instanceof t) he(this, e); else if (Kt(r)) { if (Qt(e)) throw new Error("new Resolvable(): token argument is required"); if (!Kt(r)) throw new Error("new Resolvable(): resolveFn argument must be a function"); this.token = e, this.policy = i, this.resolveFn = r, this.deps = n || [], this.data = o, this.resolved = void 0 !== o, this.promise = this.resolved ? ae.$q.when(this.data) : void 0 } else if (Xt(e) && e.token && Kt(e.resolveFn)) { var a = e; return new t(a.token, a.resolveFn, a.deps, a.policy, a.data) } } return t.prototype.getPolicy = function (t) { var e = this.policy || {}, r = t && t.resolvePolicy || {}; return { when: e.when || r.when || rr.when, async: e.async || r.async || rr.async } }, t.prototype.resolve = function (t, e) { var r = this, n = ae.$q, i = t.findNode(this), o = i && i.state, a = "RXWAIT" === this.getPolicy(o).async ? function (t) { var e = t.cache(1); return e.take(1).toPromise().then(function () { return e }) } : f; return this.promise = n.when().then(function () { return n.all(t.getDependencies(r).map(function (r) { return r.get(t, e) })) }).then(function (t) { return r.resolveFn.apply(null, t) }).then(a).then(function (t) { return r.data = t, r.resolved = !0, Be.traceResolvableResolved(r, e), r.data }) }, t.prototype.get = function (t, e) { return this.promise || this.resolve(t, e) }, t.prototype.toString = function () { return "Resolvable(token: " + J(this.token) + ", requires: [" + this.deps.map(J) + "])" }, t.prototype.clone = function () { return new t(this) }, t.fromData = function (e, r) { return new t(e, function () { return r }, null, null, r) }, t }(), ir = { when: { LAZY: "LAZY", EAGER: "EAGER" }, async: { WAIT: "WAIT", NOWAIT: "NOWAIT", RXWAIT: "RXWAIT" } }, or = ir.when, ar = [or.EAGER, or.LAZY], ur = [or.EAGER], sr = "Native Injector", cr = function () { function t(t) { this._path = t } return t.prototype.getTokens = function () { return this._path.reduce(function (t, e) { return t.concat(e.resolvables.map(function (t) { return t.token })) }, []).reduce(Te, []) }, t.prototype.getResolvable = function (t) { return P(this._path.map(function (t) { return t.resolvables }).reduce(Re, []).filter(function (e) { return e.token === t })) }, t.prototype.getPolicy = function (t) { var e = this.findNode(t); return t.getPolicy(e.state) }, t.prototype.subContext = function (e) { return new t(er.subPath(this._path, function (t) { return t.state === e })) }, t.prototype.addResolvables = function (t, e) { var r = S(this._path, Vt("state", e)), n = t.map(function (t) { return t.token }); r.resolvables = r.resolvables.filter(function (t) { return -1 === n.indexOf(t.token) }).concat(t) }, t.prototype.resolvePath = function (t, e) { var r = this; void 0 === t && (t = "LAZY"); var n = (ve(ar, t) ? t : "LAZY") === ir.when.EAGER ? ur : ar; Be.traceResolvePath(this._path, t, e); var i = function (t, e) { return function (n) { return ve(t, r.getPolicy(n)[e]) } }, o = this._path.reduce(function (t, o) { var a = o.resolvables.filter(i(n, "when")), u = a.filter(i(["NOWAIT"], "async")), s = a.filter(Ht(i(["NOWAIT"], "async"))), c = r.subContext(o.state), f = function (t) { return t.get(c, e).then(function (e) { return { token: t.token, value: e } }) }; return u.forEach(f), t.concat(s.map(f)) }, []); return ae.$q.all(o) }, t.prototype.injector = function () { return this._injector || (this._injector = new fr(this)) }, t.prototype.findNode = function (t) { return S(this._path, function (e) { return ve(e.resolvables, t) }) }, t.prototype.getDependencies = function (t) { var e = this, r = this.findNode(t), n = (er.subPath(this._path, function (t) { return t === r }) || this._path).reduce(function (t, e) { return t.concat(e.resolvables) }, []).filter(function (e) { return e !== t }); return t.deps.map(function (t) { var r = n.filter(function (e) { return e.token === t }); if (r.length) return P(r); var i = e.injector().getNative(t); if (Wt(i)) throw new Error("Could not find Dependency Injection token: " + J(t)); return new nr(t, function () { return i }, [], i) }) }, t }(), fr = function () { function t(t) { this.context = t, this.native = this.get(sr) || ae.$injector } return t.prototype.get = function (t) { var e = this.context.getResolvable(t); if (e) { if ("NOWAIT" === this.context.getPolicy(e).async) return e.get(this.context); if (!e.resolved) throw new Error("Resolvable async .get() not complete:" + J(e.token)); return e.data } return this.getNative(t) }, t.prototype.getAsync = function (t) { var e = this.context.getResolvable(t); return e ? e.get(this.context) : ae.$q.when(this.native.get(t)) }, t.prototype.getNative = function (t) { return this.native && this.native.get(t) }, t }(), lr = jt("self"), hr = function () { function e(e, r, n) { var i = this; if (this._deferred = ae.$q.defer(), this.promise = this._deferred.promise, this._registeredHooks = {}, this._hookBuilder = new Qe(this), this.isActive = function () { return i.router.globals.transition === i }, this.router = n, this._targetState = r, !r.valid()) throw new Error(r.error()); this._options = he({ current: Ut(this) }, r.options()), this.$id = n.transitionService._transitionCount++; var o = er.buildToPath(e, r); this._treeChanges = er.treeChanges(e, o, this._options.reloadState), this.createTransitionHookRegFns(); var a = this._hookBuilder.buildHooksForPhase(t.TransitionHookPhase.CREATE); ze.invokeHooks(a, function () { return null }), this.applyViewConfigs(n) } return e.prototype.onBefore = function (t, e, r) { }, e.prototype.onStart = function (t, e, r) { }, e.prototype.onExit = function (t, e, r) { }, e.prototype.onRetain = function (t, e, r) { }, e.prototype.onEnter = function (t, e, r) { }, e.prototype.onFinish = function (t, e, r) { }, e.prototype.onSuccess = function (t, e, r) { }, e.prototype.onError = function (t, e, r) { }, e.prototype.createTransitionHookRegFns = function () { var e = this; this.router.transitionService._pluginapi._getEvents().filter(function (e) { return e.hookPhase !== t.TransitionHookPhase.CREATE }).forEach(function (t) { return H(e, e.router.transitionService, t) }) }, e.prototype.getHooks = function (t) { return this._registeredHooks[t] }, e.prototype.applyViewConfigs = function (t) { var e = this._treeChanges.entering.map(function (t) { return t.state }); er.applyViewConfigs(t.transitionService.$view, this._treeChanges.to, e) }, e.prototype.$from = function () { return P(this._treeChanges.from).state }, e.prototype.$to = function () { return P(this._treeChanges.to).state }, e.prototype.from = function () { return this.$from().self }, e.prototype.to = function () { return this.$to().self }, e.prototype.targetState = function () { return this._targetState }, e.prototype.is = function (t) { return t instanceof e ? this.is({ to: t.$to().name, from: t.$from().name }) : !(t.to && !A(this.$to(), t.to) || t.from && !A(this.$from(), t.from)) }, e.prototype.params = function (t) { return void 0 === t && (t = "to"), Object.freeze(this._treeChanges[t].map(jt("paramValues")).reduce(_e, {})) }, e.prototype.injector = function (t, e) { void 0 === e && (e = "to"); var r = this._treeChanges[e]; return t && (r = er.subPath(r, function (e) { return e.state === t || e.state.name === t })), new cr(r).injector() }, e.prototype.getResolveTokens = function (t) { return void 0 === t && (t = "to"), new cr(this._treeChanges[t]).getTokens() }, e.prototype.addResolvable = function (t, e) { void 0 === e && (e = ""), t = Ft(nr)(t) ? t : new nr(t); var r = "string" == typeof e ? e : e.name, n = this._treeChanges.to, i = S(n, function (t) { return t.state.name === r }); new cr(n).addResolvables([t], i.state) }, e.prototype.redirectedFrom = function () { return this._options.redirectedFrom || null }, e.prototype.originalTransition = function () { var t = this.redirectedFrom(); return t && t.originalTransition() || this }, e.prototype.options = function () { return this._options }, e.prototype.entering = function () { return b(this._treeChanges.entering, jt("state")).map(lr) }, e.prototype.exiting = function () { return b(this._treeChanges.exiting, jt("state")).map(lr).reverse() }, e.prototype.retained = function () { return b(this._treeChanges.retained, jt("state")).map(lr) }, e.prototype.views = function (t, e) { void 0 === t && (t = "entering"); var r = this._treeChanges[t]; return (r = e ? r.filter(Vt("state", e)) : r).map(jt("views")).filter(f).reduce(Re, []) }, e.prototype.treeChanges = function (t) { return t ? this._treeChanges[t] : this._treeChanges }, e.prototype.redirect = function (t) { for (var e = 1, r = this; null != (r = r.redirectedFrom());)if (++e > 20) throw new Error("Too many consecutive Transition redirects (20+)"); var n = { redirectedFrom: this, source: "redirect" }; "url" === this.options().source && !1 !== t.options().location && (n.location = "replace"); var i = he({}, this.options(), t.options(), n); t = t.withOptions(i, !0); var o = this.router.transitionService.create(this._treeChanges.from, t), a = this._treeChanges.entering, u = o._treeChanges.entering; return er.matching(u, a, er.nonDynamicParams).filter(Ht(function (t) { return function (e) { return t && e.state.includes[t.name] } }(t.options().reloadState))).forEach(function (t, e) { t.resolvables = a[e].resolvables }), o }, e.prototype._changedParams = function () { var t = this._treeChanges; if (!(this._options.reload || t.exiting.length || t.entering.length || t.to.length !== t.from.length || T(t.to, t.from).map(function (t) { return t[0].state !== t[1].state }).reduce(be, !1))) { var e = t.to.map(function (t) { return t.paramSchema }), r = [t.to, t.from].map(function (t) { return t.map(function (t) { return t.paramValues }) }); return T(e, r[0], r[1]).map(function (t) { var e = t[0], r = t[1], n = t[2]; return Xe.changed(e, r, n) }).reduce(Re, []) } }, e.prototype.dynamic = function () { var t = this._changedParams(); return !!t && t.map(function (t) { return t.dynamic }).reduce(be, !1) }, e.prototype.ignored = function () { return !!this._ignoredReason() }, e.prototype._ignoredReason = function () { var t = this.router.globals.transition, e = this._options.reloadState, r = function (t, r) { if (t.length !== r.length) return !1; var n = er.matching(t, r); return t.length === n.filter(function (t) { return !e || !t.state.includes[e.name] }).length }, n = this.treeChanges(), i = t && t.treeChanges(); return i && r(i.to, n.to) && r(i.exiting, n.exiting) ? "SameAsPending" : 0 === n.exiting.length && 0 === n.entering.length && r(n.from, n.to) ? "SameAsCurrent" : void 0 }, e.prototype.run = function () { var e = this, r = ze.runAllHooks, n = function (t) { return e._hookBuilder.buildHooksForPhase(t) }, i = n(t.TransitionHookPhase.BEFORE); return ze.invokeHooks(i, function () { var t = e.router.globals; return t.lastStartedTransitionId = e.$id, t.transition = e, t.transitionHistory.enqueue(e), Be.traceTransitionStart(e), ae.$q.when(void 0) }).then(function () { var e = n(t.TransitionHookPhase.RUN); return ze.invokeHooks(e, function () { return ae.$q.when(void 0) }) }).then(function () { Be.traceSuccess(e.$to(), e), e.success = !0, e._deferred.resolve(e.to()), r(n(t.TransitionHookPhase.SUCCESS)) }, function (i) { Be.traceError(i, e), e.success = !1, e._deferred.reject(i), e._error = i, r(n(t.TransitionHookPhase.ERROR)) }), this.promise }, e.prototype.valid = function () { return !this.error() || void 0 !== this.success }, e.prototype.abort = function () { Wt(this.success) && (this._aborted = !0) }, e.prototype.error = function () { var t = this.$to(); if (t.self.abstract) return "Cannot transition to abstract state '" + t.name + "'"; var e = t.parameters(), r = this.params(), n = e.filter(function (t) { return !t.validates(r[t.id]) }); return n.length ? "Param values not valid for state '" + t.name + "'. Invalid params: [ " + n.map(function (t) { return t.id }).join(", ") + " ]" : !1 === this.success ? this._error : void 0 }, e.prototype.toString = function () { var t = this.from(), e = this.to(), r = function (t) { return null !== t["#"] && void 0 !== t["#"] ? t : _(t, ["#"]) }; return "Transition#" + this.$id + "( '" + (Xt(t) ? t.name : t) + "'" + J(r(this._treeChanges.from.map(jt("paramValues")).reduce(_e, {}))) + " -> " + (this.valid() ? "" : "(X) ") + "'" + (Xt(e) ? e.name : e) + "'" + J(r(this.params())) + " )" }, e.diToken = e, e }(), pr = null, dr = function (t) { var e = He.isRejectionPromise; return (pr = pr || s([[Ht(zt), Ut("undefined")], [Jt, Ut("null")], [ie, Ut("[Promise]")], [e, function (t) { return t._transitionRejection.toString() }], [Ft(He), u("toString")], [Ft(hr), u("toString")], [Ft(nr), u("toString")], [c, W], [Ut(!0), f]]))(t) }, vr = function (t) { return function (e) { if (!e) return ["", ""]; var r = e.indexOf(t); return -1 === r ? [e, ""] : [e.substr(0, r), e.substr(r + 1)] } }, mr = new RegExp("^(?:[a-z]+:)?//[^/]+/"), yr = function (t) { return t.replace(/\/[^/]*$/, "") }, gr = vr("#"), _r = vr("?"), wr = vr("="), $r = function (t) { return t ? t.replace(/^#/, "") : "" }, Sr = function () { function t() { this.enqueue = !0, this.typeQueue = [], this.defaultTypes = g(t.prototype, ["hash", "string", "query", "path", "int", "bool", "date", "json", "any"]); this.types = de(b(this.defaultTypes, function (t, e) { return new Ke(he({ name: e }, t)) }), {}) } return t.prototype.dispose = function () { this.types = {} }, t.prototype.type = function (t, e, r) { if (!zt(e)) return this.types[t]; if (this.types.hasOwnProperty(t)) throw new Error("A type named '" + t + "' has already been defined."); return this.types[t] = new Ke(he({ name: t }, e)), r && (this.typeQueue.push({ name: t, def: r }), this.enqueue || this._flushTypeQueue()), this }, t.prototype._flushTypeQueue = function () { for (; this.typeQueue.length;) { var t = this.typeQueue.shift(); if (t.pattern) throw new Error("You cannot override a type's .pattern at runtime."); he(this.types[t.name], ae.$injector.invoke(t.def)) } }, t }(); !function () { var t = function (t) { var e = function (t) { return null != t ? t.toString() : t }, r = { encode: e, decode: e, is: Ft(String), pattern: /.*/, equals: function (t, e) { return t == e } }; return he({}, r, t) }; he(Sr.prototype, { string: t({}), path: t({ pattern: /[^/]*/ }), query: t({}), hash: t({ inherit: !1 }), int: t({ decode: function (t) { return parseInt(t, 10) }, is: function (t) { return !Qt(t) && this.decode(t.toString()) === t }, pattern: /-?\d+/ }), bool: t({ encode: function (t) { return t && 1 || 0 }, decode: function (t) { return 0 !== parseInt(t, 10) }, is: Ft(Boolean), pattern: /0|1/ }), date: t({ encode: function (t) { return this.is(t) ? [t.getFullYear(), ("0" + (t.getMonth() + 1)).slice(-2), ("0" + t.getDate()).slice(-2)].join("-") : void 0 }, decode: function (t) { if (this.is(t)) return t; var e = this.capture.exec(t); return e ? new Date(e[1], e[2] - 1, e[3]) : void 0 }, is: function (t) { return t instanceof Date && !isNaN(t.valueOf()) }, equals: function (t, e) { return ["getFullYear", "getMonth", "getDate"].reduce(function (r, n) { return r && t[n]() === e[n]() }, !0) }, pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/ }), json: t({ encode: fe, decode: ce, is: Ft(Object), equals: pe, pattern: /[^/]*/ }), any: t({ encode: f, decode: f, is: function () { return !0 }, equals: pe }) }) }(); var br, Rr = function () { function t(t) { void 0 === t && (t = {}), he(this, t) } return t.prototype.$inherit = function (t, e, r) { var n, i = y(e, r), o = {}, a = []; for (var u in i) if (i[u] && i[u].params && (n = Object.keys(i[u].params)).length) for (var s in n) a.indexOf(n[s]) >= 0 || (a.push(n[s]), o[n[s]] = this[n[s]]); return he({}, o, t) }, t }(), Er = function (t) { if (!Zt(t)) return !1; var e = "^" === t.charAt(0); return { val: e ? t.substring(1) : t, root: e } }, Tr = function (t, e) { return function (r) { var n = r; n && n.url && n.name && n.name.match(/\.\*\*$/) && (n.url += "{remainder:any}"); var i = Er(n.url), o = r.parent, a = i ? t.compile(i.val, { params: r.params || {}, paramMap: function (t, e) { return !1 === n.reloadOnSearch && e && (t = he(t || {}, { dynamic: !0 })), t } }) : n.url; if (!a) return null; if (!t.isMatcher(a)) throw new Error("Invalid url '" + a + "' in state '" + r + "'"); return i && i.root ? a : (o && o.navigable || e()).url.append(a) } }, Cr = function (t) { return function (e) { return !t(e) && e.url ? e : e.parent ? e.parent.navigable : null } }, Pr = function (t) { return function (e) { var r = e.url && e.url.parameters({ inherit: !1 }) || [], n = $e(we(_(e.params || {}, r.map(jt("id"))), function (e, r) { return t.fromConfig(r, null, e) })); return r.concat(n).map(function (t) { return [t.id, t] }).reduce(C, {}) } }, kr = function () { function t(t, e) { this.matcher = t; var r = this, n = function () { return t.find("") }, i = function (t) { return "" === t.name }; this.builders = { name: [Y], self: [Z], parent: [function (e) { return i(e) ? null : t.find(r.parentName(e)) || n() }], data: [X], url: [Tr(e, n)], navigable: [Cr(i)], params: [Pr(e.paramFactory)], views: [], path: [tt], includes: [et], resolvables: [rt] } } return t.prototype.builder = function (t, e) { var r = this.builders, n = r[t] || []; return Zt(t) && !zt(e) ? n.length > 1 ? n : n[0] : Zt(t) && Kt(e) ? (r[t] = n, r[t].push(e), function () { return r[t].splice(r[t].indexOf(e, 1)) && null }) : void 0 }, t.prototype.build = function (t) { var e = this, r = e.matcher, n = e.builders, i = this.parentName(t); if (i && !r.find(i, void 0, !1)) return null; for (var o in n) if (n.hasOwnProperty(o)) { var a = n[o].reduce(function (t, e) { return function (r) { return e(r, t) } }, l); t[o] = a(t) } return t }, t.prototype.parentName = function (t) { var e = t.name || "", r = e.split("."); if ("**" === r.pop() && r.pop(), r.length) { if (t.parent) throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + e + ")"); return r.join(".") } return t.parent ? Zt(t.parent) ? t.parent : t.parent.name : "" }, t.prototype.name = function (t) { var e = t.name; if (-1 !== e.indexOf(".") || !t.parent) return e; var r = Zt(t.parent) ? t.parent : t.parent.name; return r ? r + "." + e : e }, t }(), Or = function () { function t(t) { this._states = t } return t.prototype.isRelative = function (t) { return 0 === (t = t || "").indexOf(".") || 0 === t.indexOf("^") }, t.prototype.find = function (t, e, r) { if (void 0 === r && (r = !0), t || "" === t) { var n = Zt(t), i = n ? t : t.name; this.isRelative(i) && (i = this.resolvePath(i, e)); var o = this._states[i]; if (o && (n || !(n || o !== t && o.self !== t))) return o; if (n && r) { var a = $e(this._states).filter(function (t) { return t.__stateObjectCache.nameGlob && t.__stateObjectCache.nameGlob.matches(i) }); return a.length > 1 && console.log("stateMatcher.find: Found multiple matches for " + i + " using glob: ", a.map(function (t) { return t.name })), a[0] } } }, t.prototype.resolvePath = function (t, e) { if (!e) throw new Error("No reference point given for path '" + t + "'"); for (var r = this.find(e), n = t.split("."), i = 0, o = n.length, a = r; i < o; i++)if ("" !== n[i] || 0 !== i) { if ("^" !== n[i]) break; if (!a.parent) throw new Error("Path '" + t + "' not valid for state '" + r.name + "'"); a = a.parent } else a = r; var u = n.slice(i).join("."); return a.name + (a.name && u ? "." : "") + u }, t }(), xr = function () { function t(t, e, r, n, i) { this.$registry = t, this.$urlRouter = e, this.states = r, this.builder = n, this.listeners = i, this.queue = [], this.matcher = t.matcher } return t.prototype.dispose = function () { this.queue = [] }, t.prototype.register = function (t) { var e = this.queue, r = Mt.create(t), n = r.name; if (!Zt(n)) throw new Error("State must have a valid name"); if (this.states.hasOwnProperty(n) || ve(e.map(jt("name")), n)) throw new Error("State '" + n + "' is already defined"); return e.push(r), this.flush(), r }, t.prototype.flush = function () { for (var t = this, e = this, r = e.queue, n = e.states, i = e.builder, o = [], a = [], u = {}, s = function (e) { return t.states.hasOwnProperty(e) && t.states[e] }; r.length > 0;) { var c = r.shift(), f = c.name, l = i.build(c), h = a.indexOf(c); if (l) { var p = s(f); if (p && p.name === f) throw new Error("State '" + f + "' is already defined"); var d = s(f + ".**"); d && this.$registry.deregister(d), n[f] = c, this.attachRoute(c), h >= 0 && a.splice(h, 1), o.push(c) } else { var v = u[f]; if (u[f] = r.length, h >= 0 && v === r.length) return r.push(c), n; h < 0 && a.push(c), r.push(c) } } return o.length && this.listeners.forEach(function (t) { return t("registered", o.map(function (t) { return t.self })) }), n }, t.prototype.attachRoute = function (t) { !t.abstract && t.url && this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(t)) }, t }(), Ir = function () { function t(t) { this._router = t, this.states = {}, this.listeners = [], this.matcher = new Or(this.states), this.builder = new kr(this.matcher, t.urlMatcherFactory), this.stateQueue = new xr(this, t.urlRouter, this.states, this.builder, this.listeners), this._registerRoot() } return t.prototype._registerRoot = function () { var t = { name: "", url: "^", views: null, params: { "#": { value: null, type: "hash", dynamic: !0 } }, abstract: !0 }; (this._root = this.stateQueue.register(t)).navigable = null }, t.prototype.dispose = function () { var t = this; this.stateQueue.dispose(), this.listeners = [], this.get().forEach(function (e) { return t.get(e) && t.deregister(e) }) }, t.prototype.onStatesChanged = function (t) { return this.listeners.push(t), function () { me(this.listeners)(t) }.bind(this) }, t.prototype.root = function () { return this._root }, t.prototype.register = function (t) { return this.stateQueue.register(t) }, t.prototype._deregisterTree = function (t) { var e = this, r = this.get().map(function (t) { return t.$$state() }), n = function (t) { var e = r.filter(function (e) { return -1 !== t.indexOf(e.parent) }); return 0 === e.length ? e : e.concat(n(e)) }, i = n([t]), o = [t].concat(i).reverse(); return o.forEach(function (t) { var r = e._router.urlRouter; r.rules().filter(Vt("state", t)).forEach(r.removeRule.bind(r)), delete e.states[t.name] }), o }, t.prototype.deregister = function (t) { var e = this.get(t); if (!e) throw new Error("Can't deregister state; not found: " + t); var r = this._deregisterTree(e.$$state()); return this.listeners.forEach(function (t) { return t("deregistered", r.map(function (t) { return t.self })) }), r }, t.prototype.get = function (t, e) { var r = this; if (0 === arguments.length) return Object.keys(this.states).map(function (t) { return r.states[t].self }); var n = this.matcher.find(t, e); return n && n.self || null }, t.prototype.decorator = function (t, e) { return this.builder.builder(t, e) }, t }(), jr = function (t, e, r) { return t[e] = t[e] || r() }, Vr = Q("/"), Ar = function () { function e(t, r, n, i) { var o = this; this.config = i, this._cache = { path: [this] }, this._children = [], this._params = [], this._segments = [], this._compiled = [], this.pattern = t, this.config = m(this.config, { params: {}, strict: !0, caseInsensitive: !1, paramMap: f }); for (var a, u, s, c = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, l = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, h = 0, p = [], d = function (r) { if (!e.nameValidator.test(r)) throw new Error("Invalid parameter name '" + r + "' in pattern '" + t + "'"); if (S(o._params, Vt("id", r))) throw new Error("Duplicate parameter name '" + r + "' in pattern '" + t + "'") }, v = function (e, n) { var i = e[2] || e[3], a = n ? e[4] : e[4] || ("*" === e[1] ? "[\\s\\S]*" : null); return { id: i, regexp: a, cfg: o.config.params[i], segment: t.substring(h, e.index), type: a ? r.type(a) || function (t) { return de(r.type(n ? "query" : "path"), { pattern: new RegExp(t, o.config.caseInsensitive ? "i" : void 0) }) }(a) : null } }; (a = c.exec(t)) && !((u = v(a, !1)).segment.indexOf("?") >= 0);)d(u.id), this._params.push(n.fromPath(u.id, u.type, this.config.paramMap(u.cfg, !1))), this._segments.push(u.segment), p.push([u.segment, P(this._params)]), h = c.lastIndex; var y = (s = t.substring(h)).indexOf("?"); if (y >= 0) { var g = s.substring(y); if (s = s.substring(0, y), g.length > 0) for (h = 0; a = l.exec(g);)d((u = v(a, !0)).id), this._params.push(n.fromSearch(u.id, u.type, this.config.paramMap(u.cfg, !0))), h = c.lastIndex } this._segments.push(s), this._compiled = p.map(function (t) { return nt.apply(null, t) }).concat(nt(s)) } return e.prototype.append = function (t) { return this._children.push(t), t._cache = { path: this._cache.path.concat(t), parent: this, pattern: null }, t }, e.prototype.isRoot = function () { return this._cache.path[0] === this }, e.prototype.toString = function () { return this.pattern }, e.prototype.exec = function (t, e, r, n) { var i = this; void 0 === e && (e = {}), void 0 === n && (n = {}); var o = jr(this._cache, "pattern", function () { return new RegExp(["^", Ce(i._cache.path.map(jt("_compiled"))).join(""), !1 === i.config.strict ? "/?" : "", "$"].join(""), i.config.caseInsensitive ? "i" : void 0) }).exec(t); if (!o) return null; var a = this.parameters(), u = a.filter(function (t) { return !t.isSearch() }), s = a.filter(function (t) { return t.isSearch() }), c = this._cache.path.map(function (t) { return t._segments.length - 1 }).reduce(function (t, e) { return t + e }), f = {}; if (c !== o.length - 1) throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); for (var l = 0; l < c; l++) { for (var h = u[l], p = o[l + 1], d = 0; d < h.replace.length; d++)h.replace[d].from === p && (p = h.replace[d].to); p && !0 === h.array && (p = function (t) { var e = function (t) { return t.split("").reverse().join("") }; return b(b(e(t).split(/-(?!\\)/), e), function (t) { return t.replace(/\\-/g, "-") }).reverse() }(p)), zt(p) && (p = h.type.decode(p)), f[h.id] = h.value(p) } return s.forEach(function (t) { for (var r = e[t.id], n = 0; n < t.replace.length; n++)t.replace[n].from === r && (r = t.replace[n].to); zt(r) && (r = t.type.decode(r)), f[t.id] = t.value(r) }), r && (f["#"] = r), f }, e.prototype.parameters = function (t) { return void 0 === t && (t = {}), !1 === t.inherit ? this._params : Ce(this._cache.path.map(function (t) { return t._params })) }, e.prototype.parameter = function (t, e) { var r = this; void 0 === e && (e = {}); var n = this._cache.parent; return function () { for (var e = 0, n = r._params; e < n.length; e++) { var i = n[e]; if (i.id === t) return i } }() || !1 !== e.inherit && n && n.parameter(t, e) || null }, e.prototype.validates = function (t) { var e = function (t, e) { return !t || t.validates(e) }; return t = t || {}, this.parameters().filter(function (e) { return t.hasOwnProperty(e.id) }).map(function (r) { return e(r, t[r.id]) }).reduce(Se, !0) }, e.prototype.format = function (t) { function r(e) { var r = e.value(t[e.id]), n = e.validates(r), i = e.isDefaultValue(r); return { param: e, value: r, isValid: n, isDefaultValue: i, squash: !!i && e.squash, encoded: e.type.encode(r) } } void 0 === t && (t = {}); var n = this._cache.path, i = n.map(e.pathSegmentsAndParams).reduce(Re, []).map(function (t) { return Zt(t) ? t : r(t) }), o = n.map(e.queryParams).reduce(Re, []).map(r); if (i.concat(o).filter(function (t) { return !1 === t.isValid }).length) return null; var a = i.reduce(function (t, r) { if (Zt(r)) return t + r; var n = r.squash, i = r.encoded, o = r.param; return !0 === n ? t.match(/\/$/) ? t.slice(0, -1) : t : Zt(n) ? t + n : !1 !== n ? t : null == i ? t : te(i) ? t + b(i, e.encodeDashes).join("-") : o.raw ? t + i : t + encodeURIComponent(i) }, ""), u = o.map(function (t) { var e = t.param, r = t.squash, n = t.encoded, i = t.isDefaultValue; if (!(null == n || i && !1 !== r) && (te(n) || (n = [n]), 0 !== n.length)) return e.raw || (n = b(n, encodeURIComponent)), n.map(function (t) { return e.id + "=" + t }) }).filter(f).reduce(Re, []).join("&"); return a + (u ? "?" + u : "") + (t["#"] ? "#" + t["#"] : "") }, e.encodeDashes = function (t) { return encodeURIComponent(t).replace(/-/g, function (t) { return "%5C%" + t.charCodeAt(0).toString(16).toUpperCase() }) }, e.pathSegmentsAndParams = function (e) { return T(e._segments, e._params.filter(function (e) { return e.location === t.DefType.PATH }).concat(void 0)).reduce(Re, []).filter(function (t) { return "" !== t && zt(t) }) }, e.queryParams = function (e) { return e._params.filter(function (e) { return e.location === t.DefType.SEARCH }) }, e.compare = function (t, r) { var n = function (t) { return t._cache.segments = t._cache.segments || t._cache.path.map(e.pathSegmentsAndParams).reduce(Re, []).reduce(K, []).map(function (t) { return Zt(t) ? Vr(t) : t }).reduce(Re, []) }, i = function (t) { return t._cache.weights = t._cache.weights || n(t).map(function (t) { return "/" === t ? 1 : Zt(t) ? 2 : t instanceof Xe ? 3 : void 0 }) }, o = i(t), a = i(r); !function (t, e, r) { for (var n = Math.max(t.length, e.length); t.length < n;)t.push(r); for (; e.length < n;)e.push(r) }(o, a, 0); var u, s, c = T(o, a); for (s = 0; s < c.length; s++)if (0 != (u = c[s][0] - c[s][1])) return u; return 0 }, e.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/, e }(), Hr = function () { function e() { var e = this; this.paramTypes = new Sr, this._isCaseInsensitive = !1, this._isStrictMode = !0, this._defaultSquashPolicy = !1, this._getConfig = function (t) { return he({ strict: e._isStrictMode, caseInsensitive: e._isCaseInsensitive }, t) }, this.paramFactory = { fromConfig: function (r, n, i) { return new Xe(r, n, i, t.DefType.CONFIG, e) }, fromPath: function (r, n, i) { return new Xe(r, n, i, t.DefType.PATH, e) }, fromSearch: function (r, n, i) { return new Xe(r, n, i, t.DefType.SEARCH, e) } }, he(this, { UrlMatcher: Ar, Param: Xe }) } return e.prototype.caseInsensitive = function (t) { return this._isCaseInsensitive = zt(t) ? t : this._isCaseInsensitive }, e.prototype.strictMode = function (t) { return this._isStrictMode = zt(t) ? t : this._isStrictMode }, e.prototype.defaultSquashPolicy = function (t) { if (zt(t) && !0 !== t && !1 !== t && !Zt(t)) throw new Error("Invalid squash policy: " + t + ". Valid policies: false, true, arbitrary-string"); return this._defaultSquashPolicy = zt(t) ? t : this._defaultSquashPolicy }, e.prototype.compile = function (t, e) { return new Ar(t, this.paramTypes, this.paramFactory, this._getConfig(e)) }, e.prototype.isMatcher = function (t) { if (!Xt(t)) return !1; var e = !0; return le(Ar.prototype, function (r, n) { Kt(r) && (e = e && zt(t[n]) && Kt(t[n])) }), e }, e.prototype.type = function (t, e, r) { var n = this.paramTypes.type(t, e, r); return zt(e) ? this : n }, e.prototype.$get = function () { return this.paramTypes.enqueue = !1, this.paramTypes._flushTypeQueue(), this }, e.prototype.dispose = function () { this.paramTypes.dispose() }, e }(), qr = function () { function t(t) { this.router = t } return t.prototype.compile = function (t) { return this.router.urlMatcherFactory.compile(t) }, t.prototype.create = function (t, e) { var r = this, n = s([[Zt, function (t) { return n(r.compile(t)) }], [Ft(Ar), function (t) { return r.fromUrlMatcher(t, e) }], [ne, function (t) { return r.fromState(t, r.router) }], [Ft(RegExp), function (t) { return r.fromRegExp(t, e) }], [Kt, function (t) { return new Dr(t, e) }]]), i = n(t); if (!i) throw new Error("invalid 'what' in when()"); return i }, t.prototype.fromUrlMatcher = function (t, e) { var r = e; Zt(e) && (e = this.router.urlMatcherFactory.compile(e)), Ft(Ar)(e) && (r = function (t) { return e.format(t) }); var n = { urlMatcher: t, matchPriority: function (e) { var r = t.parameters().filter(function (t) { return t.isOptional }); return r.length ? r.filter(function (t) { return e[t.id] }).length / r.length : 1e-6 }, type: "URLMATCHER" }; return he(new Dr(function (e) { var r = t.exec(e.path, e.search, e.hash); return t.validates(r) && r }, r), n) }, t.prototype.fromState = function (t, e) { var r = { state: t, type: "STATE" }; return he(this.fromUrlMatcher(t.url, function (r) { var n = e.stateService, i = e.globals; n.href(t, r) !== n.href(i.current, i.params) && n.transitionTo(t, r, { inherit: !0, source: "url" }) }), r) }, t.prototype.fromRegExp = function (t, e) { if (t.global || t.sticky) throw new Error("Rule RegExp must not be global or sticky"); var r = Zt(e) ? function (t) { return e.replace(/\$(\$|\d{1,2})/, function (e, r) { return t["$" === r ? 0 : Number(r)] }) } : e, n = { regexp: t, type: "REGEXP" }; return he(new Dr(function (e) { return t.exec(e.path) }, r), n) }, t.isUrlRule = function (t) { return t && ["type", "match", "handler"].every(function (e) { return zt(t[e]) }) }, t }(), Dr = function () { return function (t, e) { var r = this; this.match = t, this.type = "RAW", this.matchPriority = function (t) { return 0 - r.$id }, this.handler = e || f } }(), Fr = function (t, e) { return (e.priority || 0) - (t.priority || 0) }, Nr = function (t, e) { var r = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 }; return (r[t.type] || 0) - (r[e.type] || 0) }, Ur = function (t, e) { return t.urlMatcher && e.urlMatcher ? Ar.compare(t.urlMatcher, e.urlMatcher) : 0 }, Lr = function (t, e) { var r = { STATE: !0, URLMATCHER: !0 }; return r[t.type] && r[e.type] ? 0 : (t.$id || 0) - (e.$id || 0) }; br = function (t, e) { var r = Fr(t, e); return 0 !== r ? r : 0 !== (r = Nr(t, e)) ? r : 0 !== (r = Ur(t, e)) ? r : Lr(t, e) }; var Mr = function () { function t(e) { this._sortFn = br, this._rules = [], this.interceptDeferred = !1, this._id = 0, this._sorted = !1, this._router = e, this.urlRuleFactory = new qr(e), h(Ut(t.prototype), this, Ut(this)) } return t.prototype.dispose = function () { this.listen(!1), this._rules = [], delete this._otherwiseFn }, t.prototype.sort = function (t) { this._rules = this.stableSort(this._rules, this._sortFn = t || this._sortFn), this._sorted = !0 }, t.prototype.ensureSorted = function () { this._sorted || this.sort() }, t.prototype.stableSort = function (t, e) { var r = t.map(function (t, e) { return { elem: t, idx: e } }); return r.sort(function (t, r) { var n = e(t.elem, r.elem); return 0 === n ? t.idx - r.idx : n }), r.map(function (t) { return t.elem }) }, t.prototype.match = function (t) { var e = this; this.ensureSorted(), t = he({ path: "", search: {}, hash: "" }, t); var r = this.rules(); this._otherwiseFn && r.push(this._otherwiseFn); for (var n, i = 0; i < r.length && (!n || 0 === this._sortFn(r[i], n.rule)); i++) { var o = function (r) { var n = r.match(t, e._router); return n && { match: n, rule: r, weight: r.matchPriority(n) } }(r[i]); n = !n || o && o.weight > n.weight ? o : n } return n }, t.prototype.sync = function (t) { if (!t || !t.defaultPrevented) { var e = this._router, r = e.urlService, n = e.stateService, i = { path: r.path(), search: r.search(), hash: r.hash() }, o = this.match(i); s([[Zt, function (t) { return r.url(t, !0) }], [Ge.isDef, function (t) { return n.go(t.state, t.params, t.options) }], [Ft(Ge), function (t) { return n.go(t.state(), t.params(), t.options()) }]])(o && o.rule.handler(o.match, i, e)) } }, t.prototype.listen = function (t) { var e = this; if (!1 !== t) return this._stopFn = this._stopFn || this._router.urlService.onChange(function (t) { return e.sync(t) }); this._stopFn && this._stopFn(), delete this._stopFn }, t.prototype.update = function (t) { var e = this._router.locationService; t ? this.location = e.path() : e.path() !== this.location && e.url(this.location, !0) }, t.prototype.push = function (t, e, r) { var n = r && !!r.replace; this._router.urlService.url(t.format(e || {}), n) }, t.prototype.href = function (t, e, r) { var n = t.format(e); if (null == n) return null; r = r || { absolute: !1 }; var i = this._router.urlService.config, o = i.html5Mode(); if (o || null === n || (n = "#" + i.hashPrefix() + n), n = it(n, o, r.absolute, i.baseHref()), !r.absolute || !n) return n; var a = !o && n ? "/" : "", u = i.port(); return u = 80 === u || 443 === u ? "" : ":" + u, [i.protocol(), "://", i.host(), u, a, n].join("") }, t.prototype.rule = function (t) { var e = this; if (!qr.isUrlRule(t)) throw new Error("invalid rule"); return t.$id = this._id++ , t.priority = t.priority || 0, this._rules.push(t), this._sorted = !1, function () { return e.removeRule(t) } }, t.prototype.removeRule = function (t) { me(this._rules, t) }, t.prototype.rules = function () { return this.ensureSorted(), this._rules.slice() }, t.prototype.otherwise = function (t) { var e = ot(t); this._otherwiseFn = this.urlRuleFactory.create(Ut(!0), e), this._sorted = !1 }, t.prototype.initial = function (t) { var e = ot(t); this.rule(this.urlRuleFactory.create(function (t, e) { return 0 === e.globals.transitionHistory.size() && !!/^\/?$/.exec(t.path) }, e)) }, t.prototype.when = function (t, e, r) { var n = this.urlRuleFactory.create(t, e); return zt(r && r.priority) && (n.priority = r.priority), this.rule(n), n }, t.prototype.deferIntercept = function (t) { void 0 === t && (t = !0), this.interceptDeferred = t }, t }(), Br = function () { function t() { var t = this; this._uiViews = [], this._viewConfigs = [], this._viewConfigFactories = {}, this._pluginapi = { _rootViewContext: this._rootViewContext.bind(this), _viewConfigFactory: this._viewConfigFactory.bind(this), _registeredUIViews: function () { return t._uiViews }, _activeViewConfigs: function () { return t._viewConfigs } } } return t.prototype._rootViewContext = function (t) { return this._rootContext = t || this._rootContext }, t.prototype._viewConfigFactory = function (t, e) { this._viewConfigFactories[t] = e }, t.prototype.createViewConfig = function (t, e) { var r = this._viewConfigFactories[e.$type]; if (!r) throw new Error("ViewService: No view config factory registered for type " + e.$type); var n = r(t, e); return te(n) ? n : [n] }, t.prototype.deactivateViewConfig = function (t) { Be.traceViewServiceEvent("<- Removing", t), me(this._viewConfigs, t) }, t.prototype.activateViewConfig = function (t) { Be.traceViewServiceEvent("-> Registering", t), this._viewConfigs.push(t) }, t.prototype.sync = function () { function e(t) { for (var e = t.viewDecl.$context, r = 0; ++r && e.parent;)e = e.parent; return r } var n = this, i = this._uiViews.map(function (t) { return [t.fqn, t] }).reduce(C, {}), o = r(function (t, e, r, n) { return e * (t(r) - t(n)) }), a = this._uiViews.sort(o(function (t) { var e = function (t) { return t && t.parent ? e(t.parent) + 1 : 1 }; return 1e4 * t.fqn.split(".").length + e(t.creationContext) }, 1)).map(function (r) { var a = n._viewConfigs.filter(t.matches(i, r)); return a.length > 1 && a.sort(o(e, -1)), [r, a[0]] }); Be.traceViewSync(a), a.forEach(function (t) { var e = t[0], r = t[1]; -1 !== n._uiViews.indexOf(e) && e.configUpdated(r) }) }, t.prototype.registerUIView = function (t) { Be.traceViewServiceUIViewEvent("-> Registering", t); var e = this._uiViews; return e.filter(function (e) { return e.fqn === t.fqn && e.$type === t.$type }).length && Be.traceViewServiceUIViewEvent("!!!! duplicate uiView named:", t), e.push(t), this.sync(), function () { -1 !== e.indexOf(t) ? (Be.traceViewServiceUIViewEvent("<- Deregistering", t), me(e)(t)) : Be.traceViewServiceUIViewEvent("Tried removing non-registered uiView", t) } }, t.prototype.available = function () { return this._uiViews.map(jt("fqn")) }, t.prototype.active = function () { return this._uiViews.filter(jt("$config")).map(jt("name")) }, t.normalizeUIViewTarget = function (t, e) { void 0 === e && (e = ""); var r = e.split("@"), n = r[0] || "$default", i = Zt(r[1]) ? r[1] : "^", o = /^(\^(?:\.\^)*)\.(.*$)/.exec(n); return o && (i = o[1], n = o[2]), "!" === n.charAt(0) && (n = n.substr(1), i = ""), /^(\^(?:\.\^)*)$/.exec(i) ? i = i.split(".").reduce(function (t, e) { return t.parent }, t).name : "." === i && (i = t.name), { uiViewName: n, uiViewContextAnchor: i } }, t.matches = function (t, e) { return function (r) { if (e.$type !== r.viewDecl.$type) return !1; var n = r.viewDecl, i = n.$uiViewName.split("."), o = e.fqn.split("."); if (!pe(i, o.slice(0 - i.length))) return !1; var a = 1 - i.length || void 0, u = o.slice(0, a).join("."), s = t[u].creationContext; return n.$uiViewContextAnchor === (s && s.name) } }, t }(), Gr = function () { function t() { this.params = new Rr, this.lastStartedTransitionId = -1, this.transitionHistory = new Ve([], 1), this.successfulTransitions = new Ve([], 1) } return t.prototype.dispose = function () { this.transitionHistory.clear(), this.successfulTransitions.clear(), this.transition = null }, t }(), Wr = function (t) { return t.reduce(function (t, e) { return t[e] = oe(e), t }, { dispose: l }) }, zr = ["url", "path", "search", "hash", "onChange"], Jr = ["port", "protocol", "host", "baseHref", "html5Mode", "hashPrefix"], Qr = ["type", "caseInsensitive", "strictMode", "defaultSquashPolicy"], Kr = ["sort", "when", "initial", "otherwise", "rules", "rule", "removeRule"], Yr = ["deferIntercept", "listen", "sync", "match"], Zr = function () { function t(t, e) { void 0 === e && (e = !0), this.router = t, this.rules = {}, this.config = {}; var r = function () { return t.locationService }; h(r, this, r, zr, e); var n = function () { return t.locationConfig }; h(n, this.config, n, Jr, e); var i = function () { return t.urlMatcherFactory }; h(i, this.config, i, Qr); var o = function () { return t.urlRouter }; h(o, this.rules, o, Kr), h(o, this, o, Yr) } return t.prototype.url = function (t, e, r) { }, t.prototype.path = function () { }, t.prototype.search = function () { }, t.prototype.hash = function () { }, t.prototype.onChange = function (t) { }, t.prototype.parts = function () { return { path: this.path(), search: this.search(), hash: this.hash() } }, t.prototype.dispose = function () { }, t.prototype.sync = function (t) { }, t.prototype.listen = function (t) { }, t.prototype.deferIntercept = function (t) { }, t.prototype.match = function (t) { }, t.locationServiceStub = Wr(zr), t.locationConfigStub = Wr(Jr), t }(), Xr = 0, tn = function () { function t(t, e) { void 0 === t && (t = Zr.locationServiceStub), void 0 === e && (e = Zr.locationConfigStub), this.locationService = t, this.locationConfig = e, this.$id = Xr++ , this._disposed = !1, this._disposables = [], this.trace = Be, this.viewService = new Br, this.transitionService = new kn(this), this.globals = new Gr, this.urlMatcherFactory = new Hr, this.urlRouter = new Mr(this), this.stateRegistry = new Ir(this), this.stateService = new On(this), this.urlService = new Zr(this), this._plugins = {}, this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()), this.globals.$current = this.stateRegistry.root(), this.globals.current = this.globals.$current.self, this.disposable(this.globals), this.disposable(this.stateService), this.disposable(this.stateRegistry), this.disposable(this.transitionService), this.disposable(this.urlRouter), this.disposable(t), this.disposable(e) } return t.prototype.disposable = function (t) { this._disposables.push(t) }, t.prototype.dispose = function (t) { var e = this; t && Kt(t.dispose) ? t.dispose(this) : (this._disposed = !0, this._disposables.slice().forEach(function (t) { try { "function" == typeof t.dispose && t.dispose(e), me(e._disposables, t) } catch (t) { } })) }, t.prototype.plugin = function (t, e) { void 0 === e && (e = {}); var r = new t(this, e); if (!r.name) throw new Error("Required property `name` missing on plugin: " + r); return this._disposables.push(r), this._plugins[r.name] = r }, t.prototype.getPlugin = function (t) { return t ? this._plugins[t] : $e(this._plugins) }, t }(), en = function (t) { return t.onCreate({}, at) }, rn = function (t) { function e(e) { if (e) return e instanceof Ge ? e : Zt(e) ? n.target(e, t.params(), t.options()) : e.state || e.params ? n.target(e.state || t.to(), e.params || t.params(), t.options()) : void 0 } var r = t.to().redirectTo; if (r) { var n = t.router.stateService; return Kt(r) ? ae.$q.when(r(t)).then(e) : e(r) } }, nn = function (t) { return t.onStart({ to: function (t) { return !!t.redirectTo } }, rn) }, on = ut("onExit"), an = function (t) { return t.onExit({ exiting: function (t) { return !!t.onExit } }, on) }, un = ut("onRetain"), sn = function (t) { return t.onRetain({ retained: function (t) { return !!t.onRetain } }, un) }, cn = ut("onEnter"), fn = function (t) { return t.onEnter({ entering: function (t) { return !!t.onEnter } }, cn) }, ln = function (t) { return new cr(t.treeChanges().to).resolvePath("EAGER", t).then(l) }, hn = function (t) { return t.onStart({}, ln, { priority: 1e3 }) }, pn = function (t, e) { return new cr(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY", t).then(l) }, dn = function (t) { return t.onEnter({ entering: Ut(!0) }, pn, { priority: 1e3 }) }, vn = function (t) { var e = ae.$q, r = t.views("entering"); if (r.length) return e.all(r.map(function (t) { return e.when(t.load()) })).then(l) }, mn = function (t) { return t.onFinish({}, vn) }, yn = function (t) { var e = t.views("entering"), r = t.views("exiting"); if (e.length || r.length) { var n = t.router.viewService; r.forEach(function (t) { return n.deactivateViewConfig(t) }), e.forEach(function (t) { return n.activateViewConfig(t) }), n.sync() } }, gn = function (t) { return t.onSuccess({}, yn) }, _n = function (t) { var e = t.router.globals, r = function () { e.transition === t && (e.transition = null) }; t.onSuccess({}, function () { e.successfulTransitions.enqueue(t), e.$current = t.$to(), e.current = e.$current.self, k(t.params(), e.params) }, { priority: 1e4 }), t.promise.then(r, r) }, wn = function (t) { return t.onCreate({}, _n) }, $n = function (t) { var e = t.options(), r = t.router.stateService, n = t.router.urlRouter; if ("url" !== e.source && e.location && r.$current.navigable) { var i = { replace: "replace" === e.location }; n.push(r.$current.navigable.url, r.params, i) } n.update(!0) }, Sn = function (t) { return t.onSuccess({}, $n, { priority: 9999 }) }, bn = function (t) { var e = t.router, r = t.entering().filter(function (t) { return !!t.$$state().lazyLoad }).map(function (e) { return st(t, e) }); return ae.$q.all(r).then(function () { if ("url" !== t.originalTransition().options().source) { var r = t.targetState(); return e.stateService.target(r.identifier(), r.params(), r.options()) } var n = e.urlService, i = n.match(n.parts()), o = i && i.rule; if (o && "STATE" === o.type) { var a = o.state, u = i.match; return e.stateService.target(a, u, t.options()) } e.urlService.sync() }) }, Rn = function (t) { return t.onBefore({ entering: function (t) { return !!t.lazyLoad } }, bn) }, En = function () { return function (t, e, r, n, i, o, a, u) { void 0 === i && (i = !1), void 0 === o && (o = ze.HANDLE_RESULT), void 0 === a && (a = ze.REJECT_ERROR), void 0 === u && (u = !1), this.name = t, this.hookPhase = e, this.hookOrder = r, this.criteriaMatchPath = n, this.reverseSort = i, this.getResultHandler = o, this.getErrorHandler = a, this.synchronous = u } }(), Tn = function (t) { return t.onBefore({}, ct, { priority: -9999 }) }, Cn = function (t) { return t.onBefore({}, ft, { priority: -1e4 }) }, Pn = { location: !0, relative: null, inherit: !1, notify: !0, reload: !1, custom: {}, current: function () { return null }, source: "unknown" }, kn = function () { function e(t) { this._transitionCount = 0, this._eventTypes = [], this._registeredHooks = {}, this._criteriaPaths = {}, this._router = t, this.$view = t.viewService, this._deregisterHookFns = {}, this._pluginapi = h(Ut(this), {}, Ut(this), ["_definePathType", "_defineEvent", "_getPathTypes", "_getEvents", "getHooks"]), this._defineCorePaths(), this._defineCoreEvents(), this._registerCoreTransitionHooks() } return e.prototype.onCreate = function (t, e, r) { }, e.prototype.onBefore = function (t, e, r) { }, e.prototype.onStart = function (t, e, r) { }, e.prototype.onExit = function (t, e, r) { }, e.prototype.onRetain = function (t, e, r) { }, e.prototype.onEnter = function (t, e, r) { }, e.prototype.onFinish = function (t, e, r) { }, e.prototype.onSuccess = function (t, e, r) { }, e.prototype.onError = function (t, e, r) { }, e.prototype.dispose = function (t) { $e(this._registeredHooks).forEach(function (t) { return t.forEach(function (e) { e._deregistered = !0, me(t, e) }) }) }, e.prototype.create = function (t, e) { return new hr(t, e, this._router) }, e.prototype._defineCoreEvents = function () { var e = t.TransitionHookPhase, r = ze, n = this._criteriaPaths; this._defineEvent("onCreate", e.CREATE, 0, n.to, !1, r.LOG_REJECTED_RESULT, r.THROW_ERROR, !0), this._defineEvent("onBefore", e.BEFORE, 0, n.to), this._defineEvent("onStart", e.RUN, 0, n.to), this._defineEvent("onExit", e.RUN, 100, n.exiting, !0), this._defineEvent("onRetain", e.RUN, 200, n.retained), this._defineEvent("onEnter", e.RUN, 300, n.entering), this._defineEvent("onFinish", e.RUN, 400, n.to), this._defineEvent("onSuccess", e.SUCCESS, 0, n.to, !1, r.LOG_REJECTED_RESULT, r.LOG_ERROR, !0), this._defineEvent("onError", e.ERROR, 0, n.to, !1, r.LOG_REJECTED_RESULT, r.LOG_ERROR, !0) }, e.prototype._defineCorePaths = function () { var e = t.TransitionHookScope.STATE, r = t.TransitionHookScope.TRANSITION; this._definePathType("to", r), this._definePathType("from", r), this._definePathType("exiting", e), this._definePathType("retained", e), this._definePathType("entering", e) }, e.prototype._defineEvent = function (t, e, r, n, i, o, a, u) { void 0 === i && (i = !1), void 0 === o && (o = ze.HANDLE_RESULT), void 0 === a && (a = ze.REJECT_ERROR), void 0 === u && (u = !1); var s = new En(t, e, r, n, i, o, a, u); this._eventTypes.push(s), H(this, this, s) }, e.prototype._getEvents = function (t) { return (zt(t) ? this._eventTypes.filter(function (e) { return e.hookPhase === t }) : this._eventTypes.slice()).sort(function (t, e) { var r = t.hookPhase - e.hookPhase; return 0 === r ? t.hookOrder - e.hookOrder : r }) }, e.prototype._definePathType = function (t, e) { this._criteriaPaths[t] = { name: t, scope: e } }, e.prototype._getPathTypes = function () { return this._criteriaPaths }, e.prototype.getHooks = function (t) { return this._registeredHooks[t] }, e.prototype._registerCoreTransitionHooks = function () { var t = this._deregisterHookFns; t.addCoreResolves = en(this), t.ignored = Tn(this), t.invalid = Cn(this), t.redirectTo = nn(this), t.onExit = an(this), t.onRetain = sn(this), t.onEnter = fn(this), t.eagerResolve = hn(this), t.lazyResolve = dn(this), t.loadViews = mn(this), t.activateViews = gn(this), t.updateGlobals = wn(this), t.updateUrl = Sn(this), t.lazyLoad = Rn(this) }, e }(), On = function () { function e(t) { this.router = t, this.invalidCallbacks = [], this._defaultErrorHandler = function (t) { t instanceof Error && t.stack ? (console.error(t), console.error(t.stack)) : t instanceof He ? (console.error(t.toString()), t.detail && t.detail.stack && console.error(t.detail.stack)) : console.error(t) }; var r = ["current", "$current", "params", "transition"], n = Object.keys(e.prototype).filter(Ht(ve(r))); h(Ut(e.prototype), this, Ut(this), n) } return Object.defineProperty(e.prototype, "transition", { get: function () { return this.router.globals.transition }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "params", { get: function () { return this.router.globals.params }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "current", { get: function () { return this.router.globals.current }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "$current", { get: function () { return this.router.globals.$current }, enumerable: !0, configurable: !0 }), e.prototype.dispose = function () { this.defaultErrorHandler(l), this.invalidCallbacks = [] }, e.prototype._handleInvalidTargetState = function (t, e) { function r() { var t = s.dequeue(); return void 0 === t ? He.invalid(e.error()).toPromise() : ae.$q.when(t(e, i, c)).then(f).then(function (t) { return t || r() }) } var n = this, i = er.makeTargetState(this.router.stateRegistry, t), o = this.router.globals, a = function () { return o.transitionHistory.peekTail() }, u = a(), s = new Ve(this.invalidCallbacks.slice()), c = new cr(t).injector(), f = function (t) { if (t instanceof Ge) { var e = t; return (e = n.target(e.identifier(), e.params(), e.options())).valid() ? a() !== u ? He.superseded().toPromise() : n.transitionTo(e.identifier(), e.params(), e.options()) : He.invalid(e.error()).toPromise() } }; return r() }, e.prototype.onInvalid = function (t) { return this.invalidCallbacks.push(t), function () { me(this.invalidCallbacks)(t) }.bind(this) }, e.prototype.reload = function (t) { return this.transitionTo(this.current, this.params, { reload: !zt(t) || t, inherit: !1, notify: !1 }) }, e.prototype.go = function (t, e, r) { var n = m(r, { relative: this.$current, inherit: !0 }, Pn); return this.transitionTo(t, e, n) }, e.prototype.target = function (t, e, r) { if (void 0 === r && (r = {}), Xt(r.reload) && !r.reload.name) throw new Error("Invalid reload state object"); var n = this.router.stateRegistry; if (r.reloadState = !0 === r.reload ? n.root() : n.matcher.find(r.reload, r.relative), r.reload && !r.reloadState) throw new Error("No such reload state '" + (Zt(r.reload) ? r.reload : r.reload.name) + "'"); return new Ge(this.router.stateRegistry, t, e, r) }, e.prototype.getCurrentPath = function () { var t = this, e = this.router.globals.successfulTransitions.peekTail(); return e ? e.treeChanges().to : [new tr(t.router.stateRegistry.root())] }, e.prototype.transitionTo = function (e, r, n) { var i = this; void 0 === r && (r = {}), void 0 === n && (n = {}); var o = this.router, a = o.globals; n = m(n, Pn); n = he(n, { current: function () { return a.transition } }); var u = this.target(e, r, n), s = this.getCurrentPath(); if (!u.exists()) return this._handleInvalidTargetState(s, u); if (!u.valid()) return je(u.error()); var c = function (e) { return function (r) { if (r instanceof He) { var n = o.globals.lastStartedTransitionId === e.$id; if (r.type === t.RejectType.IGNORED) return n && o.urlRouter.update(), ae.$q.when(a.current); var u = r.detail; if (r.type === t.RejectType.SUPERSEDED && r.redirected && u instanceof Ge) { var s = e.redirect(u); return s.run().catch(c(s)) } if (r.type === t.RejectType.ABORTED) return n && o.urlRouter.update(), ae.$q.reject(r) } return i.defaultErrorHandler()(r), ae.$q.reject(r) } }, f = this.router.transitionService.create(s, u), l = f.run().catch(c(f)); return Ie(l), he(l, { transition: f }) }, e.prototype.is = function (t, e, r) { r = m(r, { relative: this.$current }); var n = this.router.stateRegistry.matcher.find(t, r.relative); if (zt(n)) { if (this.$current !== n) return !1; if (!e) return !0; var i = n.parameters({ inherit: !0, matchingKeys: e }); return Xe.equals(i, Xe.values(i, e), this.params) } }, e.prototype.includes = function (t, e, r) { r = m(r, { relative: this.$current }); var n = Zt(t) && Lt.fromString(t); if (n) { if (!n.matches(this.$current.name)) return !1; t = this.$current.name } var i = this.router.stateRegistry.matcher.find(t, r.relative), o = this.$current.includes; if (zt(i)) { if (!zt(o[i.name])) return !1; if (!e) return !0; var a = i.parameters({ inherit: !0, matchingKeys: e }); return Xe.equals(a, Xe.values(a, e), this.params) } }, e.prototype.href = function (t, e, r) { r = m(r, { lossy: !0, inherit: !0, absolute: !1, relative: this.$current }), e = e || {}; var n = this.router.stateRegistry.matcher.find(t, r.relative); if (!zt(n)) return null; r.inherit && (e = this.params.$inherit(e, this.$current, n)); var i = n && r.lossy ? n.navigable : n; return i && void 0 !== i.url && null !== i.url ? this.router.urlRouter.href(i.url, e, { absolute: r.absolute }) : null }, e.prototype.defaultErrorHandler = function (t) { return this._defaultErrorHandler = t || this._defaultErrorHandler }, e.prototype.get = function (t, e) { var r = this.router.stateRegistry; return 0 === arguments.length ? r.get() : r.get(t, e || this.$current) }, e.prototype.lazyLoad = function (t, e) { var r = this.get(t); if (!r || !r.lazyLoad) throw new Error("Can not lazy load " + t); var n = this.getCurrentPath(), i = er.makeTargetState(this.router.stateRegistry, n); return e = e || this.router.transitionService.create(n, i), st(e, r) }, e }(), xn = { when: function (t) { return new Promise(function (e, r) { return e(t) }) }, reject: function (t) { return new Promise(function (e, r) { r(t) }) }, defer: function () { var t = {}; return t.promise = new Promise(function (e, r) { t.resolve = e, t.reject = r }), t }, all: function (t) { if (te(t)) return Promise.all(t); if (Xt(t)) { var e = Object.keys(t).map(function (e) { return t[e].then(function (t) { return { key: e, val: t } }) }); return xn.all(e).then(function (t) { return t.reduce(function (t, e) { return t[e.key] = e.val, t }, {}) }) } } }, In = {}, jn = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, Vn = /([^\s,]+)/g, An = { get: function (t) { return In[t] }, has: function (t) { return null != An.get(t) }, invoke: function (t, e, r) { var n = he({}, In, r || {}), i = An.annotate(t), o = ke(function (t) { return n.hasOwnProperty(t) }, function (t) { return "DI can't find injectable: '" + t + "'" }), a = i.filter(o).map(function (t) { return n[t] }); return Kt(t) ? t.apply(e, a) : t.slice(-1)[0].apply(e, a) }, annotate: function (t) { if (!c(t)) throw new Error("Not an injectable function: " + t); if (t && t.$inject) return t.$inject; if (te(t)) return t.slice(0, -1); var e = t.toString().replace(jn, ""); return e.slice(e.indexOf("(") + 1, e.indexOf(")")).match(Vn) || [] } }, Hn = function (t, e) { var r = e[0], n = e[1]; return t.hasOwnProperty(r) ? te(t[r]) ? t[r].push(n) : t[r] = [t[r], n] : t[r] = n, t }, qn = function (t) { return t.split("&").filter(f).map(wr).reduce(Hn, {}) }, Dn = function (t) { var e = t.path(), r = t.search(), n = t.hash(), i = Object.keys(r).map(function (t) { var e = r[t]; return (te(e) ? e : [e]).map(function (e) { return t + "=" + e }) }).reduce(Re, []).join("&"); return e + (i ? "?" + i : "") + (n ? "#" + n : "") }, Fn = function () { function t(t, e) { var r = this; this.fireAfterUpdate = e, this._listener = function (t) { return r._listeners.forEach(function (e) { return e(t) }) }, this._listeners = [], this.hash = function () { return lt(r._get()).hash }, this.path = function () { return lt(r._get()).path }, this.search = function () { return qn(lt(r._get()).search) }, this._location = ue.location, this._history = ue.history } return t.prototype.url = function (t, e) { return void 0 === e && (e = !0), zt(t) && t !== this._get() && (this._set(null, null, t, e), this.fireAfterUpdate && this._listeners.forEach(function (e) { return e({ url: t }) })), Dn(this) }, t.prototype.onChange = function (t) { var e = this; return this._listeners.push(t), function () { return me(e._listeners, t) } }, t.prototype.dispose = function (t) { ge(this._listeners) }, t }(), Nn = function () { var t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e } || function (t, e) { for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]) }; return function (e, r) { function n() { this.constructor = e } t(e, r), e.prototype = null === r ? Object.create(r) : (n.prototype = r.prototype, new n) } }(), Un = function (t) { function e(e) { var r = t.call(this, e, !1) || this; return ue.addEventListener("hashchange", r._listener, !1), r } return Nn(e, t), e.prototype._get = function () { return $r(this._location.hash) }, e.prototype._set = function (t, e, r, n) { this._location.hash = r }, e.prototype.dispose = function (e) { t.prototype.dispose.call(this, e), ue.removeEventListener("hashchange", this._listener) }, e }(Fn), Ln = function () { var t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e } || function (t, e) { for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]) }; return function (e, r) { function n() { this.constructor = e } t(e, r), e.prototype = null === r ? Object.create(r) : (n.prototype = r.prototype, new n) } }(), Mn = function (t) { function e(e) { return t.call(this, e, !0) || this } return Ln(e, t), e.prototype._get = function () { return this._url }, e.prototype._set = function (t, e, r, n) { this._url = r }, e }(Fn), Bn = function () { var t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e } || function (t, e) { for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]) }; return function (e, r) { function n() { this.constructor = e } t(e, r), e.prototype = null === r ? Object.create(r) : (n.prototype = r.prototype, new n) } }(), Gn = function (t) { function e(e) { var r = t.call(this, e, !0) || this; return r._config = e.urlService.config, ue.addEventListener("popstate", r._listener, !1), r } return Bn(e, t), e.prototype._getBasePrefix = function () { return yr(this._config.baseHref()) }, e.prototype._get = function () { var t = this._location, e = t.pathname, r = t.hash, n = t.search; n = _r(n)[1], r = gr(r)[1]; var i = this._getBasePrefix(), o = e === this._config.baseHref(), a = e.startsWith(i); return (e = o ? "/" : a ? e.substring(i.length) : e) + (n ? "?" + n : "") + (r ? "#" + r : "") }, e.prototype._set = function (t, e, r, n) { var i = this._getBasePrefix() + r; n ? this._history.replaceState(t, e, i) : this._history.pushState(t, e, i) }, e.prototype.dispose = function (e) { t.prototype.dispose.call(this, e), ue.removeEventListener("popstate", this._listener) }, e }(Fn), Wn = function () { return function () { var t = this; this._baseHref = "", this._port = 80, this._protocol = "http", this._host = "localhost", this._hashPrefix = "", this.port = function () { return t._port }, this.protocol = function () { return t._protocol }, this.host = function () { return t._host }, this.baseHref = function () { return t._baseHref }, this.html5Mode = function () { return !1 }, this.hashPrefix = function (e) { return zt(e) ? t._hashPrefix = e : t._hashPrefix }, this.dispose = l } }(), zn = function () { function t(t, e) { void 0 === e && (e = !1), this._isHtml5 = e, this._baseHref = void 0, this._hashPrefix = "" } return t.prototype.port = function () { return location.port ? Number(location.port) : "https" === this.protocol() ? 443 : 80 }, t.prototype.protocol = function () { return location.protocol.replace(/:/g, "") }, t.prototype.host = function () { return location.hostname }, t.prototype.html5Mode = function () { return this._isHtml5 }, t.prototype.hashPrefix = function (t) { return zt(t) ? this._hashPrefix = t : this._hashPrefix }, t.prototype.baseHref = function (t) { return zt(t) ? this._baseHref = t : zt(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref() }, t.prototype.applyDocumentBaseHref = function () { var t = document.getElementsByTagName("base")[0]; return this._baseHref = t ? t.href.substr(location.origin.length) : "" }, t.prototype.dispose = function () { }, t }(), Jn = ht("vanilla.hashBangLocation", !1, Un, zn), Qn = ht("vanilla.pushStateLocation", !0, Gn, zn), Kn = ht("vanilla.memoryLocation", !1, Mn, Wn), Yn = function () { function t() { } return t.prototype.dispose = function (t) { }, t }(), Zn = Object.freeze({ root: ue, fromJson: ce, toJson: fe, forEach: le, extend: he, equals: pe, identity: f, noop: l, createProxyFunctions: h, inherit: de, inArray: ve, _inArray: p, removeFrom: me, _removeFrom: d, pushTo: ye, _pushTo: v, deregAll: ge, defaults: m, mergeR: _e, ancestors: y, pick: g, omit: _, pluck: w, filter: $, find: S, mapObj: we, map: b, values: $e, allTrueR: Se, anyTrueR: be, unnestR: Re, flattenR: Ee, pushR: R, uniqR: Te, unnest: Ce, flatten: Pe, assertPredicate: ke, assertMap: Oe, assertFn: E, pairs: xe, arrayTuples: T, applyPairs: C, tail: P, copy: k, _extend: O, silenceUncaughtInPromise: Ie, silentRejection: je, notImplemented: oe, services: ae, Glob: Lt, curry: r, compose: n, pipe: i, prop: jt, propEq: Vt, parse: At, not: Ht, and: o, or: a, all: qt, any: Dt, is: Ft, eq: Nt, val: Ut, invoke: u, pattern: s, isUndefined: Wt, isDefined: zt, isNull: Jt, isNullOrUndefined: Qt, isFunction: Kt, isNumber: Yt, isString: Zt, isObject: Xt, isArray: te, isDate: ee, isRegExp: re, isState: ne, isInjectable: c, isPromise: ie, Queue: Ve, maxLength: M, padString: B, kebobString: G, functionToString: W, fnToString: z, stringify: J, beforeAfterSubstr: vr, hostRegex: mr, stripFile: yr, splitHash: gr, splitQuery: _r, splitEqual: wr, trimHashVal: $r, splitOnDelim: Q, joinNeighborsR: K, get Category() { return t.Category }, Trace: Me, trace: Be, get DefType() { return t.DefType }, Param: Xe, ParamTypes: Sr, StateParams: Rr, ParamType: Ke, PathNode: tr, PathUtils: er, resolvePolicies: ir, defaultResolvePolicy: rr, Resolvable: nr, NATIVE_INJECTOR_TOKEN: sr, ResolveContext: cr, resolvablesBuilder: rt, StateBuilder: kr, StateObject: Mt, StateMatcher: Or, StateQueueManager: xr, StateRegistry: Ir, StateService: On, TargetState: Ge, get TransitionHookPhase() { return t.TransitionHookPhase }, get TransitionHookScope() { return t.TransitionHookScope }, HookBuilder: Qe, matchState: A, RegisteredHook: Je, makeEvent: H, get RejectType() { return t.RejectType }, Rejection: He, Transition: hr, TransitionHook: ze, TransitionEventType: En, defaultTransOpts: Pn, TransitionService: kn, UrlMatcher: Ar, UrlMatcherFactory: Hr, UrlRouter: Mr, UrlRuleFactory: qr, BaseUrlRule: Dr, UrlService: Zr, ViewService: Br, UIRouterGlobals: Gr, UIRouter: tn, $q: xn, $injector: An, BaseLocationServices: Fn, HashLocationService: Un, MemoryLocationService: Mn, PushStateLocationService: Gn, MemoryLocationConfig: Wn, BrowserLocationConfig: zn, keyValsToObjectR: Hn, getParams: qn, parseUrl: lt, buildUrl: Dn, locationPluginFactory: ht, servicesPlugin: pt, hashLocationPlugin: Jn, pushStateLocationPlugin: Qn, memoryLocationPlugin: Kn, UIRouterPluginBase: Yn }), Xn = function (t, e) { return t.reduce(function (t, r) { return t || zt(e[r]) }, !1) }, ti = 0, ei = function () { function t(t, e, r) { var n = this; this.path = t, this.viewDecl = e, this.factory = r, this.$id = ti++ , this.loaded = !1, this.getTemplate = function (t, e) { return n.component ? n.factory.makeComponentTemplate(t, e, n.component, n.viewDecl.bindings) : n.template } } return t.prototype.load = function () { var t = this, e = ae.$q, r = new cr(this.path), n = this.path.reduce(function (t, e) { return he(t, e.paramValues) }, {}), i = { template: e.when(this.factory.fromConfig(this.viewDecl, n, r)), controller: e.when(this.getController(r)) }; return e.all(i).then(function (e) { return Be.traceViewServiceEvent("Loaded", t), t.controller = e.controller, he(t, e.template), t }) }, t.prototype.getController = function (t) { var e = this.viewDecl.controllerProvider; if (!c(e)) return this.viewDecl.controller; var r = ae.$injector.annotate(e), n = te(e) ? P(e) : e; return new nr("", n, r).get(t) }, t }(), ri = function () { function t() { var t = this; this._useHttp = It.version.minor < 3, this.$get = ["$http", "$templateCache", "$injector", function (e, r, n) { return t.$templateRequest = n.has && n.has("$templateRequest") && n.get("$templateRequest"), t.$http = e, t.$templateCache = r, t }] } return t.prototype.useHttpService = function (t) { this._useHttp = t }, t.prototype.fromConfig = function (t, e, r) { var n = function (t) { return ae.$q.when(t).then(function (t) { return { template: t } }) }, i = function (t) { return ae.$q.when(t).then(function (t) { return { component: t } }) }; return zt(t.template) ? n(this.fromString(t.template, e)) : zt(t.templateUrl) ? n(this.fromUrl(t.templateUrl, e)) : zt(t.templateProvider) ? n(this.fromProvider(t.templateProvider, e, r)) : zt(t.component) ? i(t.component) : zt(t.componentProvider) ? i(this.fromComponentProvider(t.componentProvider, e, r)) : n("
") }, t.prototype.fromString = function (t, e) { return Kt(t) ? t(e) : t }, t.prototype.fromUrl = function (t, e) { return Kt(t) && (t = t(e)), null == t ? null : this._useHttp ? this.$http.get(t, { cache: this.$templateCache, headers: { Accept: "text/html" } }).then(function (t) { return t.data }) : this.$templateRequest(t) }, t.prototype.fromProvider = function (t, e, r) { var n = ae.$injector.annotate(t), i = te(t) ? P(t) : t; return new nr("", i, n).get(r) }, t.prototype.fromComponentProvider = function (t, e, r) { var n = ae.$injector.annotate(t), i = te(t) ? P(t) : t; return new nr("", i, n).get(r) }, t.prototype.makeComponentTemplate = function (t, e, r, n) { n = n || {}; var i = It.version.minor >= 3 ? "::" : "", o = function (t) { var e = G(t); return /^(x|data)-/.exec(e) ? "x-" + e : e }, a = mt(r).map(function (r) { var a = r.name, u = r.type, s = o(a); if (t.attr(s) && !n[a]) return s + "='" + t.attr(s) + "'"; var c = n[a] || a; if ("@" === u) return s + "='{{" + i + "$resolve." + c + "}}'"; if ("&" === u) { var f = e.getResolvable(c), l = f && f.data, h = l && ae.$injector.annotate(l) || []; return s + "='$resolve." + c + (te(l) ? "[" + (l.length - 1) + "]" : "") + "(" + h.join(",") + ")'" } return s + "='" + i + "$resolve." + c + "'" }).join(" "), u = o(r); return "<" + u + " " + a + ">" + u + ">" }, t }(), ni = function (t) { return ii(Xt(t.bindToController) ? t.bindToController : t.scope) }, ii = function (t) { return Object.keys(t || {}).map(function (e) { return [e, /^([=<@&])[?]?(.*)/.exec(t[e])] }).filter(function (t) { return zt(t) && te(t[1]) }).map(function (t) { return { name: t[1][2] || t[0], type: t[1][1] } }) }, oi = function () { function t(e, r) { this.stateRegistry = e, this.stateService = r, h(Ut(t.prototype), this, Ut(this)) } return t.prototype.decorator = function (t, e) { return this.stateRegistry.decorator(t, e) || this }, t.prototype.state = function (t, e) { return Xt(t) ? e = t : e.name = t, this.stateRegistry.register(e), this }, t.prototype.onInvalid = function (t) { return this.stateService.onInvalid(t) }, t }(), ai = function (t) { return function (e, r) { var n = e[t], i = "onExit" === t ? "from" : "to"; return n ? function (t, e) { var r = new cr(t.treeChanges(i)), o = he(yi(r), { $state$: e, $transition$: t }); return ae.$injector.invoke(n, this, o) } : void 0 } }, ui = function () { function t(t) { this._urlListeners = [], this.$locationProvider = t; var e = Ut(t); h(e, this, e, ["hashPrefix"]) } return t.prototype.dispose = function () { }, t.prototype.onChange = function (t) { var e = this; return this._urlListeners.push(t), function () { return me(e._urlListeners)(t) } }, t.prototype.html5Mode = function () { var t = this.$locationProvider.html5Mode(); return (t = Xt(t) ? t.enabled : t) && this.$sniffer.history }, t.prototype.url = function (t, e, r) { return void 0 === e && (e = !1), t && this.$location.url(t), e && this.$location.replace(), r && this.$location.state(r), this.$location.url() }, t.prototype._runtimeServices = function (t, e, r, n) { var i = this; this.$location = e, this.$sniffer = r, t.$on("$locationChangeSuccess", function (t) { return i._urlListeners.forEach(function (e) { return e(t) }) }); var o = Ut(e), a = Ut(n); h(o, this, o, ["replace", "path", "search", "hash"]), h(o, this, o, ["port", "protocol", "host"]), h(a, this, a, ["baseHref"]) }, t.monkeyPatchPathParameterType = function (t) { var e = t.urlMatcherFactory.type("path"); e.encode = function (t) { return null != t ? t.toString().replace(/(~|\/)/g, function (t) { return { "~": "~~", "/": "~2F" }[t] }) : t }, e.decode = function (t) { return null != t ? t.toString().replace(/(~~|~2F)/g, function (t) { return { "~~": "~", "~2F": "/" }[t] }) : t } }, t }(), si = function () { function t(t) { this._router = t, this._urlRouter = t.urlRouter } return t.prototype.$get = function () { var t = this._urlRouter; return t.update(!0), t.interceptDeferred || t.listen(), t }, t.prototype.rule = function (t) { var e = this; if (!Kt(t)) throw new Error("'rule' must be a function"); var r = new Dr(function () { return t(ae.$injector, e._router.locationService) }, f); return this._urlRouter.rule(r), this }, t.prototype.otherwise = function (t) { var e = this, r = this._urlRouter; if (Zt(t)) r.otherwise(t); else { if (!Kt(t)) throw new Error("'rule' must be a string or function"); r.otherwise(function () { return t(ae.$injector, e._router.locationService) }) } return this }, t.prototype.when = function (e, r) { return (te(r) || Kt(r)) && (r = t.injectableHandler(this._router, r)), this._urlRouter.when(e, r), this }, t.injectableHandler = function (t, e) { return function (r) { return ae.$injector.invoke(e, null, { $match: r, $stateParams: t.globals.params }) } }, t.prototype.deferIntercept = function (t) { this._urlRouter.deferIntercept(t) }, t }(); It.module("ui.router.angular1", []); var ci = It.module("ui.router.init", []), fi = It.module("ui.router.util", ["ng", "ui.router.init"]), li = It.module("ui.router.router", ["ui.router.util"]), hi = It.module("ui.router.state", ["ui.router.router", "ui.router.util", "ui.router.angular1"]), pi = It.module("ui.router", ["ui.router.init", "ui.router.state", "ui.router.angular1"]), di = (It.module("ui.router.compat", ["ui.router"]), null); yt.$inject = ["$locationProvider"]; var vi = function (t) { return ["$uiRouterProvider", function (e) { var r = e.router[t]; return r.$get = function () { return r }, r }] }; gt.$inject = ["$injector", "$q", "$uiRouter"]; _t.$inject = ["$rootScope"], ci.provider("$uiRouter", yt), li.provider("$urlRouter", ["$uiRouterProvider", function (t) { return t.urlRouterProvider = new si(t) }]), fi.provider("$urlService", vi("urlService")), fi.provider("$urlMatcherFactory", ["$uiRouterProvider", function () { return di.urlMatcherFactory }]), fi.provider("$templateFactory", function () { return new ri }), hi.provider("$stateRegistry", vi("stateRegistry")), hi.provider("$uiRouterGlobals", vi("globals")), hi.provider("$transitions", vi("transitionService")), hi.provider("$state", ["$uiRouterProvider", function () { return he(di.stateProvider, { $get: function () { return di.stateService } }) }]), hi.factory("$stateParams", ["$uiRouter", function (t) { return t.globals.params }]), pi.factory("$view", function () { return di.viewService }), pi.service("$trace", function () { return Be }), pi.run(_t), fi.run(["$urlMatcherFactory", function (t) { }]), hi.run(["$state", function (t) { }]), li.run(["$urlRouter", function (t) { }]), ci.run(gt); var mi, yi = function (t) { return t.getTokens().filter(Zt).map(function (e) { var r = t.getResolvable(e); return [e, "NOWAIT" === t.getPolicy(r).async ? r.promise : r.data] }).reduce(C, {}) }; mi = ["$uiRouter", "$timeout", function (t, e) { var r = t.stateService; return { restrict: "A", require: ["?^uiSrefActive", "?^uiSrefActiveEq"], link: function (n, i, o, a) { function u() { var t = p(); l && l(), f && (l = f.$$addStateInfo(t.uiState, t.uiStateParams)), null != t.href && o.$set(c.attr, t.href) } var s, c = bt(i), f = a[1] || a[0], l = null, h = {}, p = function () { return St(r, i, h) }, d = wt(o.uiSref); h.uiState = d.state, h.uiStateOpts = o.uiSrefOpts ? n.$eval(o.uiSrefOpts) : {}, d.paramExpr && (n.$watch(d.paramExpr, function (t) { h.uiStateParams = he({}, t), u() }, !0), h.uiStateParams = he({}, n.$eval(d.paramExpr))), u(), n.$on("$destroy", t.stateRegistry.onStatesChanged(u)), n.$on("$destroy", t.transitionService.onSuccess({}, u)), c.clickable && (s = Rt(i, r, e, c, p), Tt(i, n, s, h.uiStateOpts)) } } }]; var gi; gi = ["$uiRouter", "$timeout", function (t, e) { var r = t.stateService; return { restrict: "A", require: ["?^uiSrefActive", "?^uiSrefActiveEq"], link: function (n, i, o, a) { function u() { var t = d(); h && h(), f && (h = f.$$addStateInfo(t.uiState, t.uiStateParams)), null != t.href && o.$set(c.attr, t.href) } var s, c = bt(i), f = a[1] || a[0], h = null, p = {}, d = function () { return St(r, i, p) }, v = ["uiState", "uiStateParams", "uiStateOpts"], m = v.reduce(function (t, e) { return t[e] = l, t }, {}); v.forEach(function (t) { p[t] = o[t] ? n.$eval(o[t]) : null, o.$observe(t, function (e) { m[t](), m[t] = n.$watch(e, function (e) { p[t] = e, u() }, !0) }) }), u(), n.$on("$destroy", t.stateRegistry.onStatesChanged(u)), n.$on("$destroy", t.transitionService.onSuccess({}, u)), c.clickable && (s = Rt(i, r, e, c, d), Tt(i, n, s, p.uiStateOpts)) } } }]; var _i; _i = ["$state", "$stateParams", "$interpolate", "$uiRouter", function (t, e, r, n) { return { restrict: "A", controller: ["$scope", "$element", "$attrs", function (e, i, o) { function a(t) { t.promise.then(s, l) } function u(e, r, n) { var o = { state: t.get(e, $t(i)) || { name: e }, params: r, activeClass: n }; return p.push(o), function () { me(p)(o) } } function s() { var r = function (t) { return t.split(/\s/).filter(f) }, n = function (t) { return t.map(function (t) { return t.activeClass }).map(r).reduce(Re, []) }, o = n(p).concat(r(c)).reduce(Te, []), a = n(p.filter(function (e) { return t.includes(e.state.name, e.params) })), u = !!p.filter(function (e) { return t.is(e.state.name, e.params) }).length ? r(c) : [], s = a.concat(u).reduce(Te, []), l = o.filter(function (t) { return !ve(s, t) }); e.$evalAsync(function () { s.forEach(function (t) { return i.addClass(t) }), l.forEach(function (t) { return i.removeClass(t) }) }) } var c, h, p = []; c = r(o.uiSrefActiveEq || "", !1)(e); try { h = e.$eval(o.uiSrefActive) } catch (t) { } h = h || r(o.uiSrefActive || "", !1)(e), Xt(h) && le(h, function (t, r) { if (Zt(t)) { var n = wt(t); u(n.state, e.$eval(n.paramExpr), r) } }), this.$$addStateInfo = function (t, e) { if (!(Xt(h) && p.length > 0)) { var r = u(t, e, h); return s(), r } }, e.$on("$stateChangeSuccess", s), e.$on("$destroy", n.transitionService.onStart({}, a)), n.globals.transition && a(n.globals.transition), s() }] } }], It.module("ui.router.state").directive("uiSref", mi).directive("uiSrefActive", _i).directive("uiSrefActiveEq", _i).directive("uiState", gi), Ct.$inject = ["$state"], Pt.$inject = ["$state"], It.module("ui.router.state").filter("isState", Ct).filter("includedByState", Pt); var wi; wi = ["$view", "$animate", "$uiViewScroll", "$interpolate", "$q", function (t, e, r, n, i) { function o(t, r) { return { enter: function (t, r, n) { It.version.minor > 2 ? e.enter(t, null, r).then(n) : e.enter(t, null, r, n) }, leave: function (t, r) { It.version.minor > 2 ? e.leave(t).then(r) : e.leave(t, r) } } } function a(t, e) { return t === e } var u = { $cfg: { viewDecl: { $context: t._pluginapi._rootViewContext() } }, $uiView: {} }, s = { count: 0, restrict: "ECA", terminal: !0, priority: 400, transclude: "element", compile: function (e, c, f) { return function (e, c, l) { function h() { if (d && (Be.traceUIViewEvent("Removing (previous) el", d.data("$uiView")), d.remove(), d = null), m && (Be.traceUIViewEvent("Destroying scope", R), m.$destroy(), m = null), v) { var t = v.data("$uiViewAnim"); Be.traceUIViewEvent("Animate out", t), w.leave(v, function () { t.$$animLeave.resolve(), d = null }), d = v, v = null } } function p(t) { var n = e.$new(), o = i.defer(), a = i.defer(), u = { $cfg: t, $uiView: R }, s = { $animEnter: o.promise, $animLeave: a.promise, $$animLeave: a }; n.$emit("$viewContentLoading", b); var l = f(n, function (t) { t.data("$uiViewAnim", s), t.data("$uiView", u), w.enter(t, c, function () { o.resolve(), m && m.$emit("$viewContentAnimationEnded"), (zt(_) && !_ || e.$eval(_)) && r(t) }), h() }); v = l, (m = n).$emit("$viewContentLoaded", t || $), m.$eval(g) } var d, v, m, y, g = l.onload || "", _ = l.autoscroll, w = o(), $ = void 0, S = c.inheritedData("$uiView") || u, b = n(l.uiView || l.name || "")(e) || "$default", R = { $type: "ng1", id: s.count++, name: b, fqn: S.$uiView.fqn ? S.$uiView.fqn + "." + b : b, config: null, configUpdated: function (t) { (!t || t instanceof ei) && (a($, t) || (Be.traceUIViewConfigUpdated(R, t && t.viewDecl && t.viewDecl.$context), $ = t, p(t))) }, get creationContext() { var t = At("$cfg.viewDecl.$context")(S), e = At("$uiView.creationContext")(S); return t || e } }; Be.traceUIViewEvent("Linking", R), c.data("$uiView", { $uiView: R }), p(), y = t.registerUIView(R), e.$on("$destroy", function () { Be.traceUIViewEvent("Destroying/Unregistering", R), y() }) } } }; return s }], kt.$inject = ["$compile", "$controller", "$transitions", "$view", "$q", "$timeout"]; var $i = "function" == typeof It.module("ui.router").component, Si = 0; It.module("ui.router.state").directive("uiView", wi), It.module("ui.router.state").directive("uiView", kt), It.module("ui.router.state").provider("$uiViewScroll", function () { var t = !1; this.useAnchorScroll = function () { t = !0 }, this.$get = ["$anchorScroll", "$timeout", function (e, r) { return t ? e : function (t) { return r(function () { t[0].scrollIntoView() }, 0, !1) } }] }); t.default = "ui.router", t.core = Zn, t.watchDigests = _t, t.getLocals = yi, t.getNg1ViewConfigFactory = dt, t.ng1ViewsBuilder = vt, t.Ng1ViewConfig = ei, t.StateProvider = oi, t.UrlRouterProvider = si, t.root = ue, t.fromJson = ce, t.toJson = fe, t.forEach = le, t.extend = he, t.equals = pe, t.identity = f, t.noop = l, t.createProxyFunctions = h, t.inherit = de, t.inArray = ve, t._inArray = p, t.removeFrom = me, t._removeFrom = d, t.pushTo = ye, t._pushTo = v, t.deregAll = ge, t.defaults = m, t.mergeR = _e, t.ancestors = y, t.pick = g, t.omit = _, t.pluck = w, t.filter = $, t.find = S, t.mapObj = we, t.map = b, t.values = $e, t.allTrueR = Se, t.anyTrueR = be, t.unnestR = Re, t.flattenR = Ee, t.pushR = R, t.uniqR = Te, t.unnest = Ce, t.flatten = Pe, t.assertPredicate = ke, t.assertMap = Oe, t.assertFn = E, t.pairs = xe, t.arrayTuples = T, t.applyPairs = C, t.tail = P, t.copy = k, t._extend = O, t.silenceUncaughtInPromise = Ie, t.silentRejection = je, t.notImplemented = oe, t.services = ae, t.Glob = Lt, t.curry = r, t.compose = n, t.pipe = i, t.prop = jt, t.propEq = Vt, t.parse = At, t.not = Ht, t.and = o, t.or = a, t.all = qt, t.any = Dt, t.is = Ft, t.eq = Nt, t.val = Ut, t.invoke = u, t.pattern = s, t.isUndefined = Wt, t.isDefined = zt, t.isNull = Jt, t.isNullOrUndefined = Qt, t.isFunction = Kt, t.isNumber = Yt, t.isString = Zt, t.isObject = Xt, t.isArray = te, t.isDate = ee, t.isRegExp = re, t.isState = ne, t.isInjectable = c, t.isPromise = ie, t.Queue = Ve, t.maxLength = M, t.padString = B, t.kebobString = G, t.functionToString = W, t.fnToString = z, t.stringify = J, t.beforeAfterSubstr = vr, t.hostRegex = mr, t.stripFile = yr, t.splitHash = gr, t.splitQuery = _r, t.splitEqual = wr, t.trimHashVal = $r, t.splitOnDelim = Q, t.joinNeighborsR = K, t.Trace = Me, t.trace = Be, t.Param = Xe, t.ParamTypes = Sr, t.StateParams = Rr, t.ParamType = Ke, t.PathNode = tr, t.PathUtils = er, t.resolvePolicies = ir, t.defaultResolvePolicy = rr, t.Resolvable = nr, t.NATIVE_INJECTOR_TOKEN = sr, t.ResolveContext = cr, t.resolvablesBuilder = rt, t.StateBuilder = kr, t.StateObject = Mt, t.StateMatcher = Or, t.StateQueueManager = xr, t.StateRegistry = Ir, t.StateService = On, t.TargetState = Ge, t.HookBuilder = Qe, t.matchState = A, t.RegisteredHook = Je, t.makeEvent = H, t.Rejection = He, t.Transition = hr, t.TransitionHook = ze, t.TransitionEventType = En, t.defaultTransOpts = Pn, t.TransitionService = kn, t.UrlMatcher = Ar, t.UrlMatcherFactory = Hr, t.UrlRouter = Mr, t.UrlRuleFactory = qr, t.BaseUrlRule = Dr, t.UrlService = Zr, t.ViewService = Br, t.UIRouterGlobals = Gr, t.UIRouter = tn, t.$q = xn, t.$injector = An, t.BaseLocationServices = Fn, t.HashLocationService = Un, t.MemoryLocationService = Mn, t.PushStateLocationService = Gn, t.MemoryLocationConfig = Wn, t.BrowserLocationConfig = zn, t.keyValsToObjectR = Hn, t.getParams = qn, t.parseUrl = lt, t.buildUrl = Dn, t.locationPluginFactory = ht, t.servicesPlugin = pt, t.hashLocationPlugin = Jn, t.pushStateLocationPlugin = Qn, t.memoryLocationPlugin = Kn, t.UIRouterPluginBase = Yn, Object.defineProperty(t, "__esModule", { value: !0 }) });
//# sourceMappingURL=angular-ui-router.min.js.map
(function () {
var module = angular.module('multi-transclude', []);
var Ctrl = ['$scope', '$element', '$transclude', function ($scope, $element, $transclude) {
// Ensure we're transcluding or nothing will work.
if (!$transclude) {
throw new Error(
'Illegal use of ngMultiTransclude controller. No directive ' +
'that requires a transclusion found.'
);
}
// There's not a good way to ask Angular to give you the closest
// controller from a list of controllers, we get all multi-transclude
// controllers and select the one that is the child of the other.
this.$element = $element;
this.isChildOf = function (otherCtrl) {
return otherCtrl.$element[0].contains(this.$element[0]);
};
// Destination for transcluded content.
var toTransclude;
$scope.$on('$destroy', function () {
if (toTransclude) {
toTransclude.remove();
toTransclude = null;
}
});
// A temporary container for transcluded content, so that content will not
// be detached from the DOM during link. This ensures that controllers and
// other data parent nodes are accessible within the transcluded content.
var transcludeContainer = angular.element('
');
// Transclude content that matches name into element.
this.transclude = function (name, element) {
for (var i = 0; i < toTransclude.length; ++i) {
// Uses the argument as the `name` attribute directly, but we could
// evaluate it or interpolate it or whatever.
var el = angular.element(toTransclude[i]);
if (el.attr('name') === name) {
element.empty();
element.append(el);
return;
}
}
};
// Should be called after all transclusions are complete to clean up the
// temporary container.
this.transcluded = function () {
if (transcludeContainer) {
transcludeContainer.remove();
transcludeContainer = null;
}
};
// Transclude content and keep track of it; be sure to keep it in the DOM
// by attaching it to `$element`.
$transclude(function (clone) {
toTransclude = clone;
transcludeContainer.append(clone);
$element.append(transcludeContainer);
});
}];
module.directive('ngMultiTemplate', function () {
return {
transclude: true,
templateUrl: function (element, attrs) {
return attrs.ngMultiTemplate;
},
controller: Ctrl,
link: function (scope, element, attrs, ctrl) {
ctrl.transcluded();
}
};
});
module.directive('ngMultiTranscludeController', function () {
return {
controller: Ctrl,
link: function (scope, element, attrs, ctrl) {
ctrl.transcluded();
}
};
});
module.directive('ngMultiTransclude', function () {
return {
require: ['?^ngMultiTranscludeController', '?^ngMultiTemplate'],
link: function (scope, element, attrs, ctrls) {
// Find the deepest controller (closes to this element).
var ctrl1 = ctrls[0];
var ctrl2 = ctrls[1];
var ctrl;
if (ctrl1 && ctrl2) {
ctrl = ctrl1.isChildOf(ctrl2) ? ctrl1 : ctrl2;
}
else {
ctrl = ctrl1 || ctrl2;
}
// A multi-transclude parent directive must be present.
if (!ctrl) {
throw new Error('Illegal use of ngMultiTransclude. No wrapping controller.')
}
// Receive transcluded content.
ctrl.transclude(attrs.ngMultiTransclude, element);
}
};
});
})();
angular.module('ui.knob', []).directive('knob', ['$timeout', function($timeout) {
'use strict';
return {
restrict: 'EA',
replace: true,
template: '
',
scope: {
knobData: '=',
knobOptions: '&'
},
link: function($scope, $element) {
var knobInit = $scope.knobOptions() || {};
knobInit.release = function(newValue) {
$timeout(function() {
$scope.knobData = newValue;
$scope.$apply();
});
};
$scope.$watch('knobData', function(newValue, oldValue) {
if (newValue != oldValue) {
$($element).val(newValue).change();
}
});
$($element).val($scope.knobData).knob(knobInit);
}
};
}]);
!function () { "use strict"; var module = angular.module("sticky", []); module.directive("sticky", ["$window", "$timeout", function ($window, $timeout) { return { restrict: "A", scope: { disabled: "=disabledSticky" }, link: function ($scope, $elem, $attrs) { function initSticky() { shouldInitialize && (scrollbarElement.on("scroll", checkIfShouldStick), windowElement.on("resize", $onResize), memorizeDimensions(), $scope.$watch(onDigest, onChange), $scope.$on("$destroy", onDestroy), shouldInitialize = !1) } function memorizeDimensions() { initialCSS = $scope.getInitialDimensions(), isStickyLayoutDeferred && ($elem[0].getBoundingClientRect().height || (onStickyHeighUnbind = $scope.$watch(function () { return $elem.height() }, function (newValue, oldValue) { newValue > 0 && (initialCSS = $scope.getInitialDimensions(), isStickyLayoutWatched || onStickyHeighUnbind()) }))) } function deriveScrollingViewport(stickyNode) { var match = findAncestorTag(scrollableNodeTagName, stickyNode); return 1 === match.length ? match[0] : $window } function findAncestorTag(tag, context) { var p, m = [], n = context.parent(); do { var node = n[0]; if (1 !== node.nodeType) break; if (node.tagName.toUpperCase() === tag.toUpperCase()) return n; p = n.parent(), n = p } while (0 !== p.length); return m } function shouldStickWithLimit(shouldApplyWithLimit) { return "true" === shouldApplyWithLimit ? $window.innerHeight - ($elem[0].offsetHeight + parseInt(offset)) < 0 : !1 } function getClosest(scrollTop, stickyLine, stickyBottomLine) { var closest = "top", topDistance = Math.abs(scrollTop - stickyLine), bottomDistance = Math.abs(scrollTop - stickyBottomLine); return topDistance > bottomDistance && (closest = "bottom"), closest } function unStickElement(fromDirection) { initialStyle && $elem.attr("style", initialStyle), isSticking = !1, initialCSS.width = $scope.getInitialDimensions().width, $body.removeClass(bodyClass), $elem.removeClass(stickyClass), $elem.addClass(unstickyClass), "top" === fromDirection ? ($elem.removeClass(bottomClass), $elem.css("z-index", 10).css("width", initialCSS.width).css("top", initialCSS.top).css("position", initialCSS.position).css("left", initialCSS.cssLeft).css("margin-top", initialCSS.marginTop).css("height", initialCSS.height)) : "bottom" === fromDirection && confine === !0 && ($elem.addClass(bottomClass), createPlaceholder(), $elem.css("z-index", 10).css("width", initialCSS.width).css("top", "").css("bottom", 0).css("position", "absolute").css("left", initialCSS.cssLeft).css("margin-top", initialCSS.marginTop).css("margin-bottom", initialCSS.marginBottom).css("height", initialCSS.height)), placeholder && fromDirection === anchor && placeholder.remove() } function stickElement(closestLine) { isSticking = !0, $timeout(function () { initialCSS.offsetWidth = $elem[0].offsetWidth }, 0), $body.addClass(bodyClass), $elem.removeClass(unstickyClass), $elem.removeClass(bottomClass), $elem.addClass(stickyClass), createPlaceholder(), $elem.css("z-index", "10").css("width", $elem[0].offsetWidth + "px").css("position", "fixed").css("left", $elem.css("left").replace("px", "") + "px").css(anchor, offset + elementsOffsetFromTop(scrollbar) + "px").css("margin-top", 0), "bottom" === anchor && $elem.css("margin-bottom", 0) } function onResize() { unStickElement(anchor), checkIfShouldStick() } function createPlaceholder() { if (usePlaceholder) { placeholder && placeholder.remove(), placeholder = angular.element("
"); var elementsHeight = $elem[0].offsetHeight, computedStyle = $elem[0].currentStyle || window.getComputedStyle($elem[0]); elementsHeight += parseInt(computedStyle.marginTop, 10), elementsHeight += parseInt(computedStyle.marginBottom, 10), elementsHeight += parseInt(computedStyle.borderTopWidth, 10), elementsHeight += parseInt(computedStyle.borderBottomWidth, 10), placeholder.css("height", $elem[0].offsetHeight + "px"), $elem.after(placeholder) } } function isBottomedOut() { return !!(confine && scrollbarYPos() > stickyBottomLine) } function elementsOffsetFromTop(element) { var offset = 0; return element.getBoundingClientRect && (offset = element.getBoundingClientRect().top), offset } function scrollbarYPos() { var position; return position = "undefined" != typeof scrollbar.scrollTop ? scrollbar.scrollTop : "undefined" != typeof scrollbar.pageYOffset ? scrollbar.pageYOffset : document.documentElement.scrollTop } function scrollbarHeight() { var height; return height = scrollbarElement[0] instanceof HTMLElement ? $window.getComputedStyle(scrollbarElement[0], null).getPropertyValue("height").replace(/px;?/, "") : $window.innerHeight, parseInt(height) || 0 } function mediaQueryMatches() { var mediaQuery = $attrs.mediaQuery || !1, matchMedia = $window.matchMedia; return mediaQuery && !(matchMedia("(" + mediaQuery + ")").matches || matchMedia(mediaQuery).matches) } function getCSS($el, prop) { var val, el = $el[0], computed = window.getComputedStyle(el), prevDisplay = computed.display; return el.style.display = "none", val = computed[prop], el.style.display = prevDisplay, val } var onStickyHeighUnbind, originalInitialCSS, originalOffset, placeholder, stickyLine, initialCSS, scrollableNodeTagName = "sticky-scroll", initialPosition = $elem.css("position"), initialStyle = $elem.attr("style") || "", stickyBottomLine = 0, isSticking = !1, stickyClass = $attrs.stickyClass || "", unstickyClass = $attrs.unstickyClass || "", bodyClass = $attrs.bodyClass || "", bottomClass = $attrs.bottomClass || "", scrollbar = deriveScrollingViewport($elem), windowElement = angular.element($window), scrollbarElement = angular.element(scrollbar), $body = angular.element(document.body), $onResize = function () { $scope.$root && !$scope.$root.$$phase ? $scope.$apply(onResize) : onResize() }, usePlaceholder = "false" !== $attrs.usePlaceholder, anchor = "bottom" === $attrs.anchor ? "bottom" : "top", confine = "true" === $attrs.confine, isStickyLayoutDeferred = void 0 !== $attrs.isStickyLayoutDeferred ? "true" === $attrs.isStickyLayoutDeferred : !1, isStickyLayoutWatched = void 0 !== $attrs.isStickyLayoutWatched ? "true" === $attrs.isStickyLayoutWatched : !0, offset = $attrs.offset ? parseInt($attrs.offset.replace(/px;?/, "")) : 0, shouldInitialize = !0, checkIfShouldStick = function () { if ($scope.disabled === !0 || mediaQueryMatches()) return isSticking && unStickElement(), !1; var shouldStick, scrollbarPosition = scrollbarYPos(); shouldStick = "top" === anchor ? confine === !0 ? scrollbarPosition > stickyLine && stickyBottomLine >= scrollbarPosition : scrollbarPosition > stickyLine : stickyLine >= scrollbarPosition; var closestLine = getClosest(scrollbarPosition, stickyLine, stickyBottomLine); !shouldStick || shouldStickWithLimit($attrs.stickLimit) || isSticking ? !shouldStick && isSticking ? unStickElement(closestLine, scrollbarPosition) : confine && !shouldStick && (originalOffset = elementsOffsetFromTop($elem[0]), unStickElement(closestLine, scrollbarPosition)) : stickElement(closestLine) }, onDestroy = function () { scrollbarElement.off("scroll", checkIfShouldStick), windowElement.off("resize", $onResize), $onResize = null, $body.removeClass(bodyClass), placeholder && placeholder.remove() }, onDigest = function () { if ($scope.disabled === !0) return unStickElement(); var offsetFromTop = elementsOffsetFromTop($elem[0]); return 0 === offsetFromTop ? offsetFromTop : "top" === anchor ? (originalOffset || offsetFromTop) - elementsOffsetFromTop(scrollbar) + scrollbarYPos() : offsetFromTop - scrollbarHeight() + $elem[0].offsetHeight + scrollbarYPos() }, onChange = function (newVal, oldVal) { var elemIsShowed = !!newVal, elemWasHidden = !oldVal, valChange = newVal !== oldVal || "undefined" == typeof stickyLine, notSticking = !isSticking && !isBottomedOut(); if (valChange && notSticking && newVal > 0 && elemIsShowed) { stickyLine = newVal - offset, elemIsShowed && elemWasHidden && $scope.updateStickyContentUpdateDimensions($elem[0].offsetWidth, $elem[0].offsetHeight), confine && $elem.parent().css({ position: "relative" }); var parent = $elem.parent()[0], parentHeight = parseInt(parent.offsetHeight) - (usePlaceholder ? 0 : $elem[0].offsetHeight), marginBottom = parseInt($elem.css("margin-bottom").replace(/px;?/, "")) || 0, elementsDistanceFromTop = elementsOffsetFromTop($elem[0]), parentsDistanceFromTop = elementsOffsetFromTop(parent), scrollbarDistanceFromTop = elementsOffsetFromTop(scrollbar), elementsDistanceFromScrollbarStart = elementsDistanceFromTop - scrollbarDistanceFromTop, elementsDistanceFromBottom = parentsDistanceFromTop + parentHeight - elementsDistanceFromTop; stickyBottomLine = elementsDistanceFromScrollbarStart + elementsDistanceFromBottom - $elem[0].offsetHeight - marginBottom - offset + +scrollbarYPos(), checkIfShouldStick() } }; $scope.getElement = function () { return $elem }, $scope.getScrollbar = function () { return scrollbar }, $scope.getInitialCSS = function () { return initialCSS }, $scope.getAnchor = function () { return anchor }, $scope.isSticking = function () { return isSticking }, $scope.getOriginalInitialCSS = function () { return originalInitialCSS }, $scope.processUnStickElement = function (anchor) { unStickElement(anchor) }, $scope.processCheckIfShouldStick = function () { checkIfShouldStick() }, $scope.getInitialDimensions = function () { return { zIndex: $elem.css("z-index"), top: $elem.css("top"), position: initialPosition, marginTop: $elem.css("margin-top"), marginBottom: $elem.css("margin-bottom"), cssLeft: getCSS($elem, "left"), width: $elem[0].offsetWidth, height: $elem.css("height") } }, $scope.updateStickyContentUpdateDimensions = function (width, height) { width && height && (initSticky(), initialCSS.width = width + "px", initialCSS.height = height + "px") }, $timeout(function () { originalInitialCSS = $scope.getInitialDimensions(), initSticky() }, 0) }, controller: ["$scope", "$window", function ($scope, $window) { this.resetLayout = function (newWidth, newHeight) { function _resetScrollPosition() { "top" === anchor && (scrollbar === $window ? $window.scrollTo(0, 0) : scrollbar.scrollTop > 0 && (scrollbar.scrollTop = 0)) } var scrollbar = $scope.getScrollbar(), initialCSS = $scope.getInitialCSS(), anchor = $scope.getAnchor(); if ($scope.isSticking() && ($scope.processUnStickElement(anchor), $scope.processCheckIfShouldStick()), $scope.getElement().css({ width: "", height: "", position: "", top: "", zIndex: "" }), initialCSS.position = $scope.getOriginalInitialCSS().position, delete initialCSS.offsetWidth, void 0 === newWidth && void 0 === newHeight) { var e_bcr = $scope.getElement()[0].getBoundingClientRect(); newWidth = e_bcr.width, newHeight = e_bcr.height } $scope.updateStickyContentUpdateDimensions(newWidth, newHeight), _resetScrollPosition() }, this.getScrollbar = function () { return $scope.getScrollbar() } }] } }]), window.matchMedia = window.matchMedia || function () { var warning = "angular-sticky: This browser does not support matchMedia, therefore the minWidth option will not work on this browser. Polyfill matchMedia to fix this issue."; return window.console && console.warn && console.warn(warning), function () { return { matches: !0 } } }() }();
(function () {
'use strict';
/*
* Angular matchMedia Module
* Version 0.6.0
* Uses Bootstrap 3 breakpoint sizes
* Exposes service "screenSize" which returns true if breakpoint(s) matches.
* Includes matchMedia polyfill for backward compatibility.
* Copyright © Jack Tarantino
.
**/
var app = angular.module('matchMedia', []);
app.run(function initializeNgMatchMedia() {
/*! matchMedia() polyfill - Test a CSS media type/query in JS.
* Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight.
* Dual MIT/BSD license
**/
window.matchMedia || (window.matchMedia = function matchMediaPolyfill() {
// For browsers that support matchMedium api such as IE 9 and webkit
var styleMedia = (window.styleMedia || window.media);
// For those that don't support matchMedium
if (!styleMedia) {
var style = document.createElement('style'),
script = document.getElementsByTagName('script')[0],
info = null;
style.type = 'text/css';
style.id = 'matchmediajs-test';
script.parentNode.insertBefore(style, script);
// 'style.currentStyle' is used by IE <= 8
// 'window.getComputedStyle' for all other browsers
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
styleMedia = {
matchMedium: function (media) {
var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
// 'style.styleSheet' is used by IE <= 8
// 'style.textContent' for all other browsers
if (style.styleSheet) {
style.styleSheet.cssText = text;
} else {
style.textContent = text;
}
// Test if media query is true or false
return info.width === '1px';
}
};
}
return function (media) {
return {
matches: styleMedia.matchMedium(media || 'all'),
media: media || 'all'
};
};
}());
});
//Service to use in controllers
app.service('screenSize', screenSize);
screenSize.$inject = ['$rootScope'];
function screenSize($rootScope) {
var defaultRules = {
lg: '(min-width: 1200px)',
md: '(min-width: 992px) and (max-width: 1199px)',
sm: '(min-width: 768px) and (max-width: 991px)',
xs: '(max-width: 767px)'
};
this.isRetina = (
window.devicePixelRatio > 1 ||
(window.matchMedia && window.matchMedia('(-webkit-min-device-pixel-ratio: 1.5),(-moz-min-device-pixel-ratio: 1.5),(min-device-pixel-ratio: 1.5),(min-resolution: 192dpi),(min-resolution: 2dppx)').matches)
);
var that = this;
// Executes Angular $apply in a safe way
var safeApply = function (fn, scope) {
scope = scope || $rootScope;
var phase = scope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn && (typeof (fn) === 'function')) {
fn();
}
} else {
scope.$apply(fn);
}
};
// Validates that we're getting a string or array.
// When string: converts string(comma seperated) to an array.
var assureList = function (list) {
if (typeof list !== 'string' && Object.prototype.toString.call(list) !== '[object Array]') {
throw new Error('screenSize requires array or comma-separated list');
}
return typeof list === 'string' ? list.split(/\s*,\s*/) : list;
};
var getCurrentMatch = function () {
var rules = that.rules || defaultRules;
for (var property in rules) {
if (rules.hasOwnProperty(property)) {
if (window.matchMedia(rules[property]).matches) {
return property;
}
}
}
};
// Return the actual size (it's string name defined in the rules)
this.get = getCurrentMatch;
this.restoreDefaultRules = function () {
this.rules = angular.extend({}, defaultRules);
};
this.restoreDefaultRules();
this.is = function (list) {
list = assureList(list);
return list.indexOf(getCurrentMatch()) !== -1;
};
// Executes the callback function on window resize with the match truthiness as the first argument.
// Returns the current match truthiness.
// The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used.
this.on = function (list, callback, scope) {
window.addEventListener('resize', listenerFunc);
if (scope) {
scope.$on('$destroy', function () {
window.removeEventListener('resize', listenerFunc);
});
}
return that.is(list);
function listenerFunc() {
safeApply(callback(that.is(list)), scope);
}
};
// Executes the callback function ONLY when the match differs from previous match.
// Returns the current match truthiness.
// The 'scope' parameter is required for cleanup reasons (destroy event).
this.onChange = function (scope, list, callback) {
var currentMatch = getCurrentMatch();
list = assureList(list);
if (!scope) {
throw 'scope has to be applied for cleanup reasons. (destroy)';
}
window.addEventListener('resize', listenerFunc);
scope.$on('$destroy', function () {
window.removeEventListener('resize', listenerFunc);
});
return that.is(list);
function listenerFunc() {
var previousMatch = currentMatch;
currentMatch = getCurrentMatch();
var wasPreviousMatch = list.indexOf(previousMatch) !== -1;
var doesCurrentMatch = list.indexOf(currentMatch) !== -1;
if (wasPreviousMatch !== doesCurrentMatch) {
safeApply(callback(doesCurrentMatch), scope);
}
}
};
// Executes the callback function ONLY when the matched rule changes.
// Returns the current match rule name.
// The 'scope' parameter is required for cleanup reasons (destroy event).
this.onRuleChange = function (scope, callback) {
var currentMatch = getCurrentMatch();
if (!scope) {
throw 'scope has to be applied for cleanup reasons. (destroy)';
}
window.addEventListener('resize', listenerFunc);
scope.$on('$destroy', function () {
window.removeEventListener('resize', listenerFunc);
});
return currentMatch;
function listenerFunc() {
var previousMatch = currentMatch;
currentMatch = getCurrentMatch();
if (previousMatch !== currentMatch) {
safeApply(callback(currentMatch), scope);
}
}
};
// Executes the callback only when inside of the particular screensize.
// The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used.
this.when = function (list, callback, scope) {
window.addEventListener('resize', listenerFunc);
if (scope) {
scope.$on('$destroy', function () {
window.removeEventListener('resize', listenerFunc);
});
}
return that.is(list);
function listenerFunc() {
if (that.is(list) === true) {
safeApply(callback(that.is(list)), scope);
}
}
};
}
app.filter('media', ['screenSize', function (screenSize) {
var mediaFilter = function (inputValue, options) {
// Get actual size
var size = screenSize.get();
// Variable for the value being return (either a size/rule name or a group name)
var returnedName = '';
if (!options) {
// Return the size/rule name
return size;
}
// Replace placeholder with group name in input value
if (options.groups) {
for (var prop in options.groups) {
if (options.groups.hasOwnProperty(prop)) {
var index = options.groups[prop].indexOf(size);
if (index >= 0) {
returnedName = prop;
}
}
}
// If no group name is found for size use the size itself
if (returnedName === '') {
returnedName = size;
}
}
// Replace or return size/rule name?
if (options.replace && typeof options.replace === 'string' && options.replace.length > 0) {
return inputValue.replace(options.replace, returnedName);
} else {
return returnedName;
}
};
// Since AngularJS 1.3, filters which are not stateless (depending at the scope)
// have to explicit define this behavior.
mediaFilter.$stateful = true;
return mediaFilter;
}]);
})();
!function () { "use strict"; var t = "ngMaterialDatePicker", e = { DATE: 0, HOUR: 1, MINUTE: 2 }, a = function (t, e) { return t = angular.element(t), "getComputedStyle" in window ? window.getComputedStyle(t[0])[e] : t.css(e) }, i = ' {{picker.currentDate.format("MMM") | uppercase}}
{{picker.currentDate.format("DD")}}
▲
{{picker.currentDate.format("YYYY")}}
▼
{{picker.currentNearest5Minute().format(picker.params.shortTime ? "hh:mm" : "HH:mm")}}
{{picker.currentNearest5Minute().format(picker.params.shortTime ? "hh:mm" : "HH:mm")}}
{{picker.params.todayText}} {{picker.params.cancelText}} {{picker.params.okText}} '; angular.module(t, ["ngMaterial"]).provider("mdcDatetimePickerDefaultLocale", function () { this.locale = window.navigator.userLanguage || window.navigator.language || "en", this.$get = function () { return this }, this.setDefaultLocale = function (t) { this.locale = t } }).factory("mdcDefaultParams", ["mdcDatetimePickerDefaultLocale", function (t) { var e = { date: !0, time: !0, format: "YYYY-MM-DD", minDate: null, maxDate: null, currentDate: null, lang: t.locale, weekStart: 0, shortTime: !1, cancelText: "Cancel", okText: "OK", amText: "AM", pmText: "PM", todayText: "Today", disableDates: [] }; return e }]).directive("mdcDatetimePicker", ["$mdDialog", "$timeout", function (t, e) { return { restrict: "A", require: "ngModel", scope: { currentDate: "=ngModel", ngChange: "&", time: "=", date: "=", minDate: "=", maxDate: "=", disableDates: "=", shortTime: "=", weekStart: "=", format: "@", cancelText: "@", okText: "@", lang: "@", amText: "@", pmText: "@", showTodaysDate: "@", todayText: "@" }, link: function (a, n, s, c) { var o = !1; a.format || (a.date && a.time ? a.format = "YYYY-MM-DD HH:mm" : a.date ? a.format = "YYYY-MM-DD" : a.format = "HH:mm"); var l = null; void 0 !== a.showTodaysDate && "false" !== a.showTodaysDate && (l = moment()), angular.isString(a.currentDate) && "" !== a.currentDate && (a.currentDate = moment(a.currentDate, a.format)), c && c.$formatters.push(function (t) { if ("undefined" != typeof t) { var e = moment(t); return e.isValid() ? e.format(a.format) : "" } }), n.attr("readonly", ""), n.on("focus", function (c) { if (c.preventDefault(), n.blur(), !o) { o = !0; var d = {}; for (var u in s) a.hasOwnProperty(u) && !angular.isUndefined(a[u]) && (d[u] = a[u]); d.currentDate = a.currentDate, d.showTodaysDate = l; var m = { options: d }; t.show({ template: i, controller: r, controllerAs: "picker", locals: m, openFrom: n, parent: angular.element(document.body), bindToController: !0, disableParentScroll: !1, hasBackDrop: !1, skipHide: !0 }).then(function (t) { a.currentDate = t ? t._d : t, o = !1, moment(a.currentDate).isSame(d.currentDate) || e(a.ngChange, 0), n.blur() }, function () { o = !1, n.blur() }) } }) } } }]).factory("mdcDateTimeDialog", ["$mdDialog", "$q", "mdcDefaultParams", function (t, e, a) { var n = Object.keys(a); console.log(n); var s = { show: function (s) { var c = e.defer(), o = angular.copy(a); for (var l in s) n.indexOf[l] != -1 && s.hasOwnProperty(l) && (o = s[l]); var d = { options: s }; return t.show({ template: i, controller: r, controllerAs: "picker", locals: d, parent: angular.element(document.body), bindToController: !0, clickOutsideToClose: !0, disableParentScroll: !1, skipHide: !0 }).then(function (t) { t ? t._d : t; c.resolve(t ? t._d : t) }, function () { c.reject() }), c.promise } }; return s }]); var r = function (t, a, i) { this.currentView = e.DATE, this._dialog = a, this._attachedEvents = [], this.VIEWS = e, this.params = i, this.meridien = "AM", this.params = angular.extend(this.params, this.options), this.init() }; r.$inject = ["$scope", "$mdDialog", "mdcDefaultParams"], r.prototype = { init: function () { this.timeMode = this.params.time && !this.params.date, this.dateMode = this.params.date, this.initDates(), this.start() }, currentNearest5Minute: function () { var t = this.currentDate || moment(), e = 5 * Math.round(t.minute() / 5); return e >= 60 && (e = 55), moment(t).minutes(e) }, initDates: function () { var t = this, e = function (e, a) { var i = null; if (angular.isDefined(e) && null !== e && "" !== e) if (angular.isString(e)) i = "undefined" != typeof t.params.format && null !== t.params.format ? moment(e, t.params.format).locale(t.params.lang) : moment(e).locale(t.params.lang); else if ("number" == typeof e) i = moment(e).locale(t.params.lang); else if (angular.isDate(e)) { var r = e.getTime(); i = moment(r, "x").locale(t.params.lang) } else e._isAMomentObject && (i = e); else i = a; return i }; this.currentDate = e(this.params.currentDate, moment()), this.minDate = e(this.params.minDate), this.maxDate = e(this.params.maxDate), this.disableDates = this.params.disableDates.map(function (t) { return moment(t).format("MMMM Do YYYY") }), this.selectDate(this.currentDate) }, initDate: function () { this.currentView = e.DATE }, initHours: function () { this.currentView = e.HOUR }, initMinutes: function () { this.currentView = e.MINUTE }, isAfterMinDate: function (t, e, a) { var i = !0; if ("undefined" != typeof this.minDate && null !== this.minDate) { var r = moment(this.minDate), n = moment(t); e || a || (r.hour(0), r.minute(0), n.hour(0), n.minute(0)), r.second(0), n.second(0), r.millisecond(0), n.millisecond(0), a ? i = parseInt(n.format("X")) >= parseInt(r.format("X")) : (n.minute(0), r.minute(0), i = parseInt(n.format("X")) >= parseInt(r.format("X"))) } return i }, isBeforeMaxDate: function (t, e, a) { var i = !0; if ("undefined" != typeof this.maxDate && null !== this.maxDate) { var r = moment(this.maxDate), n = moment(t); e || a || (r.hour(0), r.minute(0), n.hour(0), n.minute(0)), r.second(0), n.second(0), r.millisecond(0), n.millisecond(0), a ? i = parseInt(n.format("X")) <= parseInt(r.format("X")) : (n.minute(0), r.minute(0), i = parseInt(n.format("X")) <= parseInt(r.format("X"))) } return i }, isInDisableDates: function (t) { var e = t.format("MMMM Do YYYY"); return !(this.disableDates.indexOf(e) > -1) }, selectDate: function (t) { t && (this.currentDate = moment(t), this.isAfterMinDate(this.currentDate) || (this.currentDate = moment(this.minDate)), this.isBeforeMaxDate(this.currentDate) || (this.currentDate = moment(this.maxDate)), this.currentDate.locale(this.params.lang), this.calendarStart = moment(this.currentDate), this.meridien = this.currentDate.hour() >= 12 ? "PM" : "AM") }, setName: function () { for (var t = "", e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", a = 0; a < 5; a++) t += e.charAt(Math.floor(Math.random() * e.length)); return t }, isPM: function () { return "PM" === this.meridien }, incrementYear: function (t) { 1 === t && this.isNextYearVisible() && this.selectDate(this.currentDate.add(t, "year")), t === -1 && this.isPreviousYearVisible() && this.selectDate(this.currentDate.add(t, "year")) }, isPreviousMonthVisible: function () { return this.calendarStart && this.isAfterMinDate(moment(this.calendarStart).startOf("month"), !1, !1) }, isNextMonthVisible: function () { return this.calendarStart && this.isBeforeMaxDate(moment(this.calendarStart).endOf("month"), !1, !1) }, isPreviousYearVisible: function () { return this.calendarStart && this.isAfterMinDate(moment(this.calendarStart).startOf("year"), !1, !1) }, isNextYearVisible: function () { return this.calendarStart && this.isBeforeMaxDate(moment(this.calendarStart).endOf("year"), !1, !1) }, isHourAvailable: function (t) { var e = moment(this.currentDate); return e.hour(this.convertHours(t)).minute(0).second(0), this.isAfterMinDate(e, !0, !1) && this.isBeforeMaxDate(e, !0, !1) }, isMinuteAvailable: function (t) { var e = moment(this.currentDate); return e.minute(t).second(0), this.isAfterMinDate(e, !0, !0) && this.isBeforeMaxDate(e, !0, !0) }, start: function () { this.currentView = e.DATE, this.params.date ? this.initDate() : this.params.time && this.initHours() }, today: function () { this.selectDate(Date.now()) }, ok: function () { switch (this.currentView) { case e.DATE: this.params.time === !0 ? this.initHours() : this.hide(!0); break; case e.HOUR: this.initMinutes(); break; case e.MINUTE: this.hide(!0) } }, cancel: function () { if (this.params.time) switch (this.currentView) { case e.DATE: this.hide(); break; case e.HOUR: this.params.date ? this.initDate() : this.hide(); break; case e.MINUTE: this.initHours() } else this.hide() }, selectMonthBefore: function () { this.calendarStart.subtract(1, "months") }, selectMonthAfter: function () { this.calendarStart.add(1, "months") }, selectYearBefore: function () { this.calendarStart.subtract(1, "years") }, selectYearAfter: function () { this.calendarStart.add(1, "years") }, selectAM: function () { (this.isHourAvailable(0) || this.isHourAvailable(12)) && (this.currentDate.hour() >= 12 && this.selectDate(this.currentDate.subtract(12, "hours")), this.isHourAvailable(this.currentDate.hour()) || this.selectDate(this.currentDate.hour(this.minDate.hour())), this.isMinuteAvailable(this.currentDate.minute()) || this.selectDate(this.currentDate.minute(this.minDate.minute()))) }, selectPM: function () { (this.isHourAvailable(13) || this.isHourAvailable(24)) && (this.currentDate.hour() < 12 && this.selectDate(this.currentDate.add(12, "hours")), this.isHourAvailable(this.currentDate.hour()) || this.selectDate(this.currentDate.hour(this.maxDate.hour())), this.isMinuteAvailable(this.currentDate.minute()) || this.selectDate(this.currentDate.minute(this.maxDate.minute()))) }, convertHours: function (t) { var e = t; return t < 12 && this.isPM() && (e += 12), e }, hide: function (t) { t ? this._dialog.hide(this.currentDate) : this._dialog.cancel() } }, angular.module(t).directive("mdcDatetimePickerCalendar", [function () { for (var t = 1920, e = (new Date).getFullYear() + 30, a = 12 * (e - t + 1), i = 240, r = [], n = 0; n < a; n++) r.push(n); var s = function (e, a) { a = a ? a : 0; var i = e.year(), r = e.month(); return 12 * (i - t) + r - 1 - a }; return { restrict: "E", scope: { picker: "=", date: "=" }, bindToController: !0, controllerAs: "cal", controller: ["$scope", function (e) { this.$onInit = function () { for (var i = this, n = this.picker, c = [], o = n.params.weekStart; c.length < 7; o++) o > 6 && (o = 0), c.push(o.toString()); if (i.week = c, n.maxDate || n.minDate) { var l = n.minDate ? s(n.minDate) : 0, d = n.maxDate ? s(n.maxDate) + 1 : a; i.months = r.slice(l, d) } else i.months = r; i.getItemAtIndex = function (e) { var a = (e + 1) % 12 || 12, i = t + Math.floor(e / 12), r = moment(n.currentDate).year(i).month(a); return u(r) }, i.topIndex = s(n.currentDate) - i.months[0], e.$watch(function () { return n.currentDate ? n.currentDate.format("YYYY-MM") : "" }, function (t, e) { if (t != e) { var a = moment(t, "YYYY-MM"), r = n.minDate ? s(n.minDate) : 0, c = s(a, r); i.topIndex != c && (i.topIndex = c) } }); var u = function (t) { var e = {}; if (null !== t) { e.name = t.format("MMMM YYYY"); var a = moment(t).locale(n.params.lang).startOf("month").hour(t.hour()).minute(t.minute()), r = a.format("d"); e.days = []; for (var s = a.date() ; s <= a.daysInMonth() ; s++) { if (s === a.date()) { var c = i.week.indexOf(r.toString()); if (c > 0) for (var o = 0; o < c; o++) e.days.push(0) } e.days.push(moment(a).locale(n.params.lang).date(s)) } for (var l = 7, d = [], u = Math.ceil(e.days.length / l), m = 0; m < u; m++) d.push(e.days.slice(m * l, (m + 1) * l)); return e.days = d, e } }; i.toDay = function (t) { return moment(parseInt(t), "d").locale(n.params.lang).format("dd").substring(0, 1) }, i.isInRange = function (t) { return n.isAfterMinDate(moment(t), !1, !1) && n.isBeforeMaxDate(moment(t), !1, !1) && n.isInDisableDates(moment(t)) }, i.selectDate = function (t) { if (t) { if (i.isSelectedDay(t)) return n.ok(); n.selectDate(moment(t).hour(i.date.hour()).minute(i.date.minute())) } }, i.isSelectedDay = function (t) { return t && i.date.date() === t.date() && i.date.month() === t.month() && i.date.year() === t.year() }, i.isDateOfTheDay = function (t) { var e = i.picker.options.showTodaysDate; return !!e && (t && e.date() === t.date() && e.month() === t.month() && e.year() === t.year()) } } }], template: ' ' } }]).directive("mdcDatetimePickerCalendarMonth", ["$compile", function (t) { var e = function (e, a) { var i = angular.element(e[0].querySelector("tbody")), r = a.cal, n = a.month, s = []; n.days.forEach(function (t, e) { s.push(""), t.forEach(function (t, a) { if (s.push(""), t) if (r.isInRange(t)) { var i = "month['days'][" + e + "][" + a + "]"; s.push(''), s.push(t.format("D")), s.push(" ") } else s.push(''), s.push(t.format("D")), s.push(" "); s.push(" ") }), s.push(" ") }), i.html(s.join("")), t(i)(a) }; return { scope: { idx: "=" }, require: "^mdcDatetimePickerCalendar", restrict: "AE", template: '{{month.name}}
', link: function (t, a, i, r) { t.cal = r, t.month = r.getItemAtIndex(parseInt(t.idx)), e(a, t), t.$watch(function () { return t.idx }, function (i, n) { i != n && (t.month = r.getItemAtIndex(parseInt(t.idx)), e(a, t)) }) } } }]), angular.module(t).directive("mdcDtpNoclick", function () { return { link: function (t, e) { e.on("click", function (t) { t.preventDefault() }) } } }), angular.module(t).directive("mdcDatetimePickerClock", [function () { var t = ''; return { restrict: "E", template: t, link: function (t, e, i) { var r = "minutes" === i.mode, n = t.picker, s = document.querySelector("md-dialog.dtp"), c = function () { var i = angular.element(e[0].querySelector(".dtp-picker-clock")), c = angular.element(s.querySelector(".dtp-picker")), l = s.querySelector(".dtp-content").offsetWidth, u = parseInt(a(c, "paddingLeft").replace("px", "")) || 0, m = parseInt(a(c, "paddingRight").replace("px", "")) || 0, p = parseInt(a(i, "marginLeft").replace("px", "")) || 0, h = parseInt(a(i, "marginRight").replace("px", "")) || 0, f = l - (p + h + u + m); i.css("width", f + "px"); for (var D = parseInt(a(c, "paddingLeft").replace("px", "")) || 0, v = parseInt(a(c, "paddingTop").replace("px", "")) || 0, g = parseInt(a(i, "marginLeft").replace("px", "")) || 0, k = parseInt(a(i, "marginTop").replace("px", "")) || 0, M = f / 2, y = M / 1.2, x = [], b = 0; b < 12; ++b) { var T = y * Math.sin(2 * Math.PI * (b / 12)), w = y * Math.cos(2 * Math.PI * (b / 12)), A = M + T + D / 2 - (D + g), Y = M - w - k / 2 - (v + k), I = { left: A, top: Y, value: r ? 5 * b : b, style: { "margin-left": A + "px", "margin-top": Y + "px" } }; r ? I.display = I.value < 10 ? "0" + I.value : I.value : n.params.shortTime ? I.display = 0 === b ? 12 : b : I.display = n.isPM() ? b + 12 : b, x.push(I) } t.points = x, d(), i.css("height", f + "px"); var S = e[0].querySelector(".dtp-clock-center"), H = S.offsetWidth / 2 || 7.5, P = S.offsetHeight / 2 || 7.5, V = M / 1.8, E = M / 1.5; angular.element(e[0].querySelector(".dtp-hour-hand")).css({ left: M + 1.5 * g + "px", height: V + "px", marginTop: M - V - D + "px" }).addClass(r ? "" : "on"), angular.element(e[0].querySelector(".dtp-minute-hand")).css({ left: M + 1.5 * g + "px", height: E + "px", marginTop: M - E - D + "px" }).addClass(r ? "on" : ""), angular.element(S).css({ left: M + D + g - H + "px", marginTop: M - g / 2 - P + "px" }), o() }, o = function () { var t = n.currentNearest5Minute(), a = t.hour(), i = t.minute(); l(angular.element(e[0].querySelector(".dtp-hour-hand")), 30 * a); var r = 6 * (5 * Math.round(i / 5)); l(angular.element(e[0].querySelector(".dtp-minute-hand")), r) }, l = function (t, e) { angular.element(t).css({ WebkitTransform: "rotate(" + e + "deg)", "-moz-transform": "rotate(" + e + "deg)", "-ms-transform": "rotate(" + e + "deg)", transform: "rotate(" + e + "deg)" }) }, d = function () { var e = n.currentNearest5Minute(); t.currentValue = r ? e.minute() : e.hour() % 12 }; t.$watch(function () { var t = n.currentNearest5Minute(); return t ? t.format("HH:mm") : "" }, function () { d(), o() }); var u = function (t, e) { for (var a = 0; a < e.length; a++) e[a].display = a, t && (e[a].display += 12); return e }; n.params.shortTime || t.$watch("picker.meridien", function () { if (!r && t.points) { var e = u(n.isPM(), angular.copy(t.points)); t.points = e } }), t.setTime = function (e) { e === t.currentValue && n.ok(), r ? n.currentDate.minute(e) : n.currentDate.hour(n.isPM() ? e + 12 : e), n.currentDate.second(0) }, t.pointAvailable = function (t) { return r ? n.isMinuteAvailable(t.value) : n.isHourAvailable(t.value) }; var m = t.$watch(function () { return e[0].querySelectorAll("div").length }, function () { c(), m() }) } } }]) }();
//# sourceMappingURL=angular-material-datetimepicker.min.js.map
/*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function (t, e) { "function" == typeof define && define.amd ? define([], function () { return e() }) : "object" == typeof module && module.exports ? module.exports = e() : e() }(0, function () { function t(e) { "use strict"; var n = e.storageKey(), a = e.storage(), t = function () { var t = e.preferredLanguage(); angular.isString(t) ? e.use(t) : a.put(n, e.use()) }; t.displayName = "fallbackFromIncorrectStorageValue", a ? a.get(n) ? e.use(a.get(n)).catch(t) : t() : angular.isString(e.preferredLanguage()) && e.use(e.preferredLanguage()) } function e(t, r, e, i) { "use strict"; var z, c, T, x, F, I, _, n, V, R, D, K, U, M, H, G, q = {}, Y = [], B = t, J = [], Q = "translate-cloak", W = !1, X = !1, Z = ".", tt = !1, et = !1, nt = 0, at = !0, a = "default", s = { default: function (t) { return (t || "").split("-").join("_") }, java: function (t) { var e = (t || "").split("-").join("_"), n = e.split("_"); return 1 < n.length ? n[0].toLowerCase() + "_" + n[1].toUpperCase() : e }, bcp47: function (t) { var e = (t || "").split("_").join("-"), n = e.split("-"); switch (n.length) { case 1: n[0] = n[0].toLowerCase(); break; case 2: n[0] = n[0].toLowerCase(), 4 === n[1].length ? n[1] = n[1].charAt(0).toUpperCase() + n[1].slice(1).toLowerCase() : n[1] = n[1].toUpperCase(); break; case 3: n[0] = n[0].toLowerCase(), n[1] = n[1].charAt(0).toUpperCase() + n[1].slice(1).toLowerCase(), n[2] = n[2].toUpperCase(); break; default: return e } return n.join("-") }, "iso639-1": function (t) { return (t || "").split("_").join("-").split("-")[0].toLowerCase() } }, o = function () { if (angular.isFunction(i.getLocale)) return i.getLocale(); var t, e, n = r.$get().navigator, a = ["language", "browserLanguage", "systemLanguage", "userLanguage"]; if (angular.isArray(n.languages)) for (t = 0; t < n.languages.length; t++) if ((e = n.languages[t]) && e.length) return e; for (t = 0; t < a.length; t++) if ((e = n[a[t]]) && e.length) return e; return null }; o.displayName = "angular-translate/service: getFirstBrowserLanguage"; var rt = function () { var t = o() || ""; return s[a] && (t = s[a](t)), t }; rt.displayName = "angular-translate/service: getLocale"; var it = function (t, e) { for (var n = 0, a = t.length; n < a; n++) if (t[n] === e) return n; return -1 }, st = function () { return this.toString().replace(/^\s+|\s+$/g, "") }, f = function (t) { return angular.isString(t) ? t.toLowerCase() : t }, ot = function (t) { if (t) { for (var e, n = [], a = f(t), r = 0, i = Y.length; r < i; r++) n.push(f(Y[r])); if (-1 < (r = it(n, a))) return Y[r]; if (c) for (var s in c) if (c.hasOwnProperty(s)) { var o = !1, l = Object.prototype.hasOwnProperty.call(c, s) && f(s) === f(t); if ("*" === s.slice(-1) && (o = f(s.slice(0, -1)) === f(t.slice(0, s.length - 1))), (l || o) && (e = c[s], -1 < it(n, f(e)))) return e } var u = t.split("_"); return 1 < u.length && -1 < it(n, f(u[0])) ? u[0] : void 0 } }, lt = function (t, e) { if (!t && !e) return q; if (t && !e) { if (angular.isString(t)) return q[t] } else angular.isObject(q[t]) || (q[t] = {}), angular.extend(q[t], ut(e)); return this }; this.translations = lt, this.cloakClassName = function (t) { return t ? (Q = t, this) : Q }, this.nestedObjectDelimeter = function (t) { return t ? (Z = t, this) : Z }; var ut = function (t, e, n, a) { var r, i, s; for (r in e || (e = []), n || (n = {}), t) Object.prototype.hasOwnProperty.call(t, r) && (s = t[r], angular.isObject(s) ? ut(s, e.concat(r), n, r) : (i = e.length ? "" + e.join(Z) + Z + r : r, e.length && r === a && (n["" + e.join(Z)] = "@:" + i), n[i] = s)); return n }; ut.displayName = "flatObject", this.addInterpolation = function (t) { return J.push(t), this }, this.useMessageFormatInterpolation = function () { return this.useInterpolation("$translateMessageFormatInterpolation") }, this.useInterpolation = function (t) { return R = t, this }, this.useSanitizeValueStrategy = function (t) { return e.useStrategy(t), this }, this.preferredLanguage = function (t) { return t ? (ct(t), this) : z }; var ct = function (t) { return t && (z = t), z }; this.translationNotFoundIndicator = function (t) { return this.translationNotFoundIndicatorLeft(t), this.translationNotFoundIndicatorRight(t), this }, this.translationNotFoundIndicatorLeft = function (t) { return t ? (U = t, this) : U }, this.translationNotFoundIndicatorRight = function (t) { return t ? (M = t, this) : M }, this.fallbackLanguage = function (t) { return ft(t), this }; var ft = function (t) { return t ? (angular.isString(t) ? (x = !0, T = [t]) : angular.isArray(t) && (x = !1, T = t), angular.isString(z) && it(T, z) < 0 && T.push(z), this) : x ? T[0] : T }; this.use = function (t) { if (t) { if (!q[t] && !D) throw new Error("$translateProvider couldn't find translationTable for langKey: '" + t + "'"); return F = t, this } return F }, this.resolveClientLocale = function () { return rt() }; var gt = function (t) { return t ? (B = t, this) : n ? n + B : B }; this.storageKey = gt, this.useUrlLoader = function (t, e) { return this.useLoader("$translateUrlLoader", angular.extend({ url: t }, e)) }, this.useStaticFilesLoader = function (t) { return this.useLoader("$translateStaticFilesLoader", t) }, this.useLoader = function (t, e) { return D = t, K = e || {}, this }, this.useLocalStorage = function () { return this.useStorage("$translateLocalStorage") }, this.useCookieStorage = function () { return this.useStorage("$translateCookieStorage") }, this.useStorage = function (t) { return _ = t, this }, this.storagePrefix = function (t) { return t ? (n = t, this) : t }, this.useMissingTranslationHandlerLog = function () { return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog") }, this.useMissingTranslationHandler = function (t) { return V = t, this }, this.usePostCompiling = function (t) { return W = !!t, this }, this.forceAsyncReload = function (t) { return X = !!t, this }, this.uniformLanguageTag = function (t) { return t ? angular.isString(t) && (t = { standard: t }) : t = {}, a = t.standard, this }, this.determinePreferredLanguage = function (t) { var e = t && angular.isFunction(t) ? t() : rt(); return z = Y.length && ot(e) || e, this }, this.registerAvailableLanguageKeys = function (t, e) { return t ? (Y = t, e && (c = e), this) : Y }, this.useLoaderCache = function (t) { return !1 === t ? H = void 0 : !0 === t ? H = !0 : void 0 === t ? H = "$translationCache" : t && (H = t), this }, this.directivePriority = function (t) { return void 0 === t ? nt : (nt = t, this) }, this.statefulFilter = function (t) { return void 0 === t ? at : (at = t, this) }, this.postProcess = function (t) { return G = t || void 0, this }, this.keepContent = function (t) { return et = !!t, this }, this.$get = ["$log", "$injector", "$rootScope", "$q", function (t, o, s, m) { var i, $, y, b = o.get(R || "$translateDefaultInterpolation"), S = !1, L = {}, f = {}, j = function (t, s, o, l, u, c) { !F && z && (F = z); var a = u && u !== F ? ot(u) || u : F; if (u && v(u), angular.isArray(t)) { return function (t) { for (var a = {}, e = [], n = function (e) { var n = m.defer(), t = function (t) { a[e] = t, n.resolve([e, t]) }; return j(e, s, o, l, u, c).then(t, t), n.promise }, r = 0, i = t.length; r < i; r++) e.push(n(t[r])); return m.all(e).then(function () { return a }) }(t) } var e = m.defer(); t && (t = st.apply(t)); var n = function () { var t = f[a] || f[z]; if ($ = 0, _ && !t) { var e = i.get(B); if (t = f[e], T && T.length) { var n = it(T, e); $ = 0 === n ? 1 : 0, it(T, z) < 0 && T.push(z) } } return t }(); if (n) { var r = function () { u || (a = F), h(t, s, o, l, a, c).then(e.resolve, e.reject) }; r.displayName = "promiseResolved", n.finally(r).catch(angular.noop) } else h(t, s, o, l, a, c).then(e.resolve, e.reject); return e.promise }, w = function (t) { return U && (t = [U, t].join(" ")), M && (t = [t, M].join(" ")), t }, l = function (t) { F = t, _ && i.put(j.storageKey(), F), s.$emit("$translateChangeSuccess", { language: t }), b.setLocale(F); var e = function (t, e) { L[e].setLocale(F) }; e.displayName = "eachInterpolatorLocaleSetter", angular.forEach(L, e), s.$emit("$translateChangeEnd", { language: t }) }, u = function (n) { if (!n) throw "No language key specified for loading."; var a = m.defer(); s.$emit("$translateLoadingStart", { language: n }), S = !0; var t = H; "string" == typeof t && (t = o.get(t)); var e = angular.extend({}, K, { key: n, $http: angular.extend({}, { cache: t }, K.$http) }), r = function (t) { var e = {}; s.$emit("$translateLoadingSuccess", { language: n }), angular.isArray(t) ? angular.forEach(t, function (t) { angular.extend(e, ut(t)) }) : angular.extend(e, ut(t)), S = !1, a.resolve({ key: n, table: e }), s.$emit("$translateLoadingEnd", { language: n }) }; r.displayName = "onLoaderSuccess"; var i = function (t) { s.$emit("$translateLoadingError", { language: t }), a.reject(t), s.$emit("$translateLoadingEnd", { language: t }) }; return i.displayName = "onLoaderError", o.get(D)(e).then(r, i), a.promise }; if (_ && (!(i = o.get(_)).get || !i.put)) throw new Error("Couldn't use storage '" + _ + "', missing get() or put() method!"); if (J.length) { var e = function (t) { var e = o.get(t); e.setLocale(z || F), L[e.getInterpolationIdentifier()] = e }; e.displayName = "interpolationFactoryAdder", angular.forEach(J, e) } var c = function (a, r, i, s, o) { var l = m.defer(), t = function (t) { if (Object.prototype.hasOwnProperty.call(t, r) && null !== t[r]) { s.setLocale(a); var e = t[r]; if ("@:" === e.substr(0, 2)) c(a, e.substr(2), i, s, o).then(l.resolve, l.reject); else { var n = s.interpolate(t[r], i, "service", o, r); n = O(r, t[r], n, i, a), l.resolve(n) } s.setLocale(F) } else l.reject() }; return t.displayName = "fallbackTranslationResolver", function (t) { var e = m.defer(); if (Object.prototype.hasOwnProperty.call(q, t)) e.resolve(q[t]); else if (f[t]) { var n = function (t) { lt(t.key, t.table), e.resolve(t.table) }; n.displayName = "translationTableResolver", f[t].then(n, e.reject) } else e.reject(); return e.promise }(a).then(t, l.reject), l.promise }, g = function (t, e, n, a, r) { var i, s = q[t]; if (s && Object.prototype.hasOwnProperty.call(s, e) && null !== s[e]) { if (a.setLocale(t), i = a.interpolate(s[e], n, "filter", r, e), i = O(e, s[e], i, n, t, r), !angular.isString(i) && angular.isFunction(i.$$unwrapTrustedValue)) { var o = i.$$unwrapTrustedValue(); if ("@:" === o.substr(0, 2)) return g(t, o.substr(2), n, a, r) } else if ("@:" === i.substr(0, 2)) return g(t, i.substr(2), n, a, r); a.setLocale(F) } return i }, C = function (t, e, n, a) { return V ? o.get(V)(t, F, e, n, a) : t }, N = function (t, e, n, a, r, i) { var s = m.defer(); if (t < T.length) { var o = T[t]; c(o, e, n, a, i).then(function (t) { s.resolve(t) }, function () { return N(t + 1, e, n, a, r, i).then(s.resolve, s.reject) }) } else if (r) s.resolve(r); else { var l = C(e, n, r); V && l ? s.resolve(l) : s.reject(w(e)) } return s.promise }, p = function (t, e, n, a, r) { var i; if (t < T.length) { var s = T[t]; (i = g(s, e, n, a, r)) || "" === i || (i = p(t + 1, e, n, a)) } return i }, h = function (t, e, n, a, r, i) { var s, o, l, u, c, f = m.defer(), g = r ? q[r] : q, p = n ? L[n] : b; if (g && Object.prototype.hasOwnProperty.call(g, t) && null !== g[t]) { var h = g[t]; if ("@:" === h.substr(0, 2)) j(h.substr(2), e, n, a, r, i).then(f.resolve, f.reject); else { var d = p.interpolate(h, e, "service", i, t); d = O(t, h, d, e, r), f.resolve(d) } } else { var v; V && !S && (v = C(t, e, a)), r && T && T.length ? (s = t, o = e, l = p, u = a, c = i, N(0 < y ? y : $, s, o, l, u, c)).then(function (t) { f.resolve(t) }, function (t) { f.reject(w(t)) }) : V && !S && v ? a ? f.resolve(a) : f.resolve(v) : a ? f.resolve(a) : f.reject(w(t)) } return f.promise }, d = function (t, e, n, a, r) { var i, s = a ? q[a] : q, o = b; if (L && Object.prototype.hasOwnProperty.call(L, n) && (o = L[n]), s && Object.prototype.hasOwnProperty.call(s, t) && null !== s[t]) { var l = s[t]; "@:" === l.substr(0, 2) ? i = d(l.substr(2), e, n, a, r) : (i = o.interpolate(l, e, "filter", r, t), i = O(t, l, i, e, a, r)) } else { var u; V && !S && (u = C(t, e, r)), i = a && T && T.length ? p(($ = 0) < y ? y : $, t, e, o, r) : V && !S && u ? u : w(t) } return i }, O = function (t, e, n, a, r, i) { var s = G; return s && ("string" == typeof s && (s = o.get(s)), s) ? s(t, e, n, a, r, i) : n }, v = function (t) { q[t] || !D || f[t] || (f[t] = u(t).then(function (t) { return lt(t.key, t.table), t })) }; j.preferredLanguage = function (t) { return t && ct(t), z }, j.cloakClassName = function () { return Q }, j.nestedObjectDelimeter = function () { return Z }, j.fallbackLanguage = function (t) { if (null != t) { if (ft(t), D && T && T.length) for (var e = 0, n = T.length; e < n; e++) f[T[e]] || (f[T[e]] = u(T[e])); j.use(j.use()) } return x ? T[0] : T }, j.useFallbackLanguage = function (t) { if (null != t) if (t) { var e = it(T, t); -1 < e && (y = e) } else y = 0 }, j.proposedLanguage = function () { return I }, j.storage = function () { return i }, j.negotiateLocale = ot, j.use = function (e) { if (!e) return F; var n = m.defer(); n.promise.then(null, angular.noop), s.$emit("$translateChangeStart", { language: e }); var t = ot(e); return 0 < Y.length && !t ? m.reject(e) : (t && (e = t), I = e, !X && q[e] || !D || f[e] ? f[e] ? f[e].then(function (t) { return I === t.key && l(t.key), n.resolve(t.key), t }, function (t) { return !F && T && 0 < T.length && T[0] !== t ? j.use(T[0]).then(n.resolve, n.reject) : n.reject(t) }) : (n.resolve(e), l(e)) : (f[e] = u(e).then(function (t) { return lt(t.key, t.table), n.resolve(t.key), I === e && l(t.key), t }, function (t) { return s.$emit("$translateChangeError", { language: t }), n.reject(t), s.$emit("$translateChangeEnd", { language: t }), m.reject(t) }), f[e].finally(function () { var t; I === (t = e) && (I = void 0), f[t] = void 0 }).catch(angular.noop)), n.promise) }, j.resolveClientLocale = function () { return rt() }, j.storageKey = function () { return gt() }, j.isPostCompilingEnabled = function () { return W }, j.isForceAsyncReloadEnabled = function () { return X }, j.isKeepContent = function () { return et }, j.refresh = function (t) { if (!D) throw new Error("Couldn't refresh translation table, no loader registered!"); s.$emit("$translateRefreshStart", { language: t }); var e = m.defer(), n = {}; function a(e) { var t = u(e); return (f[e] = t).then(function (t) { q[e] = {}, lt(e, t.table), n[e] = !0 }, angular.noop), t } if (e.promise.then(function () { for (var t in q) q.hasOwnProperty(t) && (t in n || delete q[t]); F && l(F) }, angular.noop).finally(function () { s.$emit("$translateRefreshEnd", { language: t }) }), t) q[t] ? a(t).then(e.resolve, e.reject) : e.reject(); else { var r = T && T.slice() || []; F && -1 === r.indexOf(F) && r.push(F), m.all(r.map(a)).then(e.resolve, e.reject) } return e.promise }, j.instant = function (t, e, n, a, r) { var i = a && a !== F ? ot(a) || a : F; if (null === t || angular.isUndefined(t)) return t; if (a && v(a), angular.isArray(t)) { for (var s = {}, o = 0, l = t.length; o < l; o++) s[t[o]] = j.instant(t[o], e, n, a, r); return s } if (angular.isString(t) && t.length < 1) return t; t && (t = st.apply(t)); var u, c, f = []; z && f.push(z), i && f.push(i), T && T.length && (f = f.concat(T)); for (var g = 0, p = f.length; g < p; g++) { var h = f[g]; if (q[h] && void 0 !== q[h][t] && (u = d(t, e, n, i, r)), void 0 !== u) break } u || "" === u || (U || M ? u = w(t) : (u = b.interpolate(t, e, "filter", r), V && !S && (c = C(t, e, r)), V && !S && c && (u = c))); return u }, j.versionInfo = function () { return "2.18.1" }, j.loaderCache = function () { return H }, j.directivePriority = function () { return nt }, j.statefulFilter = function () { return at }, j.isReady = function () { return tt }; var n = m.defer(); n.promise.then(function () { tt = !0 }), j.onReady = function (t) { var e = m.defer(); return angular.isFunction(t) && e.promise.then(t), tt ? e.resolve() : n.promise.then(e.resolve), e.promise }, j.getAvailableLanguageKeys = function () { return 0 < Y.length ? Y : null }, j.getTranslationTable = function (t) { return (t = t || j.use()) && q[t] ? angular.copy(q[t]) : null }; var a = s.$on("$translateReady", function () { n.resolve(), a(), a = null }), r = s.$on("$translateChangeEnd", function () { n.resolve(), r(), r = null }); if (D) { if (angular.equals(q, {}) && j.use() && j.use(j.use()), T && T.length) for (var E = function (t) { return lt(t.key, t.table), s.$emit("$translateChangeEnd", { language: t.key }), t }, k = 0, P = T.length; k < P; k++) { var A = T[k]; !X && q[A] || (f[A] = u(A).then(E)) } } else s.$emit("$translateReady", { language: j.use() }); return j }] } function n(s, o) { "use strict"; var t = {}; return t.setLocale = function (t) { t }, t.getInterpolationIdentifier = function () { return "default" }, t.useSanitizeValueStrategy = function (t) { return o.useStrategy(t), this }, t.interpolate = function (t, e, n, a, r) { var i; return e = e || {}, e = o.sanitize(e, "params", a, n), angular.isNumber(t) ? i = "" + t : angular.isString(t) ? (i = s(t)(e), i = o.sanitize(i, "text", a, n)) : i = "", i }, t } function a(S, L, j, w, C) { "use strict"; var N = function (t) { return angular.isString(t) ? t.toLowerCase() : t }; return { restrict: "AE", scope: !0, priority: S.directivePriority(), compile: function (t, h) { var d = h.translateValues ? h.translateValues : void 0, v = h.translateInterpolation ? h.translateInterpolation : void 0, m = h.translateSanitizeStrategy ? h.translateSanitizeStrategy : void 0, $ = t[0].outerHTML.match(/translate-value-+/i), y = "^(.*)(" + L.startSymbol() + ".*" + L.endSymbol() + ")(.*)", b = "^(.*)" + L.startSymbol() + "(.*)" + L.endSymbol() + "(.*)"; return function (r, l, u) { r.interpolateParams = {}, r.preText = "", r.postText = "", r.translateNamespace = function t(e) { if (e.translateNamespace) return e.translateNamespace; if (e.$parent) return t(e.$parent) }(r); var i = {}, s = function (t) { if (angular.isFunction(s._unwatchOld) && (s._unwatchOld(), s._unwatchOld = void 0), angular.equals(t, "") || !angular.isDefined(t)) { var e = function () { return this.toString().replace(/^\s+|\s+$/g, "") }.apply(l.text()), n = e.match(y); if (angular.isArray(n)) { r.preText = n[1], r.postText = n[3], i.translate = L(n[2])(r.$parent); var a = e.match(b); angular.isArray(a) && a[2] && a[2].length && (s._unwatchOld = r.$watch(a[2], function (t) { i.translate = t, c() })) } else i.translate = e || void 0 } else i.translate = t; c() }, t = function (e) { u.$observe(e, function (t) { i[e] = t, c() }) }; !function (t, e, n) { if (e.translateValues && angular.extend(t, w(e.translateValues)(r.$parent)), $) for (var a in n) Object.prototype.hasOwnProperty.call(e, a) && "translateValue" === a.substr(0, 14) && "translateValues" !== a && (t[N(a.substr(14, 1)) + a.substr(15)] = n[a]) }(r.interpolateParams, u, h); var e = !0; for (var n in u.$observe("translate", function (t) { void 0 === t ? s("") : "" === t && e || (i.translate = t, c()), e = !1 }), u) u.hasOwnProperty(n) && "translateAttr" === n.substr(0, 13) && 13 < n.length && t(n); if (u.$observe("translateDefault", function (t) { r.defaultText = t, c() }), m && u.$observe("translateSanitizeStrategy", function (t) { r.sanitizeStrategy = w(t)(r.$parent), c() }), d && u.$observe("translateValues", function (t) { t && r.$parent.$watch(function () { angular.extend(r.interpolateParams, w(t)(r.$parent)) }) }), $) { var a = function (n) { u.$observe(n, function (t) { var e = N(n.substr(14, 1)) + n.substr(15); r.interpolateParams[e] = t }) }; for (var o in u) Object.prototype.hasOwnProperty.call(u, o) && "translateValue" === o.substr(0, 14) && "translateValues" !== o && a(o) } var c = function () { for (var t in i) i.hasOwnProperty(t) && void 0 !== i[t] && f(t, i[t], r, r.interpolateParams, r.defaultText, r.translateNamespace) }, f = function (e, t, n, a, r, i) { t ? (i && "." === t.charAt(0) && (t = i + t), S(t, a, v, r, n.translateLanguage, n.sanitizeStrategy).then(function (t) { g(t, n, !0, e) }, function (t) { g(t, n, !1, e) })) : g(t, n, !1, e) }, g = function (t, e, n, a) { if (n || void 0 !== e.defaultText && (t = e.defaultText), "translate" === a) { (n || !n && !S.isKeepContent() && void 0 === u.translateKeepContent) && l.empty().append(e.preText + t + e.postText); var r = S.isPostCompilingEnabled(), i = void 0 !== h.translateCompile, s = i && "false" !== h.translateCompile; (r && !i || s) && j(l.contents())(e) } else { var o = u.$attr[a]; "data-" === o.substr(0, 5) && (o = o.substr(5)), o = o.substr(15), l.attr(o, t) } }; (d || $ || u.translateDefault) && r.$watch("interpolateParams", c, !0), r.$on("translateLanguageChanged", c); var p = C.$on("$translateChangeSuccess", c); l.text().length ? u.translate ? s(u.translate) : s("") : u.translate && s(u.translate), c(), r.$on("$destroy", p) } } } } function r(u, c) { "use strict"; return { restrict: "A", priority: u.directivePriority(), link: function (n, a, r) { var i, s, o, l = {}, t = function () { angular.forEach(i, function (t, e) { t && (l[e] = !0, n.translateNamespace && "." === t.charAt(0) && (t = n.translateNamespace + t), u(t, s, r.translateInterpolation, void 0, n.translateLanguage, o).then(function (t) { a.attr(e, t) }, function (t) { a.attr(e, t) })) }), angular.forEach(l, function (t, e) { i[e] || (a.removeAttr(e), delete l[e]) }) }; f(n, r.translateAttr, function (t) { i = t }, t), f(n, r.translateValues, function (t) { s = t }, t), f(n, r.translateSanitizeStrategy, function (t) { o = t }, t), r.translateValues && n.$watch(r.translateValues, t, !0), n.$on("translateLanguageChanged", t); var e = c.$on("$translateChangeSuccess", t); t(), n.$on("$destroy", e) } } } function f(t, e, n, a) { "use strict"; e && ("::" === e.substr(0, 2) ? e = e.substr(2) : t.$watch(e, function (t) { n(t), a() }, !0), n(t.$eval(e))) } function i(s, o) { "use strict"; return { compile: function (t) { var i = function (t) { t.addClass(s.cloakClassName()) }; return i(t), function (t, e, n) { var a = function (t) { t.removeClass(s.cloakClassName()) }.bind(this, e), r = i.bind(this, e); n.translateCloak && n.translateCloak.length ? (n.$observe("translateCloak", function (t) { s(t).then(a, r) }), o.$on("$translateChangeSuccess", function () { s(n.translateCloak).then(a, r) })) : s.onReady(a) } } } } function s() { "use strict"; return { restrict: "A", scope: !0, compile: function () { return { pre: function (t, e, n) { t.translateNamespace = function t(e) { if (e.translateNamespace) return e.translateNamespace; if (e.$parent) return t(e.$parent) }(t), t.translateNamespace && "." === n.translateNamespace.charAt(0) ? t.translateNamespace += n.translateNamespace : t.translateNamespace = n.translateNamespace } } } } } function o() { "use strict"; return { restrict: "A", scope: !0, compile: function () { return function (e, t, n) { n.$observe("translateLanguage", function (t) { e.translateLanguage = t }), e.$watch("translateLanguage", function () { e.$broadcast("translateLanguageChanged") }) } } } } function l(i, s) { "use strict"; var t = function (t, e, n, a) { if (!angular.isObject(e)) { var r = this || { __SCOPE_IS_NOT_AVAILABLE: "More info at https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f" }; e = i(e)(r) } return s.instant(t, e, n, a) }; return s.statefulFilter() && (t.$stateful = !0), t } function u(t) { "use strict"; return t("translations") } return t.$inject = ["$translate"], e.$inject = ["$STORAGE_KEY", "$windowProvider", "$translateSanitizationProvider", "pascalprechtTranslateOverrider"], n.$inject = ["$interpolate", "$translateSanitization"], a.$inject = ["$translate", "$interpolate", "$compile", "$parse", "$rootScope"], r.$inject = ["$translate", "$rootScope"], i.$inject = ["$translate", "$rootScope"], l.$inject = ["$parse", "$translate"], u.$inject = ["$cacheFactory"], angular.module("pascalprecht.translate", ["ng"]).run(t), t.displayName = "runTranslate", angular.module("pascalprecht.translate").provider("$translateSanitization", function () { "use strict"; var n, a, g, p = null, h = !1, d = !1; (g = { sanitize: function (t, e) { return "text" === e && (t = i(t)), t }, escape: function (t, e) { return "text" === e && (t = r(t)), t }, sanitizeParameters: function (t, e) { return "params" === e && (t = o(t, i)), t }, escapeParameters: function (t, e) { return "params" === e && (t = o(t, r)), t }, sce: function (t, e, n) { return "text" === e ? t = s(t) : "params" === e && "filter" !== n && (t = o(t, r)), t }, sceParameters: function (t, e) { return "params" === e && (t = o(t, s)), t } }).escaped = g.escapeParameters, this.addStrategy = function (t, e) { return g[t] = e, this }, this.removeStrategy = function (t) { return delete g[t], this }, this.useStrategy = function (t) { return h = !0, p = t, this }, this.$get = ["$injector", "$log", function (u, c) { var e, f = {}; return u.has("$sanitize") && (n = u.get("$sanitize")), u.has("$sce") && (a = u.get("$sce")), { useStrategy: (e = this, function (t) { e.useStrategy(t) }), sanitize: function (t, e, n, a) { if (p || h || d || (c.warn("pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details."), d = !0), n || null === n || (n = p), !n) return t; a || (a = "service"); var r, i, s, o, l = angular.isArray(n) ? n : [n]; return r = t, i = e, s = a, o = l, angular.forEach(o, function (e) { if (angular.isFunction(e)) r = e(r, i, s); else if (angular.isFunction(g[e])) r = g[e](r, i, s); else { if (!angular.isString(g[e])) throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '" + e + "'"); if (!f[g[e]]) try { f[g[e]] = u.get(g[e]) } catch (t) { throw f[g[e]] = function () { }, new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '" + e + "'") } r = f[g[e]](r, i, s) } }), r } } }]; var r = function (t) { var e = angular.element("
"); return e.text(t), e.html() }, i = function (t) { if (!n) throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sanitize service. Either include the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) or use a sanitization strategy which does not depend on $sanitize, such as 'escape'."); return n(t) }, s = function (t) { if (!a) throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sce service."); return a.trustAsHtml(t) }, o = function (t, n, a) { if (angular.isDate(t)) return t; if (angular.isObject(t)) { var r = angular.isArray(t) ? [] : {}; if (a) { if (-1 < a.indexOf(t)) throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object") } else a = []; return a.push(t), angular.forEach(t, function (t, e) { angular.isFunction(t) || (r[e] = o(t, n, a)) }), a.splice(-1, 1), r } return angular.isNumber(t) ? t : !0 === t || !1 === t ? t : angular.isUndefined(t) || null === t ? t : n(t) } }), angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider", {}).provider("$translate", e), e.displayName = "displayName", angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation", n), n.displayName = "$translateDefaultInterpolation", angular.module("pascalprecht.translate").constant("$STORAGE_KEY", "NG_TRANSLATE_LANG_KEY"), angular.module("pascalprecht.translate").directive("translate", a), a.displayName = "translateDirective", angular.module("pascalprecht.translate").directive("translateAttr", r), r.displayName = "translateAttrDirective", angular.module("pascalprecht.translate").directive("translateCloak", i), i.displayName = "translateCloakDirective", angular.module("pascalprecht.translate").directive("translateNamespace", s), s.displayName = "translateNamespaceDirective", angular.module("pascalprecht.translate").directive("translateLanguage", o), o.displayName = "translateLanguageDirective", angular.module("pascalprecht.translate").filter("translate", l), l.displayName = "translateFilterFactory", angular.module("pascalprecht.translate").factory("$translationCache", u), u.displayName = "$translationCache", "pascalprecht.translate" });
/*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function (e, t) { "function" == typeof define && define.amd ? define([], function () { return t() }) : "object" == typeof module && module.exports ? module.exports = t() : t() }(0, function () { function e(r, n) { "use strict"; return function (e) { if (!e || !e.url) throw new Error("Couldn't use urlLoader since no url is given!"); var t = {}; return t[e.queryParameter || "lang"] = e.key, n(angular.extend({ url: e.url, params: t, method: "GET" }, e.$http)).then(function (e) { return e.data }, function () { return r.reject(e.key) }) } } return e.$inject = ["$q", "$http"], angular.module("pascalprecht.translate").factory("$translateUrlLoader", e), e.displayName = "$translateUrlLoader", "pascalprecht.translate" });
/*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function (t, e) { "function" == typeof define && define.amd ? define([], function () { return e() }) : "object" == typeof module && module.exports ? module.exports = e() : e() }(0, function () { function t() { "use strict"; function a(t, e, r) { this.name = t, this.isActive = !0, this.tables = {}, this.priority = e || 0, this.langPromises = {}, this.urlTemplate = r } a.prototype.parseUrl = function (t, e) { return angular.isFunction(t) ? t(this.name, e) : t.replace(/\{part\}/g, this.name).replace(/\{lang\}/g, e) }, a.prototype.getTable = function (e, t, r, a, n, i) { var o = this, s = this.langPromises[e], l = t.defer(), u = function (t) { o.tables[e] = t, l.resolve(t) }, c = function () { l.reject(o.name) }, p = function () { r(angular.extend({ method: "GET", url: o.parseUrl(o.urlTemplate || n, e) }, a)).then(function (t) { u(t.data) }, function (t) { i ? i(o.name, e, t).then(u, c) : c() }) }; return this.tables[e] ? l.resolve(this.tables[e]) : (s ? s.then(l.resolve, p) : p(), this.langPromises[e] = l.promise), l.promise }; var n = {}; function i(t) { return Object.prototype.hasOwnProperty.call(n, t) } function f(t) { return angular.isString(t) && "" !== t } function t(t) { if (!f(t)) throw new TypeError("Invalid type of a first argument, a non-empty string expected."); return i(t) && n[t].isActive } function d() { var t = []; for (var e in n) n[e].isActive && t.push(n[e]); return t.sort(function (t, e) { return t.priority - e.priority }), t } this.addPart = function (t, e, r) { if (!f(t)) throw new TypeError("Couldn't add part, part name has to be a string!"); return i(t) || (n[t] = new a(t, e, r)), n[t].isActive = !0, this }, this.setPart = function (t, e, r) { if (!f(t)) throw new TypeError("Couldn't set part.`lang` parameter has to be a string!"); if (!f(e)) throw new TypeError("Couldn't set part.`part` parameter has to be a string!"); if ("object" != typeof r || null === r) throw new TypeError("Couldn't set part. `table` parameter has to be an object!"); return i(e) || (n[e] = new a(e), n[e].isActive = !1), n[e].tables[t] = r, this }, this.deletePart = function (t) { if (!f(t)) throw new TypeError("Couldn't delete part, first arg has to be string."); return i(t) && (n[t].isActive = !1), this }, this.isPartAvailable = t, this.$get = ["$rootScope", "$injector", "$q", "$http", "$log", function (o, s, l, u, c) { var p = function (r) { if (!f(r.key)) throw new TypeError("Unable to load data, a key is not a non-empty string."); if (!f(r.urlTemplate) && !angular.isFunction(r.urlTemplate)) throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string or not a function."); var e = r.loadFailureHandler; if (void 0 !== e) { if (!angular.isString(e)) throw new Error("Unable to load data, a loadFailureHandler is not a string."); e = s.get(e) } var a = [], t = d(); angular.forEach(t, function (t) { a.push(t.getTable(r.key, l, u, r.$http, r.urlTemplate, e)), t.urlTemplate = t.urlTemplate || r.urlTemplate }); var n = !1, i = o.$on("$translatePartialLoaderStructureChanged", function () { n = !0 }); return l.all(a).then(function () { if (i(), n) { if (!r.__retries) return r.__retries = (r.__retries || 0) + 1, p(r); c.warn("The partial loader has detected a multiple structure change (with addPort/removePart) while loading translations. You should consider using promises of $translate.use(lang) and $translate.refresh(). Also parts should be added/removed right before an explicit refresh if possible.") } var e = {}; return t = d(), angular.forEach(t, function (t) { !function t(e, r) { for (var a in r) r[a] && r[a].constructor && r[a].constructor === Object ? (e[a] = e[a] || {}, t(e[a], r[a])) : e[a] = r[a]; return e }(e, t.tables[r.key]) }), e }, function () { return i(), l.reject(r.key) }) }; return p.addPart = function (t, e, r) { if (!f(t)) throw new TypeError("Couldn't add part, first arg has to be a string"); return i(t) ? n[t].isActive || (n[t].isActive = !0, o.$emit("$translatePartialLoaderStructureChanged", t)) : (n[t] = new a(t, e, r), o.$emit("$translatePartialLoaderStructureChanged", t)), p }, p.deletePart = function (r, t) { if (!f(r)) throw new TypeError("Couldn't delete part, first arg has to be string"); if (void 0 === t) t = !1; else if ("boolean" != typeof t) throw new TypeError("Invalid type of a second argument, a boolean expected."); if (i(r)) { var e = n[r].isActive; if (t) { var a = s.get("$translate").loaderCache(); "string" == typeof a && (a = s.get(a)), "object" == typeof a && angular.forEach(n[r].tables, function (t, e) { a.remove(n[r].parseUrl(n[r].urlTemplate, e)) }), delete n[r] } else n[r].isActive = !1; e && o.$emit("$translatePartialLoaderStructureChanged", r) } return p }, p.isPartLoaded = function (t, e) { return angular.isDefined(n[t]) && angular.isDefined(n[t].tables[e]) }, p.getRegisteredParts = function () { var e = []; return angular.forEach(n, function (t) { t.isActive && e.push(t.name) }), e }, p.isPartAvailable = t, p }] } return angular.module("pascalprecht.translate").provider("$translatePartialLoader", t), t.displayName = "$translatePartialLoader", "pascalprecht.translate" });
/**
* oclazyload - Load modules on demand (lazy load) with angularJS
* @version v1.0.10
* @link https://github.com/ocombe/ocLazyLoad
* @license MIT
* @author Olivier Combe
*/
!function(e,n){"use strict";var r=["ng","oc.lazyLoad"],o={},t=[],i=[],a=[],s=[],u=e.noop,c={},d=[],l=e.module("oc.lazyLoad",["ng"]);l.provider("$ocLazyLoad",["$controllerProvider","$provide","$compileProvider","$filterProvider","$injector","$animateProvider",function(l,f,p,m,v,y){function L(n,o,t){if(o){var i,s,l,f=[];for(i=o.length-1;i>=0;i--)if(s=o[i],e.isString(s)||(s=E(s)),s&&-1===d.indexOf(s)&&(!w[s]||-1!==a.indexOf(s))){var h=-1===r.indexOf(s);if(l=g(s),h&&(r.push(s),L(n,l.requires,t)),l._runBlocks.length>0)for(c[s]=[];l._runBlocks.length>0;)c[s].push(l._runBlocks.shift());e.isDefined(c[s])&&(h||t.rerun)&&(f=f.concat(c[s])),j(n,l._invokeQueue,s,t.reconfig),j(n,l._configBlocks,s,t.reconfig),u(h?"ocLazyLoad.moduleLoaded":"ocLazyLoad.moduleReloaded",s),o.pop(),d.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 d=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))d(a,n[2][1]);else{if(!e.isObject(a))return!1;e.forEach(a,function(n,r){e.isString(n)?d(n,a[1]):d(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 d=$(u,o);if("invoke"!==u[1])d&&e.isDefined(c)&&c[u[1]].apply(c,u[2]);else{var l=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]))l(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])&&l(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:l,$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 d=function l(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,l)}};e.forEach(i,function(e){d(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,l){function f(e){var r=l.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 l.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)}))}}),l.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=l.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))}),l.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{d=[],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,l,g){return r=["ng","oc.lazyLoad"],o={},t=[],i=[],a=[],s=[],u=e.noop,c={},d=[],e.forEach(l.slice(),function(e){h(e,!0,!0)}),f(n,l,g)};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,d){var l,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":l=o.document.createElement("link"),l.type="text/css",l.rel="stylesheet",l.href=d.cache===!1?p(c):c;break;case"js":l=o.document.createElement("script"),l.src=d.cache===!1?p(c):c;break;default:g.remove(c),h.reject(new Error('Requested type "'+u+'" is not known. Could not inject "'+c+'"'))}l.onload=l.onreadystatechange=function(e){l.readyState&&!/^c|loade/.test(l.readyState)||f||(l.onload=l.onreadystatechange=null,f=1,n._broadcast("ocLazyLoad.fileLoaded",c),h.resolve(l))},l.onerror=function(){g.remove(c),h.reject(new Error("Unable to load "+c))},l.async=d.serie?0:1;var m=s.lastChild;if(d.insertBefore){var v=e.element(e.isDefined(window.jQuery)?d.insertBefore:document.querySelector(d.insertBefore));v&&v.length>0&&(m=v[0])}if(m.parentNode.insertBefore(l,m),"css"==u){if(!i){var y=o.navigator.userAgent.toLowerCase();if(y.indexOf("phantomjs/1.9")>-1)a=!0;else 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{l.sheet.cssRules,t.cancel(w),l.onload()}catch(e){--_<=0&&l.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,d=n._getFilesCache();n.toggleWatch(!0),e.extend(t,o);var l=function(r){var o,l=null;if(e.isObject(r)&&(l=r.type,r=r.path),c=d.get(r),e.isUndefined(c)||t.cache===!1){if(null!==(o=/^(css|less|html|htm|js)?(?=!)/.exec(r))&&(l=o[1],r=r.substr(o[1].length+1,r.length)),!l)if(null!==(o=/[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(r)))l=o[1];else{if(n.jsLoader.hasOwnProperty("ocLazyLoadLoader")||!n.jsLoader.hasOwnProperty("requirejs"))return void n._$log.error("File type could not be determined. "+r);l="js"}"css"!==l&&"less"!==l||-1!==i.indexOf(r)?"html"!==l&&"htm"!==l||-1!==a.indexOf(r)?"js"===l||-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?l(t.files.shift()):e.forEach(t.files,function(e){l(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(),d=e.copy(o),l=e.copy(i);if(e.isArray(d))return e.forEach(d,function(e){u.push(a.load(e,l))}),r.all(u).then(function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise;if(e.isString(d)?(s=a.getModuleConfig(d),s||(s={files:[d]})):e.isObject(d)&&(s=e.isDefined(d.path)&&e.isDefined(d.type)?{files:[d]}:a.setModuleConfig(d)),null===s){var f=a._getModuleName(d);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({},l,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).then(function(o){var t=o.data;e.isString(t)&&t.length>0&&e.forEach(e.element(t),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()})["catch"](function(e){i.reject(new Error('Unable to load template file "'+n+'": '+e.data))})}),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});
/*!
* ASP.NET SignalR JavaScript Library v2.2.2
* http://signalr.net/
*
* Copyright (c) .NET Foundation. All rights reserved.
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*
*/
(function(n,t,i){function w(t,i){var u,f;if(n.isArray(t)){for(u=t.length-1;u>=0;u--)f=t[u],n.type(f)==="string"&&r.transports[f]||(i.log("Invalid transport: "+f+", removing it from the transports list."),t.splice(u,1));t.length===0&&(i.log("No transports remain within the specified transport array."),t=null)}else if(r.transports[t]||t==="auto"){if(t==="auto"&&r._.ieVersion<=8)return["longPolling"]}else i.log("Invalid transport: "+t.toString()+"."),t=null;return t}function b(n){return n==="http:"?80:n==="https:"?443:void 0}function a(n,t){return t.match(/:\d+$/)?t:t+":"+b(n)}function k(t,i){var u=this,r=[];u.tryBuffer=function(i){return t.state===n.signalR.connectionState.connecting?(r.push(i),!0):!1};u.drain=function(){if(t.state===n.signalR.connectionState.connected)while(r.length>0)i(r.shift())};u.clear=function(){r=[]}}var f={nojQuery:"jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",noTransportOnInit:"No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.",errorOnNegotiate:"Error during negotiation request.",stoppedWhileLoading:"The connection was stopped during page load.",stoppedWhileNegotiating:"The connection was stopped during the negotiate request.",errorParsingNegotiateResponse:"Error parsing negotiate response.",errorDuringStartRequest:"Error during start request. Stopping the connection.",stoppedDuringStartRequest:"The connection was stopped during the start request.",errorParsingStartResponse:"Error parsing start response: '{0}'. Stopping the connection.",invalidStartResponse:"Invalid start response: '{0}'. Stopping the connection.",protocolIncompatible:"You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",sendFailed:"Send failed.",parseFailed:"Failed at parsing response: {0}",longPollFailed:"Long polling request failed.",eventSourceFailedToConnect:"EventSource failed to connect.",eventSourceError:"Error raised by EventSource",webSocketClosed:"WebSocket closed.",pingServerFailedInvalidResponse:"Invalid ping response when pinging server: '{0}'.",pingServerFailed:"Failed to ping server.",pingServerFailedStatusCode:"Failed to ping server. Server responded with status code {0}, stopping the connection.",pingServerFailedParse:"Failed to parse ping server response, stopping the connection.",noConnectionTransport:"Connection is in an invalid state, there is no transport active.",webSocketsInvalidState:"The Web Socket transport is in an invalid state, transitioning into reconnecting.",reconnectTimeout:"Couldn't reconnect within the configured timeout of {0} ms, disconnecting.",reconnectWindowTimeout:"The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection."};if(typeof n!="function")throw new Error(f.nojQuery);var r,h,o=t.document.readyState==="complete",e=n(t),c="__Negotiate Aborted__",u={onStart:"onStart",onStarting:"onStarting",onReceived:"onReceived",onError:"onError",onConnectionSlow:"onConnectionSlow",onReconnecting:"onReconnecting",onReconnect:"onReconnect",onStateChanged:"onStateChanged",onDisconnect:"onDisconnect"},v=function(n,i){if(i!==!1){var r;typeof t.console!="undefined"&&(r="["+(new Date).toTimeString()+"] SignalR: "+n,t.console.debug?t.console.debug(r):t.console.log&&t.console.log(r))}},s=function(t,i,r){return i===t.state?(t.state=r,n(t).triggerHandler(u.onStateChanged,[{oldState:i,newState:r}]),!0):!1},y=function(n){return n.state===r.connectionState.disconnected},l=function(n){return n._.keepAliveData.activated&&n.transport.supportsKeepAlive(n)},p=function(i){var f,e;i._.configuredStopReconnectingTimeout||(e=function(t){var i=r._.format(r.resources.reconnectTimeout,t.disconnectTimeout);t.log(i);n(t).triggerHandler(u.onError,[r._.error(i,"TimeoutException")]);t.stop(!1,!1)},i.reconnecting(function(){var n=this;n.state===r.connectionState.reconnecting&&(f=t.setTimeout(function(){e(n)},n.disconnectTimeout))}),i.stateChanged(function(n){n.oldState===r.connectionState.reconnecting&&t.clearTimeout(f)}),i._.configuredStopReconnectingTimeout=!0)};if(r=function(n,t,i){return new r.fn.init(n,t,i)},r._={defaultContentType:"application/x-www-form-urlencoded; charset=UTF-8",ieVersion:function(){var i,n;return t.navigator.appName==="Microsoft Internet Explorer"&&(n=/MSIE ([0-9]+\.[0-9]+)/.exec(t.navigator.userAgent),n&&(i=t.parseFloat(n[1]))),i}(),error:function(n,t,i){var r=new Error(n);return r.source=t,typeof i!="undefined"&&(r.context=i),r},transportError:function(n,t,r,u){var f=this.error(n,r,u);return f.transport=t?t.name:i,f},format:function(){for(var t=arguments[0],n=0;n<\/script>.");}},typeof e.on=="function")e.on("load",function(){o=!0});else e.load(function(){o=!0});r.fn=r.prototype={init:function(t,i,r){var f=n(this);this.url=t;this.qs=i;this.lastError=null;this._={keepAliveData:{},connectingMessageBuffer:new k(this,function(n){f.triggerHandler(u.onReceived,[n])}),lastMessageAt:(new Date).getTime(),lastActiveAt:(new Date).getTime(),beatInterval:5e3,beatHandle:null,totalTransportConnectTimeout:0};typeof r=="boolean"&&(this.logging=r)},_parseResponse:function(n){var t=this;return n?typeof n=="string"?t.json.parse(n):n:n},_originalJson:t.JSON,json:t.JSON,isCrossDomain:function(i,r){var u;return(i=n.trim(i),r=r||t.location,i.indexOf("http")!==0)?!1:(u=t.document.createElement("a"),u.href=i,u.protocol+a(u.protocol,u.host)!==r.protocol+a(r.protocol,r.host))},ajaxDataType:"text",contentType:"application/json; charset=UTF-8",logging:!1,state:r.connectionState.disconnected,clientProtocol:"1.5",reconnectDelay:2e3,transportConnectTimeout:0,disconnectTimeout:3e4,reconnectWindow:3e4,keepAliveWarnAt:2/3,start:function(i,h){var a=this,v={pingInterval:3e5,waitForPageLoad:!0,transport:"auto",jsonp:!1},d,y=a._deferral||n.Deferred(),b=t.document.createElement("a"),k,g;if(a.lastError=null,a._deferral=y,!a.json)throw new Error("SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.");if(n.type(i)==="function"?h=i:n.type(i)==="object"&&(n.extend(v,i),n.type(v.callback)==="function"&&(h=v.callback)),v.transport=w(v.transport,a),!v.transport)throw new Error("SignalR: Invalid transport(s) specified, aborting start.");return(a._.config=v,!o&&v.waitForPageLoad===!0)?(a._.deferredStartHandler=function(){a.start(i,h)},e.bind("load",a._.deferredStartHandler),y.promise()):a.state===r.connectionState.connecting?y.promise():s(a,r.connectionState.disconnected,r.connectionState.connecting)===!1?(y.resolve(a),y.promise()):(p(a),b.href=a.url,b.protocol&&b.protocol!==":"?(a.protocol=b.protocol,a.host=b.host):(a.protocol=t.document.location.protocol,a.host=b.host||t.document.location.host),a.baseUrl=a.protocol+"//"+a.host,a.wsProtocol=a.protocol==="https:"?"wss://":"ws://",v.transport==="auto"&&v.jsonp===!0&&(v.transport="longPolling"),a.url.indexOf("//")===0&&(a.url=t.location.protocol+a.url,a.log("Protocol relative URL detected, normalizing it to '"+a.url+"'.")),this.isCrossDomain(a.url)&&(a.log("Auto detected cross domain url."),v.transport==="auto"&&(v.transport=["webSockets","serverSentEvents","longPolling"]),typeof v.withCredentials=="undefined"&&(v.withCredentials=!0),v.jsonp||(v.jsonp=!n.support.cors,v.jsonp&&a.log("Using jsonp because this browser doesn't support CORS.")),a.contentType=r._.defaultContentType),a.withCredentials=v.withCredentials,a.ajaxDataType=v.jsonp?"jsonp":"text",n(a).bind(u.onStart,function(){n.type(h)==="function"&&h.call(a);y.resolve(a)}),a._.initHandler=r.transports._logic.initHandler(a),d=function(i,o){var c=r._.error(f.noTransportOnInit);if(o=o||0,o>=i.length){o===0?a.log("No transports supported by the server were selected."):o===1?a.log("No fallback transports were selected."):a.log("Fallback transports exhausted.");n(a).triggerHandler(u.onError,[c]);y.reject(c);a.stop();return}if(a.state!==r.connectionState.disconnected){var p=i[o],h=r.transports[p],v=function(){d(i,o+1)};a.transport=h;try{a._.initHandler.start(h,function(){var i=r._.firefoxMajorVersion(t.navigator.userAgent)>=11,f=!!a.withCredentials&&i;a.log("The start request succeeded. Transitioning to the connected state.");l(a)&&r.transports._logic.monitorKeepAlive(a);r.transports._logic.startHeartbeat(a);r._.configurePingInterval(a);s(a,r.connectionState.connecting,r.connectionState.connected)||a.log("WARNING! The connection was not in the connecting state.");a._.connectingMessageBuffer.drain();n(a).triggerHandler(u.onStart);e.bind("unload",function(){a.log("Window unloading, stopping the connection.");a.stop(f)});i&&e.bind("beforeunload",function(){t.setTimeout(function(){a.stop(f)},0)})},v)}catch(w){a.log(h.name+" transport threw '"+w.message+"' when attempting to start.");v()}}},k=a.url+"/negotiate",g=function(t,i){var e=r._.error(f.errorOnNegotiate,t,i._.negotiateRequest);n(i).triggerHandler(u.onError,e);y.reject(e);i.stop()},n(a).triggerHandler(u.onStarting),k=r.transports._logic.prepareQueryString(a,k),a.log("Negotiating with '"+k+"'."),a._.negotiateRequest=r.transports._logic.ajax(a,{url:k,error:function(n,t){t!==c?g(n,a):y.reject(r._.error(f.stoppedWhileNegotiating,null,a._.negotiateRequest))},success:function(t){var i,e,h,o=[],s=[];try{i=a._parseResponse(t)}catch(c){g(r._.error(f.errorParsingNegotiateResponse,c),a);return}if(e=a._.keepAliveData,a.appRelativeUrl=i.Url,a.id=i.ConnectionId,a.token=i.ConnectionToken,a.webSocketServerUrl=i.WebSocketServerUrl,a._.pollTimeout=i.ConnectionTimeout*1e3+1e4,a.disconnectTimeout=i.DisconnectTimeout*1e3,a._.totalTransportConnectTimeout=a.transportConnectTimeout+i.TransportConnectTimeout*1e3,i.KeepAliveTimeout?(e.activated=!0,e.timeout=i.KeepAliveTimeout*1e3,e.timeoutWarning=e.timeout*a.keepAliveWarnAt,a._.beatInterval=(e.timeout-e.timeoutWarning)/3):e.activated=!1,a.reconnectWindow=a.disconnectTimeout+(e.timeout||0),!i.ProtocolVersion||i.ProtocolVersion!==a.clientProtocol){h=r._.error(r._.format(f.protocolIncompatible,a.clientProtocol,i.ProtocolVersion));n(a).triggerHandler(u.onError,[h]);y.reject(h);return}n.each(r.transports,function(n){if(n.indexOf("_")===0||n==="webSockets"&&!i.TryWebSockets)return!0;s.push(n)});n.isArray(v.transport)?n.each(v.transport,function(t,i){n.inArray(i,s)>=0&&o.push(i)}):v.transport==="auto"?o=s:n.inArray(v.transport,s)>=0&&o.push(v.transport);d(o)}}),y.promise())},starting:function(t){var i=this;return n(i).bind(u.onStarting,function(){t.call(i)}),i},send:function(n){var t=this;if(t.state===r.connectionState.disconnected)throw new Error("SignalR: Connection must be started before data can be sent. Call .start() before .send()");if(t.state===r.connectionState.connecting)throw new Error("SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.");return t.transport.send(t,n),t},received:function(t){var i=this;return n(i).bind(u.onReceived,function(n,r){t.call(i,r)}),i},stateChanged:function(t){var i=this;return n(i).bind(u.onStateChanged,function(n,r){t.call(i,r)}),i},error:function(t){var i=this;return n(i).bind(u.onError,function(n,r,u){i.lastError=r;t.call(i,r,u)}),i},disconnected:function(t){var i=this;return n(i).bind(u.onDisconnect,function(){t.call(i)}),i},connectionSlow:function(t){var i=this;return n(i).bind(u.onConnectionSlow,function(){t.call(i)}),i},reconnecting:function(t){var i=this;return n(i).bind(u.onReconnecting,function(){t.call(i)}),i},reconnected:function(t){var i=this;return n(i).bind(u.onReconnect,function(){t.call(i)}),i},stop:function(i,h){var a=this,v=a._deferral;if(a._.deferredStartHandler&&e.unbind("load",a._.deferredStartHandler),delete a._.config,delete a._.deferredStartHandler,!o&&(!a._.config||a._.config.waitForPageLoad===!0)){a.log("Stopping connection prior to negotiate.");v&&v.reject(r._.error(f.stoppedWhileLoading));return}if(a.state!==r.connectionState.disconnected)return a.log("Stopping connection."),t.clearTimeout(a._.beatHandle),t.clearInterval(a._.pingIntervalId),a.transport&&(a.transport.stop(a),h!==!1&&a.transport.abort(a,i),l(a)&&r.transports._logic.stopMonitoringKeepAlive(a),a.transport=null),a._.negotiateRequest&&(a._.negotiateRequest.abort(c),delete a._.negotiateRequest),a._.initHandler&&a._.initHandler.stop(),delete a._deferral,delete a.messageId,delete a.groupsToken,delete a.id,delete a._.pingIntervalId,delete a._.lastMessageAt,delete a._.lastActiveAt,a._.connectingMessageBuffer.clear(),n(a).unbind(u.onStart),s(a,a.state,r.connectionState.disconnected),n(a).triggerHandler(u.onDisconnect),a},log:function(n){v(n,this.logging)}};r.fn.init.prototype=r.fn;r.noConflict=function(){return n.connection===r&&(n.connection=h),r};n.connection&&(h=n.connection);n.connection=n.signalR=r})(window.jQuery,window),function(n,t,i){function s(n){n._.keepAliveData.monitoring&&l(n);u.markActive(n)&&(n._.beatHandle=t.setTimeout(function(){s(n)},n._.beatInterval))}function l(t){var i=t._.keepAliveData,u;t.state===r.connectionState.connected&&(u=(new Date).getTime()-t._.lastMessageAt,u>=i.timeout?(t.log("Keep alive timed out. Notifying transport that connection has been lost."),t.transport.lostConnection(t)):u>=i.timeoutWarning?i.userNotified||(t.log("Keep alive has been missed, connection may be dead/slow."),n(t).triggerHandler(f.onConnectionSlow),i.userNotified=!0):i.userNotified=!1)}function e(n,t){var i=n.url+t;return n.transport&&(i+="?transport="+n.transport.name),u.prepareQueryString(n,i)}function h(n){this.connection=n;this.startRequested=!1;this.startCompleted=!1;this.connectionStopped=!1}var r=n.signalR,f=n.signalR.events,c=n.signalR.changeState,o="__Start Aborted__",u;r.transports={};h.prototype={start:function(n,r,u){var f=this,e=f.connection,o=!1;if(f.startRequested||f.connectionStopped){e.log("WARNING! "+n.name+" transport cannot be started. Initialization ongoing or completed.");return}e.log(n.name+" transport starting.");n.start(e,function(){o||f.initReceived(n,r)},function(t){return o||(o=!0,f.transportFailed(n,t,u)),!f.startCompleted||f.connectionStopped});f.transportTimeoutHandle=t.setTimeout(function(){o||(o=!0,e.log(n.name+" transport timed out when trying to connect."),f.transportFailed(n,i,u))},e._.totalTransportConnectTimeout)},stop:function(){this.connectionStopped=!0;t.clearTimeout(this.transportTimeoutHandle);r.transports._logic.tryAbortStartRequest(this.connection)},initReceived:function(n,i){var u=this,f=u.connection;if(u.startRequested){f.log("WARNING! The client received multiple init messages.");return}u.connectionStopped||(u.startRequested=!0,t.clearTimeout(u.transportTimeoutHandle),f.log(n.name+" transport connected. Initiating start request."),r.transports._logic.ajaxStart(f,function(){u.startCompleted=!0;i()}))},transportFailed:function(i,u,e){var o=this.connection,h=o._deferral,s;this.connectionStopped||(t.clearTimeout(this.transportTimeoutHandle),this.startRequested?this.startCompleted||(s=r._.error(r.resources.errorDuringStartRequest,u),o.log(i.name+" transport failed during the start request. Stopping the connection."),n(o).triggerHandler(f.onError,[s]),h&&h.reject(s),o.stop()):(i.stop(o),o.log(i.name+" transport failed to connect. Attempting to fall back."),e()))}};u=r.transports._logic={ajax:function(t,i){return n.ajax(n.extend(!0,{},n.signalR.ajaxDefaults,{type:"GET",data:{},xhrFields:{withCredentials:t.withCredentials},contentType:t.contentType,dataType:t.ajaxDataType},i))},pingServer:function(t){var e,f,i=n.Deferred();return t.transport?(e=t.url+"/ping",e=u.addQs(e,t.qs),f=u.ajax(t,{url:e,success:function(n){var u;try{u=t._parseResponse(n)}catch(e){i.reject(r._.transportError(r.resources.pingServerFailedParse,t.transport,e,f));t.stop();return}u.Response==="pong"?i.resolve():i.reject(r._.transportError(r._.format(r.resources.pingServerFailedInvalidResponse,n),t.transport,null,f))},error:function(n){n.status===401||n.status===403?(i.reject(r._.transportError(r._.format(r.resources.pingServerFailedStatusCode,n.status),t.transport,n,f)),t.stop()):i.reject(r._.transportError(r.resources.pingServerFailed,t.transport,n,f))}})):i.reject(r._.transportError(r.resources.noConnectionTransport,t.transport)),i.promise()},prepareQueryString:function(n,i){var r;return r=u.addQs(i,"clientProtocol="+n.clientProtocol),r=u.addQs(r,n.qs),n.token&&(r+="&connectionToken="+t.encodeURIComponent(n.token)),n.data&&(r+="&connectionData="+t.encodeURIComponent(n.data)),r},addQs:function(t,i){var r=t.indexOf("?")!==-1?"&":"?",u;if(!i)return t;if(typeof i=="object")return t+r+n.param(i);if(typeof i=="string")return u=i.charAt(0),(u==="?"||u==="&")&&(r=""),t+r+i;throw new Error("Query string property must be either a string or object.");},getUrl:function(n,i,r,f,e){var h=i==="webSockets"?"":n.baseUrl,o=h+n.appRelativeUrl,s="transport="+i;return!e&&n.groupsToken&&(s+="&groupsToken="+t.encodeURIComponent(n.groupsToken)),r?(o+=f?"/poll":"/reconnect",!e&&n.messageId&&(s+="&messageId="+t.encodeURIComponent(n.messageId))):o+="/connect",o+="?"+s,o=u.prepareQueryString(n,o),e||(o+="&tid="+Math.floor(Math.random()*11)),o},maximizePersistentResponse:function(n){return{MessageId:n.C,Messages:n.M,Initialized:typeof n.S!="undefined"?!0:!1,ShouldReconnect:typeof n.T!="undefined"?!0:!1,LongPollDelay:n.L,GroupsToken:n.G}},updateGroups:function(n,t){t&&(n.groupsToken=t)},stringifySend:function(n,t){return typeof t=="string"||typeof t=="undefined"||t===null?t:n.json.stringify(t)},ajaxSend:function(t,i){var h=u.stringifySend(t,i),c=e(t,"/send"),o,s=function(t,u){n(u).triggerHandler(f.onError,[r._.transportError(r.resources.sendFailed,u.transport,t,o),i])};return o=u.ajax(t,{url:c,type:t.ajaxDataType==="jsonp"?"GET":"POST",contentType:r._.defaultContentType,data:{data:h},success:function(n){var i;if(n){try{i=t._parseResponse(n)}catch(r){s(r,t);t.stop();return}u.triggerReceived(t,i)}},error:function(n,i){i!=="abort"&&i!=="parsererror"&&s(n,t)}})},ajaxAbort:function(n,t){if(typeof n.transport!="undefined"){t=typeof t=="undefined"?!0:t;var i=e(n,"/abort");u.ajax(n,{url:i,async:t,timeout:1e3,type:"POST"});n.log("Fired ajax abort async = "+t+".")}},ajaxStart:function(t,i){var h=function(n){var i=t._deferral;i&&i.reject(n)},s=function(i){t.log("The start request failed. Stopping the connection.");n(t).triggerHandler(f.onError,[i]);h(i);t.stop()};t._.startRequest=u.ajax(t,{url:e(t,"/start"),success:function(n,u,f){var e;try{e=t._parseResponse(n)}catch(o){s(r._.error(r._.format(r.resources.errorParsingStartResponse,n),o,f));return}e.Response==="started"?i():s(r._.error(r._.format(r.resources.invalidStartResponse,n),null,f))},error:function(n,i,u){i!==o?s(r._.error(r.resources.errorDuringStartRequest,u,n)):(t.log("The start request aborted because connection.stop() was called."),h(r._.error(r.resources.stoppedDuringStartRequest,null,n)))}})},tryAbortStartRequest:function(n){n._.startRequest&&(n._.startRequest.abort(o),delete n._.startRequest)},tryInitialize:function(n,t,i){t.Initialized&&i?i():t.Initialized&&n.log("WARNING! The client received an init message after reconnecting.")},triggerReceived:function(t,i){t._.connectingMessageBuffer.tryBuffer(i)||n(t).triggerHandler(f.onReceived,[i])},processMessages:function(t,i,r){var f;u.markLastMessage(t);i&&(f=u.maximizePersistentResponse(i),u.updateGroups(t,f.GroupsToken),f.MessageId&&(t.messageId=f.MessageId),f.Messages&&(n.each(f.Messages,function(n,i){u.triggerReceived(t,i)}),u.tryInitialize(t,f,r)))},monitorKeepAlive:function(t){var i=t._.keepAliveData;i.monitoring?t.log("Tried to monitor keep alive but it's already being monitored."):(i.monitoring=!0,u.markLastMessage(t),t._.keepAliveData.reconnectKeepAliveUpdate=function(){u.markLastMessage(t)},n(t).bind(f.onReconnect,t._.keepAliveData.reconnectKeepAliveUpdate),t.log("Now monitoring keep alive with a warning timeout of "+i.timeoutWarning+", keep alive timeout of "+i.timeout+" and disconnecting timeout of "+t.disconnectTimeout))},stopMonitoringKeepAlive:function(t){var i=t._.keepAliveData;i.monitoring&&(i.monitoring=!1,n(t).unbind(f.onReconnect,t._.keepAliveData.reconnectKeepAliveUpdate),t._.keepAliveData={},t.log("Stopping the monitoring of the keep alive."))},startHeartbeat:function(n){n._.lastActiveAt=(new Date).getTime();s(n)},markLastMessage:function(n){n._.lastMessageAt=(new Date).getTime()},markActive:function(n){return u.verifyLastActive(n)?(n._.lastActiveAt=(new Date).getTime(),!0):!1},isConnectedOrReconnecting:function(n){return n.state===r.connectionState.connected||n.state===r.connectionState.reconnecting},ensureReconnectingState:function(t){return c(t,r.connectionState.connected,r.connectionState.reconnecting)===!0&&n(t).triggerHandler(f.onReconnecting),t.state===r.connectionState.reconnecting},clearReconnectTimeout:function(n){n&&n._.reconnectTimeout&&(t.clearTimeout(n._.reconnectTimeout),delete n._.reconnectTimeout)},verifyLastActive:function(t){if((new Date).getTime()-t._.lastActiveAt>=t.reconnectWindow){var i=r._.format(r.resources.reconnectWindowTimeout,new Date(t._.lastActiveAt),t.reconnectWindow);return t.log(i),n(t).triggerHandler(f.onError,[r._.error(i,"TimeoutException")]),t.stop(!1,!1),!1}return!0},reconnect:function(n,i){var f=r.transports[i];if(u.isConnectedOrReconnecting(n)&&!n._.reconnectTimeout){if(!u.verifyLastActive(n))return;n._.reconnectTimeout=t.setTimeout(function(){u.verifyLastActive(n)&&(f.stop(n),u.ensureReconnectingState(n)&&(n.log(i+" reconnecting."),f.start(n)))},n.reconnectDelay)}},handleParseFailure:function(t,i,u,e,o){var s=r._.transportError(r._.format(r.resources.parseFailed,i),t.transport,u,o);e&&e(s)?t.log("Failed to parse server response while attempting to connect."):(n(t).triggerHandler(f.onError,[s]),t.stop())},initHandler:function(n){return new h(n)},foreverFrame:{count:0,connections:{}}}}(window.jQuery,window),function(n,t){var r=n.signalR,u=n.signalR.events,f=n.signalR.changeState,i=r.transports._logic;r.transports.webSockets={name:"webSockets",supportsKeepAlive:function(){return!0},send:function(t,f){var e=i.stringifySend(t,f);try{t.socket.send(e)}catch(o){n(t).triggerHandler(u.onError,[r._.transportError(r.resources.webSocketsInvalidState,t.transport,o,t.socket),f])}},start:function(e,o,s){var h,c=!1,l=this,a=!o,v=n(e);if(!t.WebSocket){s();return}e.socket||(h=e.webSocketServerUrl?e.webSocketServerUrl:e.wsProtocol+e.host,h+=i.getUrl(e,this.name,a),e.log("Connecting to websocket endpoint '"+h+"'."),e.socket=new t.WebSocket(h),e.socket.onopen=function(){c=!0;e.log("Websocket opened.");i.clearReconnectTimeout(e);f(e,r.connectionState.reconnecting,r.connectionState.connected)===!0&&v.triggerHandler(u.onReconnect)},e.socket.onclose=function(t){var i;this===e.socket&&(c&&typeof t.wasClean!="undefined"&&t.wasClean===!1?(i=r._.transportError(r.resources.webSocketClosed,e.transport,t),e.log("Unclean disconnect from websocket: "+(t.reason||"[no reason given]."))):e.log("Websocket closed."),s&&s(i)||(i&&n(e).triggerHandler(u.onError,[i]),l.reconnect(e)))},e.socket.onmessage=function(t){var r;try{r=e._parseResponse(t.data)}catch(u){i.handleParseFailure(e,t.data,u,s,t);return}r&&(n.isEmptyObject(r)||r.M?i.processMessages(e,r,o):i.triggerReceived(e,r))})},reconnect:function(n){i.reconnect(n,this.name)},lostConnection:function(n){this.reconnect(n)},stop:function(n){i.clearReconnectTimeout(n);n.socket&&(n.log("Closing the Websocket."),n.socket.close(),n.socket=null)},abort:function(n,t){i.ajaxAbort(n,t)}}}(window.jQuery,window),function(n,t){var i=n.signalR,u=n.signalR.events,e=n.signalR.changeState,r=i.transports._logic,f=function(n){t.clearTimeout(n._.reconnectAttemptTimeoutHandle);delete n._.reconnectAttemptTimeoutHandle};i.transports.serverSentEvents={name:"serverSentEvents",supportsKeepAlive:function(){return!0},timeOut:3e3,start:function(o,s,h){var c=this,l=!1,a=n(o),v=!s,y;if(o.eventSource&&(o.log("The connection already has an event source. Stopping it."),o.stop()),!t.EventSource){h&&(o.log("This browser doesn't support SSE."),h());return}y=r.getUrl(o,this.name,v);try{o.log("Attempting to connect to SSE endpoint '"+y+"'.");o.eventSource=new t.EventSource(y,{withCredentials:o.withCredentials})}catch(p){o.log("EventSource failed trying to connect with error "+p.Message+".");h?h():(a.triggerHandler(u.onError,[i._.transportError(i.resources.eventSourceFailedToConnect,o.transport,p)]),v&&c.reconnect(o));return}v&&(o._.reconnectAttemptTimeoutHandle=t.setTimeout(function(){l===!1&&o.eventSource.readyState!==t.EventSource.OPEN&&c.reconnect(o)},c.timeOut));o.eventSource.addEventListener("open",function(){o.log("EventSource connected.");f(o);r.clearReconnectTimeout(o);l===!1&&(l=!0,e(o,i.connectionState.reconnecting,i.connectionState.connected)===!0&&a.triggerHandler(u.onReconnect))},!1);o.eventSource.addEventListener("message",function(n){var t;if(n.data!=="initialized"){try{t=o._parseResponse(n.data)}catch(i){r.handleParseFailure(o,n.data,i,h,n);return}r.processMessages(o,t,s)}},!1);o.eventSource.addEventListener("error",function(n){var r=i._.transportError(i.resources.eventSourceError,o.transport,n);this===o.eventSource&&(h&&h(r)||(o.log("EventSource readyState: "+o.eventSource.readyState+"."),n.eventPhase===t.EventSource.CLOSED?(o.log("EventSource reconnecting due to the server connection ending."),c.reconnect(o)):(o.log("EventSource error."),a.triggerHandler(u.onError,[r]))))},!1)},reconnect:function(n){r.reconnect(n,this.name)},lostConnection:function(n){this.reconnect(n)},send:function(n,t){r.ajaxSend(n,t)},stop:function(n){f(n);r.clearReconnectTimeout(n);n&&n.eventSource&&(n.log("EventSource calling close()."),n.eventSource.close(),n.eventSource=null,delete n.eventSource)},abort:function(n,t){r.ajaxAbort(n,t)}}}(window.jQuery,window),function(n,t){var r=n.signalR,e=n.signalR.events,o=n.signalR.changeState,i=r.transports._logic,u=function(){var n=t.document.createElement("iframe");return n.setAttribute("style","position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;"),n},f=function(){var i=null,f=1e3,n=0;return{prevent:function(){r._.ieVersion<=8&&(n===0&&(i=t.setInterval(function(){var n=u();t.document.body.appendChild(n);t.document.body.removeChild(n);n=null},f)),n++)},cancel:function(){n===1&&t.clearInterval(i);n>0&&n--}}}();r.transports.foreverFrame={name:"foreverFrame",supportsKeepAlive:function(){return!0},iframeClearThreshold:50,start:function(n,r,e){var l=this,s=i.foreverFrame.count+=1,h,o=u(),c=function(){n.log("Forever frame iframe finished loading and is no longer receiving messages.");e&&e()||l.reconnect(n)};if(t.EventSource){e&&(n.log("Forever Frame is not supported by SignalR on browsers with SSE support."),e());return}o.setAttribute("data-signalr-connection-id",n.id);f.prevent();h=i.getUrl(n,this.name);h+="&frameId="+s;t.document.documentElement.appendChild(o);n.log("Binding to iframe's load event.");o.addEventListener?o.addEventListener("load",c,!1):o.attachEvent&&o.attachEvent("onload",c);o.src=h;i.foreverFrame.connections[s]=n;n.frame=o;n.frameId=s;r&&(n.onSuccess=function(){n.log("Iframe transport started.");r()})},reconnect:function(n){var r=this;i.isConnectedOrReconnecting(n)&&i.verifyLastActive(n)&&t.setTimeout(function(){if(i.verifyLastActive(n)&&n.frame&&i.ensureReconnectingState(n)){var u=n.frame,t=i.getUrl(n,r.name,!0)+"&frameId="+n.frameId;n.log("Updating iframe src to '"+t+"'.");u.src=t}},n.reconnectDelay)},lostConnection:function(n){this.reconnect(n)},send:function(n,t){i.ajaxSend(n,t)},receive:function(t,u){var f,e,o;if(t.json!==t._originalJson&&(u=t._originalJson.stringify(u)),o=t._parseResponse(u),i.processMessages(t,o,t.onSuccess),t.state===n.signalR.connectionState.connected&&(t.frameMessageCount=(t.frameMessageCount||0)+1,t.frameMessageCount>r.transports.foreverFrame.iframeClearThreshold&&(t.frameMessageCount=0,f=t.frame.contentWindow||t.frame.contentDocument,f&&f.document&&f.document.body)))for(e=f.document.body;e.firstChild;)e.removeChild(e.firstChild)},stop:function(n){var r=null;if(f.cancel(),n.frame){if(n.frame.stop)n.frame.stop();else try{r=n.frame.contentWindow||n.frame.contentDocument;r.document&&r.document.execCommand&&r.document.execCommand("Stop")}catch(u){n.log("Error occurred when stopping foreverFrame transport. Message = "+u.message+".")}n.frame.parentNode===t.document.documentElement&&t.document.documentElement.removeChild(n.frame);delete i.foreverFrame.connections[n.frameId];n.frame=null;n.frameId=null;delete n.frame;delete n.frameId;delete n.onSuccess;delete n.frameMessageCount;n.log("Stopping forever frame.")}},abort:function(n,t){i.ajaxAbort(n,t)},getConnection:function(n){return i.foreverFrame.connections[n]},started:function(t){o(t,r.connectionState.reconnecting,r.connectionState.connected)===!0&&n(t).triggerHandler(e.onReconnect)}}}(window.jQuery,window),function(n,t){var r=n.signalR,u=n.signalR.events,e=n.signalR.changeState,f=n.signalR.isDisconnecting,i=r.transports._logic;r.transports.longPolling={name:"longPolling",supportsKeepAlive:function(){return!1},reconnectDelay:3e3,start:function(o,s,h){var a=this,v=function(){v=n.noop;o.log("LongPolling connected.");s?s():o.log("WARNING! The client received an init message after reconnecting.")},y=function(n){return h(n)?(o.log("LongPolling failed to connect."),!0):!1},c=o._,l=0,p=function(i){t.clearTimeout(c.reconnectTimeoutId);c.reconnectTimeoutId=null;e(i,r.connectionState.reconnecting,r.connectionState.connected)===!0&&(i.log("Raising the reconnect event"),n(i).triggerHandler(u.onReconnect))},w=36e5;o.pollXhr&&(o.log("Polling xhr requests already exists, aborting."),o.stop());o.messageId=null;c.reconnectTimeoutId=null;c.pollTimeoutId=t.setTimeout(function(){(function e(s,h){var g=s.messageId,nt=g===null,k=!nt,tt=!h,d=i.getUrl(s,a.name,k,tt,!0),b={};(s.messageId&&(b.messageId=s.messageId),s.groupsToken&&(b.groupsToken=s.groupsToken),f(s)!==!0)&&(o.log("Opening long polling request to '"+d+"'."),s.pollXhr=i.ajax(o,{xhrFields:{onprogress:function(){i.markLastMessage(o)}},url:d,type:"POST",contentType:r._.defaultContentType,data:b,timeout:o._.pollTimeout,success:function(r){var h,w=0,u,a;o.log("Long poll complete.");l=0;try{h=o._parseResponse(r)}catch(b){i.handleParseFailure(s,r,b,y,s.pollXhr);return}(c.reconnectTimeoutId!==null&&p(s),h&&(u=i.maximizePersistentResponse(h)),i.processMessages(s,h,v),u&&n.type(u.LongPollDelay)==="number"&&(w=u.LongPollDelay),f(s)!==!0)&&(a=u&&u.ShouldReconnect,!a||i.ensureReconnectingState(s))&&(w>0?c.pollTimeoutId=t.setTimeout(function(){e(s,a)},w):e(s,a))},error:function(f,h){var v=r._.transportError(r.resources.longPollFailed,o.transport,f,s.pollXhr);if(t.clearTimeout(c.reconnectTimeoutId),c.reconnectTimeoutId=null,h==="abort"){o.log("Aborted xhr request.");return}if(!y(v)){if(l++,o.state!==r.connectionState.reconnecting&&(o.log("An error occurred using longPolling. Status = "+h+". Response = "+f.responseText+"."),n(s).triggerHandler(u.onError,[v])),(o.state===r.connectionState.connected||o.state===r.connectionState.reconnecting)&&!i.verifyLastActive(o))return;if(!i.ensureReconnectingState(s))return;c.pollTimeoutId=t.setTimeout(function(){e(s,!0)},a.reconnectDelay)}}}),k&&h===!0&&(c.reconnectTimeoutId=t.setTimeout(function(){p(s)},Math.min(1e3*(Math.pow(2,l)-1),w))))})(o)},250)},lostConnection:function(n){n.pollXhr&&n.pollXhr.abort("lostConnection")},send:function(n,t){i.ajaxSend(n,t)},stop:function(n){t.clearTimeout(n._.pollTimeoutId);t.clearTimeout(n._.reconnectTimeoutId);delete n._.pollTimeoutId;delete n._.reconnectTimeoutId;n.pollXhr&&(n.pollXhr.abort(),n.pollXhr=null,delete n.pollXhr)},abort:function(n,t){i.ajaxAbort(n,t)}}}(window.jQuery,window),function(n){function r(n){return n+e}function s(n,t,i){for(var f=n.length,u=[],r=0;r= reconnectLimit) {
window.clearTimeout(timeout);
}
else {
timeout = setTimeout(function () {
hub.connection.start().done(function () {
currentRetries = 0;
}).fail(function () {
currentRetries++;
});
}, 5000);
}
}
},
stateChanged: function (state) {
switch (state.newState) {
case ConnectionState.Connecting:
signalrObject.IsHubconnected = false;
//your code here
break;
case ConnectionState.Connected:
signalrObject.IsHubconnected = true;
$rootScope.$broadcast('ConnectionState.Connected');
if (currentInterval == null) {
currentInterval = $interval(function () {
if (window.navigator.onLine !== false) {
signalrObject.send("ping");
}
else {
console.error('No internet connection!');
}
//Send ping to server!
}, 30000)
}
else {
console.log('currentInterval != null');
}
break;
case ConnectionState.Reconnecting:
signalrObject.IsHubconnected = false;
//your code here
break;
case ConnectionState.Disconnected:
signalrObject.IsHubconnected = false;
break;
}
},
logging: true
});
hub.connection.qs = { "BizPartAuthToken": getBizPartAuthToken() };
}
signalrObject.send = function (message) {
hub.sendToServer(message);
}
signalrObject.disconnect = function () {
hub.disconnect();
};
signalrObject.IsHubconnected = false;
return signalrObject;
}]);
(function (angular) {
angular.module('bizNotification', ['ng', 'bizPart', 'SignalR', "ngMaterial"]);
angular.module('bizNotification').run(bizNotificationRun);
angular.module('bizNotification').service('bizNotificationService', bizNotificationService);
bizNotificationRun.$inject = ["$rootScope", "bizNotificationService", "SignalRFactory"];
bizNotificationService.$inject = ["$timeout", "$mdToast"];
function bizNotificationRun($rootScope, bizNotificationService, SignalRFactory) {
//$rootScope.UserNotificationHub = SignalRFactory;
$rootScope.AuthToken = getBizPartAuthToken();
if (~~BizPart.Client.Core.CurrentUser.Id > 0 && !BizPart.Client.Core.CurrentTab.DisablePing) {
//$rootScope.UserNotificationHub.connect();
$rootScope.$on('SHOW_CUSTOM_NOTIFICATION', function (event, message) {
bizNotificationService.AddCustomNotification(message);
});
//$rootScope.$on('ConnectionState.Connected', function (event, args) {
//});
$rootScope.$on('HUB_CLIENT_MSG', function (event, args) {
console.log(args);
if (args.HubServerName == "HubNotification") {
var content = JSON.parse(args.Content);
if (content.Key == "CUSTOM") {
bizNotificationService.AddCustomNotification(content.Message);
}
else {
bizNotificationService.AddInformationNotification(content.Subject, content.Message);
}
}
})
//$rootScope.$on('SignalR.serverMessage', function (event, args) {
// console.log(args);
// if (args.HubServerName == "HubNotification") {
// var content = JSON.parse(args.Content);
// if (content.Key == "CUSTOM") {
// bizNotificationService.AddCustomNotification(content.Message);
// }
// else {
// bizNotificationService.AddInformationNotification(content.Subject, content.Message);
// }
// }
//});
}
}
function bizNotificationService($timeout, $mdToast) {
this.AddInformationNotification = function (header, body, timeout) {
var guid = randomString(5);
var html = ''
var bizNotification = angular.element(document.querySelector('#bizNotification'));
bizNotification.append(html);
$timeout(function (id) {
angular.element(document.querySelector('#' + id)).addClass('hide-notification');
$timeout(function (elemId) {
angular.element(document.querySelector('#' + elemId)).remove();
}, 350, true, id);
}, timeout || 10000, true, guid);
}
this.AddCustomNotification = function (content) {
var template = '' + content + ' ';
$mdToast.show({
position: 'top center',
parent: angular.element(document.body),
hideDelay: 20000,
template: template,
autoWrap: true,
controllerAs: 'vm',
controller: function ($mdToast) {
var vm = this;
vm.close = function () {
$mdToast.hide();
}
}
});
}
function randomString(len) {
charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var randomString = '';
for (var i = 0; i < len; i++) {
var randomPoz = Math.floor(Math.random() * charSet.length);
randomString += charSet.substring(randomPoz, randomPoz + 1);
}
return randomString;
}
}
})(window.angular);
(function (angular) {
angular.module('bizClientHub', ['ng', 'bizPart', 'SignalR']);
angular.module('bizClientHub').run(bizClientHubRun);
bizClientHubRun.$inject = ["$rootScope", "SignalRFactory"];
function bizClientHubRun($rootScope, SignalRFactory) {
$rootScope.ClientHub = SignalRFactory;
$rootScope.AuthToken = getBizPartAuthToken();
$rootScope.MsgQueue = [];
if (~~BizPart.Client.Core.CurrentUser.Id > 0 && !BizPart.Client.Core.CurrentTab.DisablePing) {
$rootScope.ClientHub.connect();
$rootScope.$on('ConnectionState.Connected', function (event, args) {
SendMessageQueue();
});
$rootScope.$on('SignalR.serverMessage', function (event, args) {
console.log(args);
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent("HubClientMsg", true, true, { "d": args });
window.dispatchEvent(evt);
if (args.HubServerName == "HubGeneric") {
var content = JSON.parse(args.Content);
if (content.Type == "SessionUpdated") {
BizPart.Client.Core.SessionTimer.Refresh();
}
}
});
window.addEventListener("HubClientSendServerMsg", HubClientSendServerMessage, false);
}
function HubClientSendServerMessage(data) {
var result = data.detail.d;
if (result) {
$rootScope.MsgQueue.push(result);
SendMessageQueue();
}
}
function SendMessageQueue() {
if ($rootScope.ClientHub.IsHubconnected) {
while ($rootScope.MsgQueue.length > 0) {
var msg = $rootScope.MsgQueue.splice(0, 1);
$rootScope.ClientHub.send(JSON.stringify(msg[0]));
}
}
}
}
})(window.angular);
(function (angular) {
angular.module('bizPart', ['ng', 'ngSanitize', 'ngMaterial', 'ui.router', 'bizMediabank']);
angular.module('bizPart').config(configFunction);
angular.module('bizPart').run(bizPartRun);
configFunction.$inject = ["$httpProvider", "$sceDelegateProvider", "$mdDateLocaleProvider"];
bizPartRun.$inject = ["$rootScope", "$http", "bizLocalStorageService", "bizPlaceholderService"];
function configFunction($httpProvider, $sceDelegateProvider, $mdDateLocaleProvider) {
$httpProvider.interceptors.push('loadingInterceptor');
var urlWhitelist = [
'self',
'https://www.youtube.com/**',
'https://view.officeapps.live.com/op/**'
];
if (portalSettings['CdnURL'])
urlWhitelist.push(portalSettings['CdnURL'] + "/**");
$sceDelegateProvider.resourceUrlWhitelist(urlWhitelist);
$mdDateLocaleProvider.parseDate = function (dateString) {
var m = moment(dateString, 'YYYY-MM-DD', true);
return m.isValid() ? m.toDate() : new Date(NaN);
};
$mdDateLocaleProvider.formatDate = function (date) {
var m = moment(date);
return m.isValid() ? m.format('YYYY-MM-DD') : '';
};
}
function bizPartRun($rootScope, $http, bizLocalStorageService) {
$rootScope.AuthToken = getBizPartAuthToken();
$http.defaults.headers.common['Auth-Token'] = $rootScope.AuthToken;
$rootScope.bizLocalStorageService = bizLocalStorageService;
$rootScope.GetDate = GetDate;
$rootScope.GetTimeLeft = GetTimeLeft;
$rootScope.GetNumberArray = GetNumberArray;
$rootScope.GetPhrase = GetPhrase;
$rootScope.siteRootPath = siteRootPath;
$rootScope.CurrentUser = BizPart.Client.Core.CurrentUser;
$rootScope.CurrentTab = BizPart.Client.Core.CurrentTab;
$rootScope.Cultures = BizPart.Client.Core.Cultures;
$rootScope.SendHubMessageToServer = SendHubMessageToServer;
function GetDate(date, format) {
return moment(date).format(format || "YYYY-MM-DD");
}
function GetPhrase(key) {
return BizPart.Client.Core.CurrentTab.GetPhrase(key);
}
function GetTimeLeft(toDate, fromDate) {
toDate = moment(toDate);
fromDate = fromDate ? moment(fromDate) : moment();
var diff = toDate.diff(fromDate);
var duration = moment.duration(diff);
var timeLeftSec = duration.seconds();
var timeLeftMin = duration.minutes();
var timeLeftHours = Math.floor(duration.asHours());
return timeLeftHours + " : " + timeLeftMin + " : " + timeLeftSec;
}
function GetNumberArray(num) {
var array = new Array(num);
for (var i = 0; i < num; i++) {
array[i] = i;
}
return array;
}
window.addEventListener("GetDefaultNewItemsEvent", GetDefaultNewItemsSuccess, false);
window.addEventListener("ShowCustomNotification", ShowCustomNotification, false);
window.addEventListener("HubClientMsg", HubClientMessage, false);
function HubClientMessage(data) {
var result = data.detail.d;
if (result)
$rootScope.$broadcast("HUB_CLIENT_MSG", result);
}
function SendHubMessageToServer(hubServerName, moiId, content) {
var serverMsg = {
HubServerName: hubServerName,
MoiId: moiId,
Content: JSON.stringify(content)
};
var evt = document.createEvent("CustomEvent");
evt.initCustomEvent("HubClientSendServerMsg", true, true, { "d": serverMsg });
window.dispatchEvent(evt);
}
function ShowCustomNotification(data) {
var message = data.detail;
if (message)
$rootScope.$broadcast("SHOW_CUSTOM_NOTIFICATION", message);
}
function GetDefaultNewItemsSuccess(data) {
var result = data.detail.d;
setTimeout(function () {
if (result && result.length > 0) {
$rootScope.$broadcast("GET_DEFAULT_NEW_ITEMS", result);
for (var i = 0; i < result.length; i++) {
$rootScope.$broadcast("GET_DEFAULT_NEW_ITEMS_" + result[i].Key.toUpperCase(), result[i].Value);
}
}
}, 1000);
}
$rootScope.MakeRequest = function (url, parameters, config) {
var promiseName = url + JSON.stringify(parameters);
if (!BizPart.Client.Core.Promises[promiseName]) {
BizPart.Client.Core.Promises[promiseName] = $http.post(url, parameters, config)
}
return BizPart.Client.Core.Promises[promiseName];
}
$rootScope.MakeGetRequest = function (url, parameters, config) {
var promiseName = url + JSON.stringify(parameters);
if (!BizPart.Client.Core.Promises[promiseName]) {
BizPart.Client.Core.Promises[promiseName] = $http.get(url, parameters, config)
}
return BizPart.Client.Core.Promises[promiseName];
}
if (BizPart.Client.Core.CurrentUser.Culture && moment.locale) {
moment.locale(BizPart.Client.Core.CurrentUser.Culture);
}
}
/* FILTERS */
angular.module('bizPart').filter('thousandSeparator', function () {
return function (input) {
if (isNaN(input) || input === null) {
return input;
}
input = input.toString().replace(/,/g, ' ');
return input.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
};
});
angular.module('bizPart').filter('bizFilterOr', bizFilterOr);
function bizFilterOr() {
return function (array, filters) {
if (!array)
return array;
var values = [];
for (var i = 0; i < array.length; i++) {
for (var j = 0; j < filters.length; j++) {
var match = true;
for (var key in filters[j]) {
if (array[i][key] !== filters[j][key])
match = false;
}
if (match) {
values.push(array[i]);
break;
}
}
}
return values;
}
}
angular.module('bizPart').filter('cut', function () {
return function (value, wordwise, max, tail) {
if (!value) return '';
max = parseInt(max, 10);
if (!max) return value;
if (value.length <= max) return value;
value = value.substr(0, max);
if (wordwise) {
var lastspace = value.lastIndexOf(' ');
if (lastspace !== -1) {
//Also remove . and , so its gives a cleaner result.
if (value.charAt(lastspace - 1) === '.' || value.charAt(lastspace - 1) === ',') {
lastspace = lastspace - 1;
}
value = value.substr(0, lastspace);
}
}
return value + (tail || ' …');
};
});
angular.module('bizPart').filter('bizTrust', bizTrust);
bizTrust.$inject = ["$sce"];
function bizTrust($sce) {
return function (value, as) {
if (!value) return value;
switch (as) {
case 'html':
return $sce.trustAsHtml(value);
break;
case 'url':
return $sce.trustAsUrl(value);
break;
case 'resource':
return $sce.trustAsResourceUrl(value);
break;
}
return value;
};
}
angular.module('bizPart').filter('bizPlaceholders', bizPlaceholdersFunction);
bizPlaceholdersFunction.$inject = ["$rootScope"];
function bizPlaceholdersFunction($rootScope) {
return function (html) {
function HandleHtml(html) {
//var newHtml = html.replace(urlPattern, '$& '); //This causes infinite recursion
var newHtml = html;
var newHtml = newHtml.replace(/##ICON-(.*?)-ICON##/gmi, ' ');
var newHtml = newHtml.replace(/##ICON-(.*?)##/gmi, ' ');
var newHtml = newHtml.replace(/##B-(.*?)-B##/gmi, '$1 ');
var newHtml = newHtml.replace(/##I-(.*?)##/gmi, '$1 ');
var newHtml = newHtml.replace(/##C(.*?)-(.*?)##/gmi, '$2 ');
var newHtml = newHtml.replace(/##LINK\$(.*?)\$(.*?)##(.*?)##LINK##/gmi, '$3 ');
var newHtml = newHtml.replace(/\r?\n/g, ' ');
//var newHtml = newHtml.replace(/##TITLE##/gmi, 'Blogtitle');
//Header tags (SEO)
var newHtml = newHtml.replace(/##H1-(.*?)-H1##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H2-(.*?)-H2##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H3-(.*?)-H3##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H4-(.*?)-H4##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H5-(.*?)-H5##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H6-(.*?)-H6##/gmi, '$1 ');
if ($rootScope.LoggedInUser && $rootScope.LoggedInUser.Id > 0) {
var newHtml = newHtml.replace(/##EXPERIENCE##/gmi, $rootScope.LoggedInUser.DefaultExperiencePoints);
var newHtml = newHtml.replace(/##FULLNAME##/gmi, $rootScope.LoggedInUser.FullName);
var newHtml = newHtml.replace(/##FIRSTNAME##/gmi, $rootScope.LoggedInUser.FirstName);
var newHtml = newHtml.replace(/##LASTNAME##/gmi, $rootScope.LoggedInUser.LastName);
if ($rootScope.LoggedInUser.DefaultLevel) {
var newHtml = newHtml.replace(/##LEVEL##/gmi, $rootScope.LoggedInUser.DefaultLevel.Id);
}
}
return newHtml;
}
return HandleHtml(html);
}
}
angular.module('bizPart').filter('bizCultureNames', bizCultureNamesFilter);
bizCultureNamesFilter.$inject = ["$rootScope"];
function bizCultureNamesFilter($rootScope) {
return function (value) {
var string = "";
for (var i = 0; i < value.length; i++) {
var cul = $rootScope.Cultures.GetItemByValue('Id', value[i].CultureId);
if (cul) {
string += cul.Name + ", ";
}
}
return string.substring(0, string.length - 2);
}
}
angular.module('bizPart').filter('bizRange', function () {
return function (n) {
var res = [];
for (var i = 0; i < n; i++) {
res.push(i);
}
return res;
};
});
angular.module('bizPart').filter('bizUnit', function () {
return function (value, unit, defaultValue) {
if (!value)
return defaultValue || value;
if (!isNaN(value))
value = value + unit;
return value;
};
});
angular.module('bizPart').filter('encodeURIComponentFilter', encodeURIComponentFilter);
function encodeURIComponentFilter() {
return window.encodeURIComponent();
}
angular.module('bizPart').filter('startFrom', function () {
return function (input, start) {
if (input) {
start = +start; //parse to int
return input.slice(start);
}
return [];
}
});
angular.module('bizPart').filter('bizPhrase', bizPhraseFilter);
bizPhraseFilter.$inject = ["$translate", "$rootScope"];
function bizPhraseFilter($translate, $rootScope) {
var phrases = {};
var promises = {};
filter.$stateful = true;
function filter(key) {
if (phrases[key])
return phrases[key];
if (promises[key])
return;
promises[key] = true;
$translate(key).then(function (translation) {
phrases[key] = translation.toString();
}, function (key) {
phrases[key] = undefined;
//console.warn(String.format("bizPhrase | Phrase not found for current culture ({0}): {1}", $translate.use(), key));
});
}
return filter;
}
angular.module('bizPart').filter('absolute', function () {
return function (value) {
if (!isNaN(value)) {
return Math.abs(value);
}
}
});
function GetSiteRoot(value) {
value = UrlRemapper(value);
if (value) {
if (hasWebpSupport === false) {
if (value.match(/\.(png|jpe?g)\.webp/i) != null) {
value = value.replace(/\.webp/i, '');
}
if (value.indexOf('GetFileHandler.ashx') > -1) {
value = value + '&noWebpSupport=true';
}
}
var cdnURL = portalSettings['CdnURL'];
if(value.indexOf(",") === 0) {
value = value.substring(1, value.length);
}
if (value.indexOf(' ') > -1) {
value = value.trim().replace(' ', '%20');
}
value = value.replace('##UPLOAD##/', portalUploadPath);
var override = getLocalStorage('override_siteroot_' + portalAlias.toLowerCase());
if (portalAlias.length > 0 && override != null && override.length > 0) {
if (value.indexOf('GetFileHandler.ashx') > -1) {
return override + value.replace('~/', '');
} else {
cdnURL = override + '/Upload';
}
}
if (value.indexOf('Upload/') > -1 && cdnURL.length > 0 && value.substring(0, 4) != "http") {
return cdnURL + value.replace('~/Upload', '').replace('/Upload', '').replace('Upload/', '/');
}
else if (value.substring(0, 4) == "http")
return value;
else if (value.substring(0, siteRootPath.length) == siteRootPath)
return value;
else if (value.substring(0, 1) == '/')
return siteRootPath + value.replace('/', '');
else
return siteRootPath + value.replace('~/', '');
}
}
function IsPathExcludedFromUrlMapper(value) {
if (value.match(/\.(png|jpe?g|svg|webp|mp4)$/i) != null)
return true;
return false;
}
function UrlRemapper(value) {
var newVal;
if (value && typeof (urlReMapper) !== 'undefined' && urlReMapper !== null && urlReMapper.length > 0 && !IsPathExcludedFromUrlMapper(value)) {
if (value.indexOf("http") < 0) {
var requestBase = document.location.origin + siteRootPath;
for (var i = 0; i < urlReMapper.length; i++) {
var re = new RegExp(urlReMapper[i].LookForRegEx);
if (re.test(value)) {
var sendTo = urlReMapper[i].SendToBase;
if (debug) {
sendTo = urlReMapper[i].SendToBaseDebug;
}
if (!sendTo.endsWith('/')) {
sendTo = sendTo + '/';
}
if (sendTo.toLowerCase() == requestBase.toLowerCase()) {
break;
}
newVal = value;
if (newVal.startsWith('/')) {
newVal = newVal.substring(1);
}
else if (newVal.startsWith('~/')) {
newVal = newVal.substring(2);
}
if (urlReMapper[i].IsQS) {
newVal += newVal.indexOf("?") >= 0 ? "&" : "?";
newVal = sendTo + newVal + "token=" + getBizPartAuthToken();
} else {
newVal = sendTo + "TokenLogin/" + getBizPartAuthToken() + "/" + newVal;
}
break;
}
}
}
}
return newVal || value;
}
function AppendSizeToUrl(src, size) {
if (src == undefined || src == null || src.length < 1)
return src
size = size === 'sm' || size === 'md' ? size : 'sm';
if (src.indexOf('GetFileHandler') > -1 && src.indexOf('size=') == -1 && src.indexOf('thumb') == -1)
return src + '&size=' + size;
if (src.indexOf('.svg') > -1)
return src;
const lastDotIndex = src.lastIndexOf(".");
return src.slice(0, lastDotIndex) + '_' + size + '.' + src.slice(lastDotIndex + 1);
}
angular.module('bizPart').filter('siteroot', function () {
return GetSiteRoot;
});
angular.module('bizPart').filter('size', function () {
return AppendSizeToUrl;
});
angular.module('bizPart').filter('thumb', function () {
return AppendSizeToUrl;
});
angular.module('bizPart').filter('fullsitepath', function () {
return function (value) {
if (value) {
var siteRoot = GetSiteRoot(value);
if (siteRoot.indexOf('http') > -1)
return siteRoot;
else
return document.location.protocol + "//" + document.location.host + siteRoot;
}
}
});
angular.module('bizPart').filter('hoursto', function () {
return function (time, isutc) {
if (time) {
var from = moment();
if (isutc) {
var date = new Date();
from = from.add(date.getTimezoneOffset(), 'minutes');
}
var to = moment(time);
var duration = moment.duration(to.diff(from));
return Math.floor(duration.asHours()) + 'H ' + duration.minutes() + 'M';
}
}
});
angular.module('bizPart').filter('date', function () {
return function (value, format) {
if (value) {
if (moment(value).isBefore(moment('0001-01-02')))
return '';
return moment(value).format(format || 'L');
}
}
});
angular.module('bizPart').filter('time', function () {
return function (value) {
if (value)
return moment(value).format('LT');
}
});
angular.module('bizPart').filter('datetime', function () {
return function (value, isutc) {
if (value) {
if (isutc) {
var m = moment(value);
return m.subtract(m.utcOffset(), 'm').format('L LT');
}
if (moment(value).isBefore(moment('0001-01-02')))
return '';
return moment(value).format('L LT');
}
}
});
angular.module('bizPart').filter('phrase', function () {
return function (value, key, placeholder, replacement) {
var phrase = BizPart.Client.Core.CurrentTab.GetPhrase(key);
if (phrase) {
if (placeholder && replacement)
phrase = phrase.replace(placeholder, replacement);
return phrase;
}
else
return value;
}
});
angular.module('bizPart').filter('htmlencode', function () {
return function (value) {
if (value)
return htmlEncode(value);
}
});
angular.module('bizPart').filter('htmldecode', function () {
return function (value) {
if (value)
return htmlDecode(value);
}
});
angular.module('bizPart').filter('urlencode', function () {
return function (value) {
if (value)
return encodeURIComponent(value);
}
});
angular.module('bizPart').filter('urldecode', function () {
return function (value) {
if (value)
return decodeURIComponent(value);
}
});
angular.module('bizPart').
filter('stripHtml', function () {
return function (text) {
return text ? String(text).replace(/<[^>]+>/gm, ' ') : '';
};
}
);
angular.module('bizPart').filter('greaterThan', function() {
return function(items, prop, val){
var returnItems = [];
for(var i = 0; i < items.length; i++) {
if(items[i][prop] > val) {
returnItems.push(items[i]);
}
}
return returnItems;
}
});
angular.module('bizPart').filter('showXP', function () {
return function (object, objectType) {
if (objectType == 'blog') {
return object && object.TotalPoints > 0;
}
}
});
angular.module('bizPart').filter('showCurrency', function () {
return function (object, objectType) {
if (objectType == 'blog') {
return object && object.TotalCoins > 0;
}
}
});
angular.module('bizPart').filter('positivenumber', function ($filter) {
return function (input, fractionSize) {
if (!input) {
return 0;
}
if (fractionSize !== undefined && fractionSize >= 0) {
input = $filter('number')(input, fractionSize);
}
return Math.abs(input);
};
});
/* SERVICES */
angular.module('bizPart').service('bizPhraseLoaderService', bizPhraseLoaderService);
bizPhraseLoaderService.$inject = ["$translatePartialLoader"];
function bizPhraseLoaderService($translatePartialLoader) {
this.PartOverrides = {};
this.LoadPart = function (part) {
$translatePartialLoader.addPart(part);
if (this.PartOverrides[part])
$translatePartialLoader.addPart(this.PartOverrides[part]);
}
}
angular.module('bizPart').service('bizPhraseLogService', bizPhraseLogService);
bizPhraseLogService.$inject = ["bizCoreService", "$q", "$http"];
function bizPhraseLogService(bizCoreService, $q, $http) {
this.Phrases = [];
this.IsEnabled = function () {
if (this.Promise)
return this.Promise;
var defer = $q.defer();
this.Promise = defer.promise;
bizCoreService.Admin.GetGenericSetting('CULTURE', 'bizPhraseLoggingEnabled', 0).then(function (response) {
defer.resolve(response.data);
});
return this.Promise;
};
this.LogPhrase = function (key, value, culture) {
this.IsEnabled().then(function (enabled) {
if (!enabled)
return;
$http.get(siteRootPath + "api/culture/LogBizPhrase", { params: { key: key, value: value, culture: culture } });
})
}
}
angular.module('bizPart').service('bizEngageService', bizEngageService);
bizEngageService.$inject = ['$http', '$window', '$rootScope', 'bizCoreService', '$q'];
function bizEngageService($http, $window, $rootScope, bizCoreService, $q) {
var apiPath = siteRootPath + 'api/Engage/';
var types = {
HTML5: 1,
Blog: 2,
MediabankFile: 3
};
var statuses = {
Started: 1,
Cancelled: 2,
Finished: 3
};
var service = {
Types: types,
Status: statuses,
GetObject: GetObject,
GetObjects: GetObjects,
Save: Save,
Delete: Delete,
LogUserStatus: LogUserStatus,
LogUserStatusForExternalObject: LogUserStatusForExternalObject,
ResetStatusForExternalObject: ResetStatusForExternalObject,
HandleContainer: HandleContainer,
LogEventEnd: LogEventEnd,
GetMiniJourneySetting: GetMiniJourneySetting,
GetMiniJourneySettings: GetMiniJourneySettings
};
var pMiniJourneySettings = service.GetMiniJourneySettings();
return service;
function HandleContainer(container, objectId, objectType, eventEndType, eventEndSource) {
var finished = false;
LogUserStatus(objectId, objectType, statuses.Started);
container.onFinish(function () {
finished = true;
var passed = true;
var finishableModules = container.getFinishableModules();
for (var i = 0; i < finishableModules.length; i++) {
if (finishableModules[i].IsPassed === false) {
passed = false;
}
}
LogUserStatus(objectId, objectType, statuses.Finished, passed);
LogEventEnd(objectId, eventEndType, eventEndSource);
});
container.onDestroy(function () {
if (finished)
return;
LogUserStatus(objectId, objectType, statuses.Cancelled);
});
angular.element($window).on('beforeunload', function (e) {
if (!finished)
LogUserStatus(objectId, objectType, statuses.Cancelled);
});
}
function LogEventEnd(objectId, eventType, eventSource) {
if (eventType && eventSource) {
bizCoreService.EventEnd(objectId, eventType, eventSource);
}
}
function LogUserStatus(objectId, objectType, status, passed) {
if (!objectId || !objectType)
return;
var params = {
objectId: objectId,
objectType: objectType,
status: status,
passed: passed ? true : false
};
var promise = $http.post(apiPath + 'LogUserStatus', {}, {
params: params,
headers: {
IgnoreLoader: true
}
});
promise.then(function (response) {
switch (status) {
case statuses.Started:
$rootScope.$broadcast('engageobject.started', params);
break;
case statuses.Cancelled:
$rootScope.$broadcast('engageobject.cancelled', params);
break;
case statuses.Finished:
$rootScope.$broadcast('engageobject.finished', params);
break;
}
});
return promise;
}
function LogUserStatusForExternalObject(engageObjectId, status, passed) {
if (!engageObjectId)
return;
var params = {
engageObjectId: engageObjectId,
status: status,
passed: passed ? true : false
};
return $http.post(apiPath + 'LogUserStatusForExternalEngageObject', {}, {
params: params,
headers: {
IgnoreLoader: true
}
});
}
function ResetStatusForExternalObject(engageObjectId) {
if (!engageObjectId)
return;
var params = {
engageObjectId: engageObjectId,
status: status
};
return $http.post(apiPath + 'ResetStatusForExternalObject', {}, {
params: params,
headers: {
IgnoreLoader: true
}
});
}
function GetObject(identifier, objectType, deepload) {
return $http.get(apiPath + 'GetEngageObject', {
params: {
identifier: identifier,
objectType: objectType,
deepload: deepload
}
});
}
function GetObjects(objectType, deepload) {
return $http.get(apiPath + 'GetEngageObjects', {
params: {
objectType: objectType,
deepload: deepload
}
});
}
function Save(object, objectType) {
return $http.post(apiPath + 'SaveEngageObject', object, {
params: {
objectType: objectType
}
});
}
function Delete(objectId, objectType) {
return $http.delete(apiPath + 'DeleteEngageObject', {
params: {
objectId: objectId,
objectType: objectType
}
});
}
function GetMiniJourneySetting(objectType) {
var deferred = $q.defer();
pMiniJourneySettings.then(function (response) {
deferred.resolve(response.data.GetItemByValue('ItemType', objectType));
});
return deferred.promise;
}
function GetMiniJourneySettings() {
return $http.get(apiPath + "GetMiniJourneySettings");
};
}
angular.module('bizPart').service('bizLocalStorageService', bizLocalStorageService);
function bizLocalStorageService() {
this.GetValue = function (key) {
if (typeof (Storage) !== "undefined") {
return window.localStorage.getItem(key);
}
else {
console.error("No local storage support...");
}
};
this.SetValue = function (key, data) {
if (typeof (Storage) !== "undefined") {
window.localStorage.setItem(key, data);
}
else {
console.error("No local storage support...");
}
};
this.RemoveValue = function (key) {
if (typeof (Storage) !== "undefined") {
window.localStorage.removeItem(key);
}
else {
console.error("No local storage support...");
}
};
}
angular.module('bizPart').service('bizTemplateHelperService', bizTemplateHelperService);
function bizTemplateHelperService() {
this.TemplateURL = function (key, fallback, moi) {
var ModuleInstance = BizPart.Client.Core.CurrentTab.ModuleInstances.GetItemByValue('Moi', moi);
var setting = ModuleInstance.ModuleInstanceSettings.GetItemByValue('Key', key);
if (setting !== null && setting.Value && setting.Value != "") {
return siteRootPath + setting.Value + "?v=" + BizPart.Client.Core.Version;
}
else {
return siteRootPath + fallback + "?v=" + BizPart.Client.Core.Version;
}
};
}
angular.module('bizPart').service('bizValidationService', bizValidationService);
bizValidationService.$inject = ["$mdDialog"];
function bizValidationService($mdDialog) {
this.FormValid = function (form, extraErrorArray) {
if (!form.$valid || (extraErrorArray && extraErrorArray.length > 0)) {
$mdDialog.show({
parent: angular.element(document.body),
clickOutsideToClose: true,
template: '{{field.Message}} {{field.ExpectedValue}}
{{error.Capitalize()}} , Close
',
controller: FormValid,
controllerAs: "vm",
bindToController: true,
multiple: true,
locals: {
form: form,
extraErrorArray: extraErrorArray
},
});
}
return form.$valid && (!extraErrorArray || extraErrorArray.length == 0);
FormValid.$inject = ["$mdDialog"];
function FormValid($mdDialog) {
var vm = this;
vm.Close = Close;
vm.CheckValidity = CheckValidity;
vm.InvalidFields = [];
function CheckValidity() {
form.$setSubmitted();
if (!form.$valid || (vm.extraErrorArray && vm.extraErrorArray.length > 0)) {
if (form.$error.required) {
for (var i = 0; i < form.$error.required.length; i++) {
vm.InvalidFields.push({ Name: form.$error.required[i].$name + ": ", Message: form.$error.required[i].Message || "Required", ErrorKey: "GLOBAL.ERROR.REQUIRED" });
}
}
if (form.$error.minlength) {
for (var i = 0; i < form.$error.minlength.length; i++) {
//var name = form.$error.minlength[i].$name;
var length = form[form.$error.minlength[i].$name].$$attr.minlength;
vm.InvalidFields.push({
Name: form.$error.minlength[i].$name + ": ",
Message: "Does not meet the required minimum length of: " + length,
ErrorKey: "GLOBAL.ERROR.TOOSHORT",
ExpectedValue: length
});
}
}
if (form.$error.maxlength) {
for (var i = 0; i < form.$error.maxlength.length; i++) {
//vm.InvalidFields.push(form.$error.maxlength[i].$name);
var length = form[form.$error.maxlength[i].$name].$$attr.maxlength;
vm.InvalidFields.push({
Name: form.$error.maxlength[i].$name + ": ",
Message: "Does not meet the required maximum length of: " + length,
ErrorKey: "GLOBAL.ERROR.TOOLONG",
ExpectedValue: length
});
}
}
if (form.$error.min) {
for (var i = 0; i < form.$error.min.length; i++) {
var minValue = form[form.$error.min[i].$name].$$attr.min;
vm.InvalidFields.push({
Name: form.$error.min[i].$name + ": ",
Message: "Does not meet the required minimum value of: " + minValue,
ErrorKey: "GLOBAL.ERROR.MINVALUE",
ExpectedValue: minValue
});
}
}
if (form.$error.max) {
for (var i = 0; i < form.$error.max.length; i++) {
var maxValue = form[form.$error.max[i].$name].$$attr.max;
vm.InvalidFields.push({
Name: form.$error.max[i].$name + ": ",
Message: "Does not meet the required maximum value of: " + maxValue,
ErrorKey: "GLOBAL.ERROR.MAXVALUE",
ExpectedValue: maxValue
});
}
}
if (form.$error.email) {
for (var i = 0; i < form.$error.email.length; i++) {
//vm.InvalidFields.push(form.$error.maxlength[i].$name);
var length = form[form.$error.email[i].$name].$$attr.maxlength;
vm.InvalidFields.push({
Name: form.$error.email[i].$name + ": ",
Message: "Email needs to be in a correct format",
ErrorKey: "GLOBAL.ERROR.EMAIL"
});
}
}
if(form.$error.pattern) {
for (var i = 0; i < form.$error.pattern.length; i++) {
var message = form.$error.pattern[i].$$attr.message || "Needs to follow pattern: " + form.$error.pattern[i].$$attr.pattern;
vm.InvalidFields.push({ Name: form.$error.pattern[i].$name + ": ", Message: message });
}
}
}
if (vm.extraErrorArray && extraErrorArray.length > 0) {
for (var i = 0; i < vm.extraErrorArray.length; i++) {
vm.InvalidFields.push({ Name: vm.extraErrorArray[i].Name + ": ", Message: vm.extraErrorArray[i].Message });
}
}
if (vm.InvalidFields.length > 0 && document.getElementById(vm.InvalidFields[0].Name)) {
document.getElementById(vm.InvalidFields[0].Name).scrollIntoView();
}
}
function Close() {
$mdDialog.hide();
}
vm.CheckValidity();
}
};
this.FormsValid = function (forms) {
var valid = !forms.GetItemByValue('$valid', false);
if (!valid) {
$mdDialog.show({
parent: angular.element(document.body),
clickOutsideToClose: true,
template: 'Close ',
controller: FormsValidController,
controllerAs: "vm",
bindToController: true,
multiple: true,
locals: {
forms: forms
},
});
}
return valid;
function FormsValidController() {
var vm = this;
vm.Close = Close;
vm.CheckValidity = CheckValidity;
vm.InvalidFields = [];
function CheckValidity() {
for (var i = 0; i < vm.forms.length; i++) {
var form = vm.forms[i];
form.$setSubmitted();
if (form.$valid)
continue;
for (var j = 0; j < form.$$controls.length; j++) {
var field = form.$$controls[j];
field.$setDirty();
if (field.$valid)
continue;
var errors = [];
for (var key in field.$error) {
errors.push(key);
}
vm.InvalidFields.push({ Name: field.$name, Errors: errors });
}
}
}
function Close() {
$mdDialog.hide();
}
vm.CheckValidity();
}
};
}
angular.module('bizPart').service('bizPopupService', bizPopupService);
bizPopupService.$inject = ["$mdDialog"];
function bizPopupService($mdDialog) {
this.Show = function (parameters) {
return $mdDialog.show({
parent: angular.element(document.body),
controller: PopupDialogController,
clickOutsideToClose: parameters.clickOutsideToClose == true,
controllerAs: 'vm',
bindToController: true,
locals: parameters,
template: ''
});
}
this.ShowCustomTemplate = function (template) {
return $mdDialog.show({
parent: angular.element(document.body),
controller: PopupDialogController,
controllerAs: 'vm',
template: template,
bindToController: true
});
}
this.ShowCustomTemplateUrl = function (templateUrl) {
return $mdDialog.show({
parent: angular.element(document.body),
controller: PopupDialogController,
controllerAs: 'vm',
templateUrl: templateUrl,
bindToController: true
});
}
PopupDialogController.$inject = ["$mdDialog"];
function PopupDialogController($mdDialog) {
var vm = this;
vm.Close = Close;
vm.Cancel = Cancel;
vm.Answer = Answer;
function Close() {
$mdDialog.hide();
}
function Cancel() {
$mdDialog.cancel();
}
function Answer(answer) {
$mdDialog.hide(answer);
}
}
}
angular.module('bizPart').service('bizLoaderService', bizLoaderService);
function bizLoaderService() {
var service = {
LoaderIcon: "Images/Common/progress_indicator.gif",
FullPageLoaderRequests: 0,
RequestFullPageLoader: RequestFullPageLoader,
RequestFullPageLoaderFinish: RequestFullPageLoaderFinish
};
return service;
function RequestFullPageLoader(promise) {
service.FullPageLoaderRequests = service.FullPageLoaderRequests + 1;
if (!promise)
return;
promise.then(service.RequestFullPageLoaderFinish, service.RequestFullPageLoaderFinish);
}
function RequestFullPageLoaderFinish() {
if (service.FullPageLoaderRequests <= 0)
return;
service.FullPageLoaderRequests = service.FullPageLoaderRequests - 1;
}
}
angular.module('bizPart').service('bizCoreService', bizCoreService);
bizCoreService.$inject = ["$http", "$rootScope", "$injector", "$state", "$mdToast"];
function bizCoreService($http, $rootScope, $injector, $state, $mdToast) {
this.TryInject = function (provider) {
var result = null;
try {
result = $injector.get(provider);
}
catch (error) {
console.warn("Failed to inject " + provider);
}
return result;
}
this.Toast = function (message) {
$mdToast.show($mdToast.simple().textContent(message).position("bottom right"));
}
this.LogGenericObjectVisit = function(objectKey, objectId, referer, refererId){
return $http.post(siteRootPath + "api/GenericObjectVisit/LogGenericObjectVisit", {
ObjectKey: objectKey,
ObjectId: objectId,
Referer: referer,
RefererId: refererId
});
}
this.UpdateUserSetting = function (key, value) {
return $http.post(siteRootPath + 'api/user/UpdateUserSetting', {
Key: key,
Value: value
}, {
headers: {
IgnoreLoader: true
}
})
};
this.GetUserSetting = function(key) {
return $http.get(siteRootPath + "api/user/GetLoggedInUserSetting", {
params: {
key: key
}
});
};
this.GetAllActiveCountries = function () {
return $http.get(siteRootPath + 'api/country/GetCountries');
}
this.GetTags = function (tagIds) {
return $http.get(siteRootPath + 'api/generictag/GetTags', {
params: {
tagIds: tagIds.join(',')
}
});
}
this.GetAllTags = function (cultureId) {
if (cultureId === undefined || cultureId <= 0) {
return $rootScope.MakeGetRequest(siteRootPath + 'api/generictag/GetAllTagsDefaultCulture');
}
else {
return $rootScope.MakeGetRequest(siteRootPath + 'api/generictag/GetAllTags', {
params: {
cultureId: cultureId
}
});
}
}
this.GetSourcesByTags = function (tagIds, sourceType, deepload) {
return $http.get(siteRootPath + 'api/generictag/GetAllSourcesByTags', {
params: {
tagIds: tagIds.join(','),
sourceType: sourceType,
deepload: deepload
}
});
}
this.Admin = {
GetUnitTypes: GetUnitTypes,
GetUnitsByParent: GetUnitsByParent,
GetGenericSetting: GetGenericSetting,
UpdateGenericSetting: UpdateGenericSetting,
GetAllRoles: GetAllRoles
}
function GetUnitTypes(ignoreLoader) {
const headers = {
IgnoreLoader: ignoreLoader || false
};
return $http.get(siteRootPath + 'api/unit/GetAllUnitTypes', {
params: {
},
headers
});
}
function GetUnitsByParent(parentId, ignoreLoader) {
const headers = {
IgnoreLoader: ignoreLoader || false
};
return $http.get(siteRootPath + 'api/unit/GetUnitsByParent', {
params: {
parentId: parentId
},
headers
});
}
function GetGenericSetting(type, key, objectId) {
return $http.get(siteRootPath + 'api/genericsetting/GetGenericSetting', {
params: {
type: type,
key: key,
objectId: objectId
}
});
}
function UpdateGenericSetting(setting) {
return $http.post(siteRootPath + 'api/genericsetting/UpdateGenericSetting', setting);
}
function GetAllRoles(includeInactive) {
return $http.get(siteRootPath + 'api/roleadmin/GetAllActiveRoles', {
params: {
includeInactive: includeInactive || 'false'
}
});
}
this.Search = function (terms, maxHits, referrerType, referrerId, indexList, SearchIndexList, sortBy) {
if (!referrerType) {
referrerType = '';
}
if (!referrerId) {
referrerId = 0;
}
if (!indexList) {
indexList = [];
}
if (!SearchIndexList) {
SearchIndexList = [];
}
if (!sortBy) {
sortBy = 0;
}
return $http.post(siteRootPath + 'api/search/Search', {
Terms: terms,
MaxHits: maxHits,
TagIds: [],
ReferrerType: referrerType,
ReferrerId: referrerId,
IndexList: indexList,
IndexEntityList: SearchIndexList,
SortBy: sortBy
}, {
headers: {
IgnoreLoader: true
}
});
}
this.LogSearch = function (selectedResult) {
return $http.post(siteRootPath + 'api/search/LogSelectedResult', selectedResult);
}
//Endregion
this.FilterModuleAbstractRoles = function (moduleAbstractRoles) {
return $http.post(siteRootPath + "WS/BizPartPermissionService.asmx/FilterModuleAbstractRoles", {
moduleAbstractRoles: moduleAbstractRoles
});
}
this.ValidatePushNotificationId = function (notificationId) {
return $http.get(siteRootPath + 'api/PushNotification/ValidatePushNotificationId', {
params: {
notificationId: notificationId
}
});
}
this.GetPortalsettingWOCache = function (key) {
return $http.get(siteRootPath + 'api/portalUser/GetPortalSettingValue', {
params: {
key: key
}
});
}
var promisesPOS = {};
this.GetPortalsetting = function (key) {
if (portalSettings[key] !== undefined)
promisesPOS[key] = Promise.resolve({ data: portalSettings[key] });
if (!promisesPOS[key])
promisesPOS[key] = this.GetPortalsettingWOCache(key);
return promisesPOS[key];
};
this.GetPortalsettingAsBoolean = function (key) {
return this.GetPortalsetting(key).then((response) => {
var res = BizPartCoreHelpers.getResponseValue(response, false);
if (res === true || res.toLowerCase() === "true")
return Promise.resolve({ data: true });
else
return Promise.resolve({ data: false });
});
};
var htmlSegmentsStore = [];
var promisesHtmlSegment = {};
this.GetHtmlSegment = function (key) {
if (htmlSegmentsStore[key] !== undefined)
promisesHtmlSegment[key] = Promise.resolve({ data: htmlSegmentsStore[key] });
if (!promisesHtmlSegment[key])
promisesHtmlSegment[key] = this.GetHtmlSegmentWOCache(key);
return promisesHtmlSegment[key];
};
this.GetHtmlSegments = function (keyStartsWith) {
if (htmlSegmentsStore[keyStartsWith] !== undefined)
promisesHtmlSegment[keyStartsWith] = Promise.resolve({ data: htmlSegmentsStore[keyStartsWith] });
if (!promisesHtmlSegment[keyStartsWith])
promisesHtmlSegment[keyStartsWith] = this.GetHtmlSegmentsWOCache(keyStartsWith);
return promisesHtmlSegment[keyStartsWith];
};
this.RemoveHtmlSegmentPromise = function (key) {
if (promisesHtmlSegment[key] !== undefined)
delete promisesHtmlSegment[key];
}
this.GetHtmlSegmentWOCache = function (key) {
return $http.get(siteRootPath + 'api/layout/GetHtmlSegment', {
params: {
key: key
}
});
}
this.GetHtmlSegmentsWOCache = function (keyStartsWith) {
return $http.get(siteRootPath + 'api/layout/GetHtmlSegments', {
params: {
keyStartsWith: keyStartsWith
}
});
}
this.SaveHtmlSegment = function (key, value) {
return $http.post(siteRootPath + 'api/layout/SaveHtmlSegment', {
key: key,
value: value
});
}
this.GetCurrentPortal = function() {
return $http.get(siteRootPath + 'api/portaluser/GetCurrentPortal');
};
this.GetModuleInstanceSettings = function (moiId) {
return $http.post(siteRootPath + 'WS/BizPartScriptService.asmx/GetModuleInstanceSettings',
{ moiId: moiId });
};
this.GetCultures = function () {
return $rootScope.MakeGetRequest(siteRootPath + 'api/culture/GetCultures', {});
};
this.GetAllAccounts = function () {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllAccounts',
{});
};
this.GetAllAreas = function (includeTranslations) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllAreas',
{
includeTranslations: includeTranslations
});
};
this.GetAllUnits = function (includeInactive) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllUnits',
{
includeInactive: includeInactive
});
};
this.GetAllMainAccounts = function (ignoreLoader) {
var headers = undefined;
if (ignoreLoader) {
headers = {
headers: {
'IgnoreLoader': 'true'
}
};
}
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllMainAccounts',
{}, headers);
};
this.GetAllUsersWithSameCustomerAsMe = function () {
return $http.post(siteRootPath + 'WS/BizPartScriptService.asmx/GetAllUsersWithSameCustomerAsMe', {});
};
this.GetMainAccountsForCountry = function (countryId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetMainAccountsForCountry', {
countryId: countryId
});
};
this.GetSubAccountsByMainAccounts = function (countryId, mainAccountIds) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetSubAccountsByMainAccounts', {
countryId: countryId,
mainAccountIds: mainAccountIds
});
};
this.GetAllNotHiddenMainAccounts = function () {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllNotHiddenMainAccounts',
{});
};
this.GetConnectedTags = function (sourceType, sourceId, cultureId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetConnectedTags',
{
sourceType: sourceType,
sourceId: sourceId,
cultureId: cultureId
});
};
this.SaveTag = function (sourceType, sourceId, tagId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/SaveTag',
{
sourceType: sourceType,
sourceId: sourceId,
tagId: tagId
});
};
this.SaveTagList = function (sourceType, sourceId, tagIds) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/SaveTagList',
{
sourceType: sourceType,
sourceId: sourceId,
tagIds: tagIds
});
};
this.DeleteTag = function (sourceType, sourceId, tagId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/DeleteTag',
{
sourceType: sourceType,
sourceId: sourceId,
tagId: tagId
});
};
this.DeleteTagList = function (sourceType, sourceId, tagIds) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/DeleteTagList',
{
sourceType: sourceType,
sourceId: sourceId,
tagIds: tagIds
});
};
this.GetAllDepartments = function (ignoreLoader) {
var headers = undefined;
if (ignoreLoader) {
headers = {
headers: {
'IgnoreLoader': 'true'
}
};
}
return $rootScope.MakeGetRequest(siteRootPath + 'api/UserDepartmentsUser/GetAllUserDepartments', {}, headers);
};
this.GetDefaultNewItems = function () {
var config = {};
if (ignoreLoader)
config.headers = { IgnoreLoader: true };
return $http.get(siteRootPath + 'WS/BizPartScriptService.asmx/GetDefaultNewItems', config);
};
this.GetDepartmentsForUser = function (ignoreLoader) {
return $http.get(siteRootPath + 'api/UserDepartmentsUser/GetUserDepartmentsForUser', {
headers: {
IgnoreLoader: ignoreLoader
}
});
};
this.UpdateUserDepartmentsForUser = function (departments, ignoreLoader) {
return $http.post(siteRootPath + 'api/UserDepartmentsUser/UpdateUserDepartmentsForUser', departments, {
headers: {
IgnoreLoader: ignoreLoader
}
});
};
this.AddPermission = function (id, accountId, departmentId, type) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/AddPermission',
{
id: id,
accountId: accountId,
departmentId: departmentId,
type: type
});
};
this.AddItemPermission = function (perm) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/AddItemPermission',
{
perm: perm
});
};
this.AddFullPermission = function (permission) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/AddFullPermission',
{
permission: permission
});
};
this.DeletePermission = function (permissionId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/DeletePermission',
{
permissionId: permissionId
});
};
this.GetPermissions = function (id, type) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetPermissions',
{
id: id,
type: type
});
};
this.GetItemPermissions = function (perm) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetItemPermissions',
{
perm: perm
});
};
this.GetAllPublicPermissions = function (perm) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllPublicPermissions',
{
perm: perm
});
};
this.DeleteItemPermission = function (permissionId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/DeleteItemPermission',
{
permissionId: permissionId
});
}
this.DeletePublicItemPermission = function (itemId) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/DeletePublicItemPermission',
{
itemId: itemId
});
}
this.GetFullPermissions = function (id, type) {
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetFullPermissions',
{
id: id,
type: type
});
}
this.GetAllRoles = function (cultureId, excludeSystemRoles, ignoreLoader) {
var headers = undefined;
if (ignoreLoader) {
headers = {
headers: {
'IgnoreLoader': 'true'
}
};
}
return $http.post(siteRootPath + 'WS/BizPartPermissionService.asmx/GetAllRoles',
{
cultureId: cultureId,
excludeSystemRoles: excludeSystemRoles
}, headers);
};
this.EventStart = function (objectId, eventType, eventSource) {
return $http.post(siteRootPath + 'api/eventstatistics/EventStart', {
objectId: objectId,
eventType: eventType,
eventSource: eventSource,
url: window.location.href,
eventState: $state.current.name + ($state.params ? "(" + JSON.stringify($state.params) + ")" : "")
}, {
headers: {
IgnoreLoader: true
}
});
}
this.EventEnd = function (objectId, eventType, eventSource) {
return $http.post(siteRootPath + 'api/eventstatistics/EventEnd', {
objectId: objectId,
eventType: eventType,
eventSource: eventSource,
url: window.location.href,
eventState: $state.current.name + ($state.params ? "(" + JSON.stringify($state.params) + ")" : "")
}, {
headers: {
IgnoreLoader: true
}
});
};
this.EventExternalStartNew = function (key, url, externalType, eventType, eventExternalReferer, objectId) {
console.warn('EventExternalStartNew is not implemented yet!');
//return $http.post(siteRootPath + 'Modules/BizEngage/WS/EventStatisticsService.asmx/ExternalEventStart',
// {
// key: key,
// url: url,
// externalType: externalType,
// eventType: eventType,
// eventExternalReferer: eventExternalReferer,
// objectId: objectId
// }, {
// headers: {
// IgnoreLoader: true
// }
// });
};
this.EventInit = function (objectId, eventType, eventSource) {
return $http.post(siteRootPath + 'api/eventstatistics/EventInit', {
objectId: objectId,
eventType: eventType,
eventSource: eventSource,
url: window.location.href,
eventState: $state.current.name + ($state.params ? "(" + JSON.stringify($state.params) + ")" : "")
}, {
headers: {
IgnoreLoader: true
}
});
};
this.EventExternalEndNew = function (key, url, externalType, eventType, eventExternalReferer, objectId) {
console.warn('EventExternalEndNew is not implemented yet!');
//return $http.post(siteRootPath + 'Modules/BizEngage/WS/EventStatisticsService.asmx/ExternalEventEnd',
// {
// key: key,
// url: url,
// externalType: externalType,
// eventType: eventType,
// eventExternalReferer: eventExternalReferer,
// objectId: objectId
// }, {
// headers: {
// IgnoreLoader: true
// }
// });
};
this.GetUnitLogoForLoggedInUser = function () {
return $http.get(siteRootPath + 'api/userunit/GetUnitLogo');
}
this.GetWelcomeGuide = function () {
return $http.get(siteRootPath + 'api/layout/GetWelcomeGuideForUser');
}
this.GetStartPageData = function () {
return $http.get(siteRootPath + 'api/layout/GetStartPageDataForUser');
}
}
angular.module('bizPart').service('regexService', regexService);
function regexService() {
this.GetFirstImage = function (html) {
var match = html.match(/ ]+src=[\'"]([^\'"]+)[\'"][^>]*>/i)
if (match.length > 1) {
return match[1];
}
}
}
angular.module('bizPart').service('loginService', loginService);
loginService.$inject = ["$http"];
function loginService($http) {
this.Login = function (userName, userPassword) {
return $http.post(siteRootPath + 'api/user/Login', {
UserName: userName,
Password: userPassword
});
};
this.AuthorizeUser = function (userName, userPassword, skipPwdChangeCheck) {
return $http.post(siteRootPath + 'api/user/AuthorizeUser', {
UserName: userName,
Password: userPassword
});
};
this.ActivateAccount = function (guid) {
return $http.get(siteRootPath + 'api/user/ActivateAccount?' + $.param({ guid: guid }));
};
this.InitEmailVerification = function (email) {
return $http.post(siteRootPath + 'api/user/InitEmailVerification', JSON.stringify(email));
}
this.GetActiveOpenIdProviders = function () {
return $http.get(siteRootPath + 'api/openid/GetOpenIdProvidersForClient');
}
}
angular.module('bizPart').service('tagCloudService', tagCloudService);
tagCloudService.$inject = ["$http"];
function tagCloudService($http) {
this.GetAllTagsWithOccurenceForItemsByType = function (sourceType) {
return $http.get(siteRootPath + "api/generictag/GetTagsForItemsByType?" + $.param({ sourceType: sourceType }));
};
}
angular.module('bizPart').service('bizLikeActionsService', bizLikeActionsService);
bizLikeActionsService.$inject = ["$http"];
function bizLikeActionsService($http) {
this.PerformLikeAction = function (likedUserId, objectId, actionId, likeKey, comment) {
var params = {
LikedUserId: likedUserId,
ObjectId: objectId,
ActionId: actionId,
LikeKey: likeKey,
Comment: comment ? comment : "Performed like action."
}
return $http.post(siteRootPath + 'api/likeaction/PerformLikeAction', params, { ignoreLoadingBar: true });
}
this.GetLikeActionsByObjectId = function (key, objectId) {
return $http.get(siteRootPath + "api/likeaction/GetLikeActionsByObjectId?" + $.param({ key: key, objectId: objectId }));
};
this.UpdateCommentForLikeAction = function (likeId, comment) {
var params = {
LikeId: likeId,
Comment: comment ? comment : ""
}
return $http.post(siteRootPath + 'api/likeaction/UpdateCommentForLikeAction', params, { ignoreLoadingBar: true });
};
}
angular.module('bizPart').service('blogSearchService', blogSearchService);
blogSearchService.$inject = ["$http"];
function blogSearchService($http) {
this.GetBlogPostsSearch = function (blogMoiId, categoryId, searchTerm) {
return $http.post(siteRootPath + 'Modules/BizPart.BizCMS/Modules/BizBlog/WS/BizBlogScriptService.asmx/GetBlogPostByCategoryIdsSearchWithCache',
{
blogMoiId: blogMoiId,
categoryIdsCommaSeparated: categoryId,
searchTerm: searchTerm,
numberOfEntries: 100,
pageIndex: 0,
pageLength: 100
});
};
}
angular.module('bizPart').service('extraRewardsService', extraRewardsService);
extraRewardsService.$inject = [];
function extraRewardsService($http) {
this.ExtraRewardObjectTypes = [{
Name: "Education",
Value: 1
}];
this.ExtraRewardTypes = [{
Name: "Repetition",
Value: 1
}];
}
angular.module('bizPart').service('scrollService', scrollService);
function scrollService() {
this.ScrollToTop = function () {
$('html,body').animate({ scrollTop: 0 }, 'fast');
}
this.ScrollTo = function (element, marginTop) {
$([document.documentElement, document.body]).animate({
scrollTop: element.offset().top - marginTop
}, 200);
};
}
angular.module('bizPart').service('anchorSmoothScroll', anchorSmoothScroll);
function anchorSmoothScroll() {
this.scrollTo = function (eID, marginTop, duration) {
if (!duration) {
duration = 200;
}
$([document.documentElement, document.body]).animate({
scrollTop: $("#" + eID).offset().top - marginTop
}, duration);
};
}
/* FACTORIES */
angular.module('bizPart').factory('bizUrlFactory', bizUrlFactory);
angular.module('bizPart').factory('loadingInterceptor', loadingInterceptorFunction);
loadingInterceptorFunction.$inject = ["$q"];
function bizUrlFactory() {
var factoryObj = {
GenerateUrlRewrite: function (name) {
this.rewrite = name.replace(/[\s]/gmi, '-')
.replace(/[åä]/gmi, 'a')
.replace(/[ö]/gmi, 'o')
.replace(/[,;:\*'+\/=()´`\\]/gmi, '');
return this.rewrite.toLowerCase();
},
GetQueryParameter: function (param) {
var query = window.location.search.substring(1);
var vars = query.split('&');
var values = [];
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (urldecode(pair[0]) == param) {
values.push(urldecode(pair[1]));
}
}
return values.join(",");
function urldecode(url) {
return decodeURIComponent(url.replace(/\+/g, ' '));
}
}
};
return factoryObj;
}
function loadingInterceptorFunction($q) {
return {
'request': function (request) {
if (!request.headers.IgnoreLoader) {
loaderFullPage();
}
return request;
},
'response': function (response) {
if (!response.config.headers.IgnoreLoader) {
loaderFullPageStop();
}
return response || $q.when(response);
},
'responseError': function (rejection) {
if (!rejection.config.headers.IgnoreLoader) {
loaderFullPageStop();
}
return $q.reject(rejection);
}
};
}
/* DIRECTIVES */
angular.module('bizPart').directive('bizMediaSwapper', bizMediaSwapper);
bizMediaSwapper.$inject = [];
function bizMediaSwapper() {
var directive = {
restrict: "E",
scope: {
items: '=',
limit: '@'
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/Views/bizMediaSwapper.html?v=" + bizPartVersion,
controllerAs: 'vm',
bindToController: true,
controller: bizMediaSwapperController
};
bizMediaSwapperController.$inject = ["bizCoreService", "$timeout", "$rootScope", "$window", "$element"];
function bizMediaSwapperController(bizCoreService, $timeout, $rootScope, $window, $element) {
var vm = this;
vm.Items = [];
vm.ShowDots = true;
vm.InTransition = false;
vm.Init = Init;
vm.SwapMedia = SwapMedia;
function SwapMedia(itemClicked) {
vm.InTransition = true;
var index = vm.Items.indexOf(itemClicked);
for (var i = 0; i < vm.Items.length; i++) {
vm.Items[i].Active = i == index ? true : false;
vm.Items[i].Zindex = i == index ? vm.Items.length + 5 : i + 1;
//vm.Items[i].Zindex = vm.Items.length - i;
}
$timeout(function () {
vm.InTransition = false;
}, 500);
//vm.Items = [vm.Items[1], vm.Items[0]]; // Swap place or just change z-index?
}
function Init() {
LoadCss(siteRootPath + 'Js/AngularModules/BizPart/bizMediaSwapper.css');
for (var i = 0; i < vm.items.length; i++) {
vm.items[i].Active = i == 0 ? true : false;
vm.items[i].Zindex = vm.items.length - i;
vm.Items.push(vm.items[i]);
}
setHeight();
}
$(window).resize(setHeight);
function setHeight() {
var elem = angular.element($element[0]);
var elemWidth = elem.width();
if (elem[0].className.indexOf('swapper-media-video-image-2') > -1) {
angular.element(elem[0].querySelector('.media-swapper-items')).height((elemWidth * 0.56) + 20);
}
}
//$rootScope.Initialized.then(vm.Init);
vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizNewsletterSignup', bizNewsletterSignup);
bizNewsletterSignup.$inject = [];
function bizNewsletterSignup() {
var directive = {
restrict: "E",
scope: {
key: "@"
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/Views/bizNewsletterSignup.html?v=" + bizPartVersion,
controllerAs: 'vm',
bindToController: true,
controller: bizNewsletterSignupController
};
bizNewsletterSignupController.$inject = ["$rootScope", "core.users.service"];
function bizNewsletterSignupController($rootScope, userService) {
var vm = this;
vm.hasSubmitted = false;
vm.email = "";
vm.validInput = false;
vm.submit = submit;
vm.inputChanged = inputChanged;
function inputChanged() {
if (isValid()) {
vm.validInput = true;
return;
}
vm.validInput = false;
}
function isValid() {
return document.getElementById("emailInput").checkValidity();
}
function submit() {
if (isValid()) {
console.log('valid', vm.email);
userService.SubscribeToNewsletter(vm.key, vm.email).then(subCallback);
function subCallback(response) {
var res = BizPartCoreHelpers.getResponseValue(response);
console.log('res', res);
}
vm.hasSubmitted = true;
vm.email = "";
}
}
}
return directive;
}
angular.module('bizPart').directive('bizHtmlSegment', bizHtmlSegment);
bizHtmlSegment.$inject = ["bizCoreService", "$compile", "$rootScope"];
function bizHtmlSegment(bizCoreService, $compile, $rootScope) {
var directive = {
restrict: "E",
scope: {
key: '@',
keyPrefix: '@',
bizSegmentEditable: '@'
},
controller: bizSegmentEditController,
link: segmentLink
};
function segmentLink(scope, element, attrs) {
var hasSetEditable = false;
$rootScope.$on('htmlSegmentUpdated', function (e, key) {
if(key === scope.key)
bizCoreService.GetHtmlSegment(key).then(GetDataCallback);
});
if (scope.keyPrefix !== undefined) {
console.log('keyPrefix', scope.keyPrefix);
bizCoreService.GetHtmlSegments(scope.keyPrefix).then(GetDataListCallback);
}
else {
bizCoreService.GetHtmlSegment(scope.key).then(GetDataCallback);
}
function HasEditAccess() {
if ($rootScope.IsAdministrator() === true || $rootScope.HasModuleAccess('CMS', 20))
return true;
return false;
}
function GetDataListCallback(response) {
var list = BizPartCoreHelpers.getResponseValue(response, []);
$rootScope.Initialized.then(function () {
for (var i = 0; i < list.length; i++) {
if (list[i].Key == scope.key) {
var replaceHtml = list[i].Value;
SetEditable(element, replaceHtml);
return;
}
}
if (hasSetEditable === false) {
SetEditable(element, '');
if (HasEditAccess() === true)
element.addClass('emptySegment');
}
});
}
function GetDataCallback(response) {
var replaceHtml = BizPartCoreHelpers.getResponseValue(response, '');
$rootScope.Initialized.then(function () {
SetEditable(element, replaceHtml);
if (replaceHtml === '' && HasEditAccess() === true) {
element.addClass('emptySegment');
}
});
}
function SetEditable(element, html) {
if (scope.bizSegmentEditable !== undefined && HasEditAccess() === true) {
hasSetEditable = true;
element.html($compile('
' + html)(scope));
LoadJs(siteRootPath + 'js/lib/monaco-editor/min/vs/loader.js');
LoadJs(siteRootPath + 'js/lib/monaco-editor/min/vs/editor/editor.main.nls.js');
LoadJs(siteRootPath + 'js/lib/monaco-editor/min/vs/editor/editor.main.js');
LoadCss(siteRootPath + 'AdminMetronic/Css/biz-code-editor.css');
}
else {
element.html($compile(html)(scope));
}
}
}
bizSegmentEditController.$inject = ["$rootScope", "$scope", "$element", "bizCodeEditorService", "$timeout"];
function bizSegmentEditController($rootScope, $scope, $element, bizCodeEditorService, $timeout) {
var vm = this;
$scope.ShowEdit = ShowEdit;
function ShowEdit() {
bizCoreService.GetHtmlSegmentWOCache($scope.key).then(GetDataCallback);
function GetDataCallback(response) {
var content = BizPartCoreHelpers.getResponseValue(response, '');
if (content.length === 0)
content = ' '; // Temp hack
bizCodeEditorService.OpenEditorAsDialog(content, 'html').then(function (changedContent) {
// Save content.
if (changedContent !== undefined) {
bizCoreService.SaveHtmlSegment($scope.key, changedContent).then(function () {
bizCoreService.RemoveHtmlSegmentPromise($scope.key);
$rootScope.$broadcast('htmlSegmentUpdated', $scope.key);
});
}
});
}
}
}
return directive;
}
angular.module('bizPart').directive('bizParallax', bizParallax);
bizParallax.$inject = ["$rootScope", "parallaxHelper"];
function bizParallax() {
var directive = {
restrict: "E",
scope: {
image: "@"
},
template: '
',
controllerAs: 'vm',
bindToController: true,
controller: bizParallaxController
};
function bizParallaxController($rootScope, parallaxHelper) {
var vm = this;
vm.Init = Init;
function Init() {
vm.backgroundParallaxY = parallaxHelper.createAnimator(0.15, 75, 0, 75);
vm.backgroundParallaxX = undefined;
}
$rootScope.Initialized.then(vm.Init);
}
return directive;
}
angular.module('bizPart').directive('bizQuotes', bizQuotes);
bizQuotes.$inject = ["bizCoreService", "$timeout", "$rootScope", "parallaxHelper"];
function bizQuotes() {
var directive = {
restrict: "E",
scope: {
tag: '@',
limit: '@'
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/Views/bizQuotes.html?v=" + bizPartVersion,
controllerAs: 'vm',
bindToController: true,
controller: bizQuotesController
};
function bizQuotesController(bizCoreService, $timeout, $rootScope, parallaxHelper) {
var vm = this;
vm.Quotes = [];
vm.Init = Init;
vm.InitSlick = InitSlick;
function InitSlick() {
vm.SlickLoaded = false;
vm.SlickSettings = {
arrows: true,
dots: false,
autoplay: true,
speed: 2000,
autoplaySpeed: 5000,
infinite: false,
slidesToShow: 1,
slidesToScroll: 1,
}
$timeout(function () {
vm.SlickLoaded = true;
});
}
function Init() {
vm.backgroundParallaxY = parallaxHelper.createAnimator(0.15, 75, 0, 75);
vm.backgroundParallaxX = undefined;
var quotesUrl = siteRootPath + 'Customers/' + portalAlias + '/Data/quotes_' + $rootScope.LoggedInUser.CurrentCulture.substr(0, 2) + '.json?v=' + bizPartVersion;
fetch(quotesUrl).then(response => {
return response.json();
})
.then(function (quotes) {
if(vm.tag)
quotes = quotes.GetItemsByValue('Key', vm.tag);
if (vm.limit == 1) {
vm.Quotes.push(quotes[Math.floor(Math.random() * quotes.length)]);
}
else if (vm.limit > 1 && quotes.length > 1) {
// TODO: Pick X random quotes
}
else {
vm.Quotes = quotes;
}
vm.InitSlick();
})
.catch(function (error) {
console.error('Error fetching file.', error);
});
}
$rootScope.Initialized.then(vm.Init);
}
return directive;
}
angular.module('bizPart').directive('bizPhoneCountryCode', bizPhoneField);
function bizPhoneField() {
var directive = {
restrict: "E",
scope: {
fullPhoneNumber: '=',
required: '@',
label: '@',
allowFullEdit: '@?',
badInput: '=?',
allowAnySelect: '@?'
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/Views/bizPhoneCountryCode.html?v=" + bizPartVersion,
controllerAs: 'vm',
bindToController: true,
controller: bizPhoneFieldController
};
bizPhoneFieldController.$inject = ["bizCoreService", "$scope"];
function bizPhoneFieldController(bizCoreService, $scope) {
var vm = this;
vm.CurrentCountryCode = '';
vm.PhoneNumber = '';
vm.SelectedCountry = null;
vm.Countries = [];
vm.PartNumberPattern = /^[0-9]+$/;
vm.Init = Init;
vm.SelectedCountryChange = SelectedCountryChange;
vm.SetPhoneNumber = SetPhoneNumber;
function SelectedCountryChange() {
if (vm.allowFullEdit) {
if (vm.fullPhoneNumber.length > 0 && vm.fullPhoneNumber.substr(0, 1) === '0') {
vm.fullPhoneNumber = vm.SelectedCountry.PhonePrefix + vm.fullPhoneNumber.substr(1);
}
else {
if (vm.CurrentCountryCode !== '')
vm.fullPhoneNumber = vm.fullPhoneNumber.replace(vm.CurrentCountryCode, vm.SelectedCountry.PhonePrefix);
else
vm.fullPhoneNumber = vm.SelectedCountry.PhonePrefix;
}
vm.CurrentCountryCode = vm.SelectedCountry.PhonePrefix;
} else {
SetPhoneNumber();
}
}
function SetPhoneNumber() {
if (!vm.allowFullEdit && vm.SelectedCountry && vm.SelectedCountry.Id > 0) {
if (!vm.partialPhoneNumber) {
vm.badInput = true;
} else {
vm.partialPhoneNumber = vm.partialPhoneNumber.replace(/([^0-9]+)/g, '').replace(/(^[0]){1}/g, '');
vm.badInput = vm.PartNumberPattern.test(vm.partialPhoneNumber) === false ? true : false;
vm.fullPhoneNumber = '+' + vm.SelectedCountry.PhoneCountryCode + vm.partialPhoneNumber;
}
} else {
vm.badInput = false;
}
//console.log("full phone", vm.fullPhoneNumber);
}
function Init() {
var lang = '';
if (navigator && (navigator.languages && navigator.languages[0] || navigator.language)) {
lang = navigator.languages[0] || navigator.language;
if (lang.indexOf('-') > -1)
lang = lang.split('-')[1];
}
bizCoreService.GetAllActiveCountries().then(GetAllActiveCountriesCallback);
function GetAllActiveCountriesCallback(response) {
var countries = BizPartCoreHelpers.getResponseValue(response, []);
//console.log("countries", countries);
var doNotSetSelectedCountry = false;
for (var i = 0; i < countries.length; i++) {
countries[i].PhonePrefix = '+' + countries[i].PhoneCountryCode;
countries[i].DisplayName = countries[i].PhonePrefix;
if (vm.allowFullEdit) {
countries[i].DisplayName = countries[i].CountryCode;
}
countries[i].Image = "/Images/StatFlags/" + countries[i].CountryCode + ".png";
countries[i].ImageAltPhrase = "CORE.COUNTRIES." + countries[i].CountryCode + ".NAME";
if (lang == countries[i].CountryCode && !doNotSetSelectedCountry)
vm.SelectedCountry = countries[i];
if (vm.fullPhoneNumber && vm.fullPhoneNumber.indexOf(countries[i].PhonePrefix) === 0) {
vm.partialPhoneNumber = vm.fullPhoneNumber.substr(countries[i].PhonePrefix.length);
vm.SelectedCountry = countries[i];
doNotSetSelectedCountry = true;
}
}
if (vm.allowAnySelect || countries.length === 0) {
countries.push({
Id: -1,
PhonePrefix: '',
DisplayName: 'Any',
Image: '/Images/StatFlags/flag-regular.svg',
ImageAltPhrase: 'CORE.PHONENUMBERSELECTOR.ANY_COUNTRY_ALT'
});
}
if (vm.SelectedCountry === null)
vm.SelectedCountry = countries[0];
if (vm.fullPhoneNumber) {
} else {
vm.partialPhoneNumber = '';
}
vm.Countries = countries;
vm.SetPhoneNumber();
$scope.$watch("vm.SelectedCountry",
function (newValue, oldValue) {
//console.log("changed country from", oldValue);
//console.log("changed country to", newValue);
if (oldValue && newValue && oldValue.Id < 0 && newValue.Id > 0) {
vm.partialPhoneNumber = '';
vm.fullPhoneNumber = '';
}
});
}
}
vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizInfiniteScroll', bizInfiniteScroll);
bizInfiniteScroll.$inject = ["$window"];
function bizInfiniteScroll($window) {
return {
restrict: 'A',
scope: {
itemSelector: '@',
loadMoreFunc: '&'
},
link: function (scope, element, attrs) {
function IsElementInViewport(el) {
const rect = el.getBoundingClientRect();
return rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth);
}
function HasScrolled() {
const itemElements = angular.element(scope.itemSelector);
if (itemElements && itemElements.length) {
const lastItemElement = itemElements[itemElements.length - 1];
if (IsElementInViewport(lastItemElement)) {
scope.loadMoreFunc();
}
}
}
angular.element($window).on("scroll", HasScrolled);
scope.$on('$destroy', function () {
angular.element($window).off('scroll', HasScrolled);
});
}
}
};
angular.module('bizPart').directive('bizInViewport', bizInViewport);
bizInViewport.$inject = ["$window", "$rootScope"];
function bizInViewport($window, $rootScope) {
return {
restrict: 'A',
scope: {
triggerFunc: '&',
debounceMs: '@'
},
link: function (scope, element, attrs) {
function IsElementInViewport(el) {
const rect = el.getBoundingClientRect();
return rect.top <= (window.innerHeight || document.documentElement.clientHeight);
}
function HasScrolled(triggerSource) {
if (element && element.length > 0) {
/*console.log('triggerSource', triggerSource);*/
var el = element[0];
if (IsElementInViewport(el)) {
if (!el.className.match(/\bbizInViewport\b/)) {
/*console.log('Element is in viewport', el.className);*/
el.classList.add('bizInViewport');
var debounce = scope.debounceMs ? scope.debounceMs : 0;
setTimeout(function () {
scope.triggerFunc();
}, debounce);
}
}
}
}
$rootScope.$on('$locationChangeSuccess', HasScrolled('$locationChangeSuccess'));
$rootScope.$on('$viewContentLoaded', HasScrolled('$viewContentLoaded'));
angular.element($window).on("scroll", HasScrolled);
scope.$on('$destroy', function () {
angular.element($window).off('scroll', HasScrolled);
});
}
}
};
angular.module('bizPart').directive('bizIgnoreDirty', bizIgnoreDirty);
bizIgnoreDirty.$inject = [];
function bizIgnoreDirty() {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
ctrl.$setPristine = function () { };
ctrl.$pristine = false;
}
}
};
angular.module('bizPart').directive('bizLikes', bizLikesDirective);
bizLikesDirective.$inject = [];
function bizLikesDirective() {
var directive = {
restrict: 'E',
scope: {
likeActions: '='
},
template: '
{{vm.average | number:1}} Rating ',
controllerAs: 'vm',
bindToController: true,
controller: bizLikesController
}
function bizLikesController() {
var vm = this;
vm.average = 0;
vm.Init = Init;
function Init() {
if (!vm.likeActions)
return;
var totalValue = 0;
var totalCount = 0;
for (var i = 0; i < vm.likeActions.length; i++) {
totalValue += vm.likeActions[i].Count * vm.likeActions[i].Action.Value;
totalCount += vm.likeActions[i].Count;
}
if (totalCount > 0)
vm.average = totalValue / totalCount;
}
vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizLazyLoadSrc', bizLazyLoadSrcDirective);
bizLazyLoadSrcDirective.$inject = ["bizLazyLoadService"];
function bizLazyLoadSrcDirective(bizLazyLoadService) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
bizLazyLoadService.OnLazyLoadEnabledChange(function (enabled) {
if (enabled)
return;
element.attr("src", attrs.bizLazyLoadSrc);
element.addClass("loaded");
}, scope);
scope.loadImg = function (changes) {
changes.forEach(function (change) {
if (change.isIntersecting) {
element.attr("src", attrs.bizLazyLoadSrc);
element.addClass("loaded");
}
})
};
if ('IntersectionObserver' in window &&
'IntersectionObserverEntry' in window &&
'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
scope.observer = new IntersectionObserver(scope.loadImg);
scope.img = angular.element(element)[0];
scope.observer.observe(scope.img);
}
else {
element.attr("src", attrs.bizLazyLoadSrc);
element.addClass("loaded");
}
}
}
}
angular.module("bizPart").directive("bizParentClass", bizParentClass);
function bizParentClass() {
var directive = {
restrict: "A",
link: linkFunction
}
function linkFunction(scope, element, attrs) {
if (attrs.bizParentClass)
element.parent().addClass(attrs.bizParentClass);
}
return directive;
}
angular.module("bizPart").directive("bizScrollX", bizScrollX);
function bizScrollX() {
var directive = {
restrict: "A",
link: linkFunction
}
function linkFunction(scope, element, attr) {
if (attr.bizScrollX) {
var w = scope.$watch(function () {
return element.children().length;
}, function () {
if ($("#" + attr.bizScrollX)) {
scope.$evalAsync(function () {
$(element).animate({
scrollLeft: $("#" + attr.bizScrollX).offset().left
}, 1000);
w();
});
}
});
}
}
return directive;
}
angular.module("bizPart").directive("bizHasCmsPage", bizHasCmsPage);
bizHasCmsPage.$inject = ["modules.cms.service"];
function bizHasCmsPage(cmsService) {
var promises = {};
var directive = {
restrict: "A",
link: linkFunction
}
function linkFunction(scope, element, attrs) {
if (!attrs.bizHasCmsPage)
return;
element.hide();
if (!promises[attrs.bizHasCmsPage])
promises[attrs.bizHasCmsPage] = cmsService.HasCMSPage(attrs.bizHasCmsPage);
promises[attrs.bizHasCmsPage].then(function (response) {
if (BizPartCoreHelpers.getResponseValue(response))
element.show();
else {
element.replaceWith("");
}
});
}
return directive;
}
angular.module("bizPart").directive("bizIfPortalSetting", bizIfPortalSetting);
bizIfPortalSetting.$inject = ["bizCoreService"];
function bizIfPortalSetting(bizCoreService) {
var promises = {};
var directive = {
restrict: "A",
link: linkFunction
}
function linkFunction(scope, element, attrs) {
if (!attrs.bizIfPortalSetting)
return;
element.hide();
if (attrs.bizIfPortalSettingValue === undefined)
attrs.bizIfPortalSettingValue = "True";
if (portalSettings[attrs.bizIfPortalSetting] !== undefined) {
//console.log('found settings in index', attrs.bizIfPortalSetting, portalSettings[attrs.bizIfPortalSetting]);
var isMatch = (attrs.bizIfPortalSettingValue == "True" && portalSettings[attrs.bizIfPortalSetting] === true)
|| portalSettings[attrs.bizIfPortalSetting] == attrs.bizIfPortalSettingValue;
setVisibility(isMatch);
return;
}
if (!promises[attrs.bizIfPortalSetting])
promises[attrs.bizIfPortalSetting] = bizCoreService.GetPortalsetting(attrs.bizIfPortalSetting);
promises[attrs.bizIfPortalSetting].then(function (response) {
setVisibility(BizPartCoreHelpers.getResponseValue(response) == attrs.bizIfPortalSettingValue);
});
function setVisibility(enabled) {
if (enabled)
element.show();
else {
element.replaceWith("");
console.info("bizIfPortalSetting: Hid element because of the value of portal setting: " + attrs.bizIfPortalSetting);
}
}
}
return directive;
}
angular.module("bizPart").directive("bizProfileSettingsMenu", bizProfileSettingsMenu);
bizProfileSettingsMenu.$inject = [];
function bizProfileSettingsMenu() {
var directive = {
restrict: "E",
template: '',
controller: bizProfileSettingsMenuController,
bindToController: true,
controllerAs: "vm",
scope: {
}
}
bizProfileSettingsMenuController.$inject = ["$rootScope"];
function bizProfileSettingsMenuController($rootScope) {
var vm = this; //"$rootScope"
vm.SubMenu = [{
Phrase: "CORE.ACCOUNTINFO",
State: "base.core.profile.settings",
Icon: "fa fa-user"
}, {
Phrase: "CORE.SECURITY",
State: "base.core.profile.security",
Icon: "fa fa-key"
}, {
Phrase: "CORE.EXTSETTINGS",
State: "base.core.profile.customsettings",
Icon: "fa-solid fa-hexagon-plus"
}];
if ($rootScope.MiniSettings["Profile"]["AdditionalProfileSubMenuItems"]) {
for (var i = 0; i < $rootScope.MiniSettings["Profile"]["AdditionalProfileSubMenuItems"].length; i++) {
vm.SubMenu.push($rootScope.MiniSettings["Profile"]["AdditionalProfileSubMenuItems"][i]);
}
}
}
return directive;
}
angular.module('bizPart').directive('bizChart', bizChartDirective);
bizChartDirective.$inject = [];
function bizChartDirective() {
var directive = {
restrict: "E",
templateUrl: siteRootPath + "Js/AngularModules/BizPart/Views/bizchart.html?v=" + bizPartVersion,
controller: bizChartController,
bindToController: true,
controllerAs: "vm",
scope: {
ChartType: "@chartType", //bar, line, horizontalBar, pie, doughnut, radar, polarArea or bubble
ChartData: "=chartData",
ChartLabels: "=chartLabels",
ChartSeries: "=chartSeries",
ChartColors: "=?chartColors"
}
}
bizChartController.$inject = [];
function bizChartController() {
var vm = this;
vm.ChartOptions = {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}],
xAxes: [{
ticks: {
beginAtZero: true
}
}]
},
legend: {
display: true
},
tooltips: {
enabled: true
}
};
if (["pie"].indexOf(vm.ChartType) > -1) { //Disable scales
vm.ChartOptions.scales.yAxes = [];
vm.ChartOptions.scales.xAxes = [];
}
vm.EmptyChartLabels = ["", "", ""];
vm.EmptyChartSeries = [""];
vm.EmptyChartData = [[15, 20, 5]];
vm.EmptyChartColors = ["#C4C4C4", "#C4C4C4", "#C4C4C4"];
vm.EmptyChartOptions = angular.copy(vm.ChartOptions);
vm.EmptyChartOptions.legend.display = false;
vm.EmptyChartOptions.tooltips.enabled = false;
vm.GetChartLabels = GetChartLabels;
vm.GetChartSeries = GetChartSeries;
vm.GetChartData = GetChartData;
vm.GetChartColors = GetChartColors;
vm.GetChartOptions = GetChartOptions;
function GetChartLabels() {
return vm.ChartData && vm.ChartData.length == 0 ? vm.EmptyChartLabels : vm.ChartLabels;
}
function GetChartSeries() {
return vm.ChartData && vm.ChartData.length == 0 ? vm.EmptyChartSeries : vm.ChartSeries;
}
function GetChartData() {
return vm.ChartData && vm.ChartData.length == 0 ? vm.EmptyChartData : vm.ChartData;
}
function GetChartColors() {
return vm.ChartData && vm.ChartData.length == 0 ? vm.EmptyChartColors : vm.ChartColors;
}
function GetChartOptions() {
return vm.ChartData && vm.ChartData.length == 0 ? vm.EmptyChartOptions : vm.ChartOptions;
}
}
return directive;
}
angular.module('bizPart').directive('bizInfo', bizInfo);
function bizInfo() {
var directive = {
restrict: "E",
transclude: true,
scope: {
placement: "@"
},
template: "-
"
};
return directive;
}
angular.module('bizPart').directive('bizFeature', bizFeature);
bizFeature.$inject = ['$http', '$rootScope'];
function bizFeature($http, $rootScope) {
var promise;
return {
restrict: 'A',
scope: {
bizFeature: '@',
bizFeatureModel: '=?'
},
link: linkFunction
};
function linkFunction(scope, elem, attrs) {
if (!portalCustomerName || !scope.bizFeature)
return;
if (!promise)
promise = $http.get(siteRootPath + 'Customers/' + portalCustomerName + '/Settings/features.json');
promise.then(checkFeature, checkFeature);
function checkFeature(response) {
if (typeof response.data != "object")
return;
scope.bizFeatureModel = scope.bizFeature.split('.').reduce(function (prev, curr) {
if (!prev)
return;
return prev[curr];
}, response.data);
if (!scope.bizFeatureModel)
return;
if (scope.bizFeatureModel.Enabled === false)
elem.replaceWith('');
}
}
}
angular.module('bizPart').directive('bizExcelExport', bizExcelExport);
bizExcelExport.$inject = ["$timeout"];
function bizExcelExport($timeout) {
var directive = {
restrict: "A",
transclude: true,
scope: {
bizExcelExport: "@"
},
template: " ",
link: linkFunction
};
function linkFunction(scope, element, attrs) {
element.bind('click', function () {
scope.showExport = false;
scope.$digest();
$timeout(function () {
scope.showExport = true;
}, 200);
});
}
return directive;
}
angular.module('bizPart').directive('bizValidation', bizValidation);
bizValidation.$inject = ["bizCoreService"]
function bizValidation(bizCoreService) {
var validationKeys = [{
Key: "TEST",
Name: "Test validator",
Regex: "test",
Flags: "i",
Message: "This is some testing validation"
}];
var validationKeyRequest = null;
var directive = {
restrict: "A",
require: "ngModel",
link: linkFunction
};
function linkFunction(scope, element, attrs, ngModel) {
var validationKey = attrs.bizValidation;
if (!validationKeys.length)
GetValidationKeys();
var validator = validationKeys.GetItemByValue("Key", validationKey);
ngModel.$validators.bizValidation = function (modelValue) {
if (!modelValue || !validator)
return false;
var regex = new RegExp(validator.Regex, validator.Flags);
return !!modelValue.match(regex);
};
function GetValidationKeys() {
if (!validationKeyRequest)
validationKeyRequest = bizCoreService.GetPortalsetting("FIELD_VALIDATORS");
validationKeyRequest.then(GetPortalsettingCallback);
function GetPortalsettingCallback(response) {
var result = BizPartCoreHelpers.getResponseValue(response, "[]");
validationKeys = JSON.parse(result);
validator = validationKeys.GetItemByValue("Key", validationKey);
//TODO: Somehow add the "Message" to the form control
}
}
}
return directive;
}
angular.module('bizPart').directive('bizOverflowClass', bizOverflowClass);
bizOverflowClass.$inject = ["$timeout"];
function bizOverflowClass($timeout) {
var directive = {
restrict: "A",
link: linkFunction
};
function linkFunction(scope, elem, attrs) {
var contentsWidth = 0;
$timeout(function () {
elem.children().each(function () {
contentsWidth += $(this).outerWidth(true);
});
checkOverflow();
});
$(window).resize(checkOverflow);
function checkOverflow() {
var elemWidth = elem.width();
if (contentsWidth > elemWidth)
elem.addClass(attrs.bizOverflowClass);
else
elem.removeClass(attrs.bizOverflowClass);
}
}
return directive;
}
angular.module('bizPart').directive('bizHeightClass', bizHeightClass);
bizHeightClass.$inject = ["$timeout"];
function bizHeightClass($timeout) {
var directive = {
restrict: "A",
scope: {
heightLt: "=",
heightGt: "="
},
link: linkFunction
};
function linkFunction(scope, elem, attrs) {
var timeout = null;
$timeout(checkHeight);
$(window).resize(function () {
if (timeout)
$timeout.cancel(timeout);
timeout = $timeout(checkHeight, 250);
});
function checkHeight() {
var elemHeight = elem.height();
if (scope.heightLt)
angular.forEach(scope.heightLt, checkLt);
if (scope.heightGt)
angular.forEach(scope.heightGt, checkGt);
function checkLt(height, cssClass) {
if (elemHeight < height) {
elem.addClass(cssClass);
}
else {
elem.removeClass(cssClass);
}
}
function checkGt(height, cssClass) {
if (elemHeight > height) {
elem.addClass(cssClass);
}
else {
elem.removeClass(cssClass);
}
}
}
}
return directive;
}
angular.module('bizPart').directive('bizRecompile', bizRecompile);
bizRecompile.$inject = ["$timeout"];
function bizRecompile($timeout) {
var directive = {
restrict: "AE",
transclude: true,
scope: {
watch: "="
},
template: "
",
link: linkFunction
};
function linkFunction(scope, element, attrs) {
scope.$watchCollection('watch', debounce(reload, 100));
function reload() {
scope.Render = false;
$timeout(function () {
scope.Render = true;
})
}
}
return directive;
}
angular.module('bizPart').directive('bizMatch', bizMatch);
function bizMatch() {
var directive = {
restrict: "A",
require: "ngModel",
scope: {
"otherModelValue": "=bizMatch"
},
link: linkFunction,
};
function linkFunction(scope, element, attrs, ngModel) {
ngModel.$validators.match = function (modelValue) {
return attrs.bizMatchDisabled === "true" || modelValue === scope.otherModelValue;
};
scope.$watch("otherModelValue", function () {
ngModel.$validate();
});
scope.$watch(function () { return attrs.bizMatchDisabled; }, function () {
ngModel.$validate();
})
}
return directive;
}
angular.module('bizPart').directive('bizMaxlength', bizMaxlengthDirective);
bizMaxlengthDirective.$inject = [];
function bizMaxlengthDirective() {
var directive = {
restrict: "A",
link: bizMaxlengthLink
};
function bizMaxlengthLink(scope, elem, attr) {
}
return directive;
}
angular.module('bizPart').directive('bizSelected', bizSelectedDirective);
function bizSelectedDirective() {
var directive = {
restrict: "A",
require: "select",
link: bizSelectedLink
};
function bizSelectedLink(scope, elem, attrs, ngModel) {
attrs.$observe('ngModel', function (value) {
scope.$watch(value, function (newValue) {
if (newValue) {
var options = elem.find("option");
for (var i = 0; i < options.length; i++) {
var option = $(options[i])
if (option.val() == newValue.$$hashKey)
option.addClass("selected");
else
option.removeClass("selected");
}
}
})
});
}
return directive;
}
angular.module('bizPart').directive('bizPlaceholders', bizPlaceholdersDirective);
bizPlaceholdersDirective.$inject = [];
function bizPlaceholdersDirective() {
var directive = {
restrict: "A",
controller: bizPlaceholdersController
};
bizPlaceholdersController.$inject = ["$scope", "$element", "$compile", "$rootScope"];
function bizPlaceholdersController($scope, $element, $compile, $rootScope) {
var urlPattern = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/gi;
var handleHtmlWatch = $scope.$watch(function () { return $element.html(); }, function (newVal, oldVal) {
if (newVal != oldVal && newVal) {
var newHtml = HandleHtml(newVal);
$element.html(newHtml);
}
});
function HandleHtml(html) {
//var newHtml = html.replace(urlPattern, '$& '); //This causes infinite recursion
var newHtml = html;
var newHtml = newHtml.replace(/##ICON-(.*?)-ICON##/gmi, ' ');
var newHtml = newHtml.replace(/##ICON-(.*?)##/gmi, ' ');
var newHtml = newHtml.replace(/##B-(.*?)-B##/gmi, '$1 ');
var newHtml = newHtml.replace(/##B-(.*?)##/gmi, '$1 ');
var newHtml = newHtml.replace(/##I-(.*?)##/gmi, '$1 ');
var newHtml = newHtml.replace(/##C(.*?)-(.*?)##/gmi, '$2 ');
var newHtml = newHtml.replace(/##LINK\$(.*?)\$(.*?)##(.*?)##LINK##/gmi, '$3 ');
var newHtml = newHtml.replace(/\r?\n/g, ' ');
//var newHtml = newHtml.replace(/##TITLE##/gmi, 'Blogtitle');
//Header tags (SEO)
var newHtml = newHtml.replace(/##H1-(.*?)-H1##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H2-(.*?)-H2##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H3-(.*?)-H3##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H4-(.*?)-H4##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H5-(.*?)-H5##/gmi, '$1 ');
var newHtml = newHtml.replace(/##H6-(.*?)-H6##/gmi, '$1 ');
if ($rootScope.LoggedInUser && $rootScope.LoggedInUser.Id > 0) {
var newHtml = newHtml.replace(/##EXPERIENCE##/gmi, $rootScope.LoggedInUser.DefaultExperiencePoints);
var newHtml = newHtml.replace(/##FULLNAME##/gmi, $rootScope.LoggedInUser.FullName);
var newHtml = newHtml.replace(/##FIRSTNAME##/gmi, $rootScope.LoggedInUser.FirstName);
var newHtml = newHtml.replace(/##LASTNAME##/gmi, $rootScope.LoggedInUser.LastName);
if ($rootScope.LoggedInUser.DefaultLevel) {
var newHtml = newHtml.replace(/##LEVEL##/gmi, $rootScope.LoggedInUser.DefaultLevel.Id);
}
}
return newHtml;
}
}
return directive;
}
angular.module('bizPart').directive('bizPlaceholdersEdit', bizPlaceholdersEditDirective);
bizPlaceholdersEditDirective.$inject = ["$compile"];
function bizPlaceholdersEditDirective($compile) {
var directive = {
restrict: "A",
link: bizPlaceholdersEditLink,
controller: bizPlaceholdersEditController
}
function bizPlaceholdersEditLink(scope, elem) {
var html = "" +
"" +
"Experience " +
"Full name " +
"First name " +
"Last name " +
"Level " +
"H1 " +
"H2 " +
"Bold " +
"
";
elem.wrap('
');
elem.parent().append($compile(html)(scope));
//"Title " +
}
bizPlaceholdersEditController.$inject = ["$rootScope", "$scope", "$element"];
function bizPlaceholdersEditController($rootScope, $scope, $element) {
$scope.AddPlaceholder = AddPlaceholder;
$scope.AddMarkdown = AddMarkdown;
function AddPlaceholder(placeholder) {
var element = $element[0];
if (document.selection) {
element.focus();
var sel = document.selection.createRange();
sel.text = placeholder;
element.focus();
} else if (element.selectionStart || element.selectionStart === 0) {
var startPos = element.selectionStart;
var endPos = element.selectionEnd;
var scrollTop = element.scrollTop;
element.value = element.value.substring(0, startPos) + placeholder + element.value.substring(endPos, element.value.length);
element.focus();
element.selectionStart = startPos + placeholder.length;
element.selectionEnd = startPos + placeholder.length;
element.scrollTop = scrollTop;
} else {
element.value += placeholder;
element.focus();
}
$(element).trigger('input');
}
function AddMarkdown(markdown) {
var markdownEnd = "";
switch (markdown) {
case "##ICON-":
markdownEnd = "-ICON##";
break;
case "##B-":
markdownEnd = "-B##";
break;
break;
case "##H1-":
markdownEnd = "-H1##";
break;
case "##H2-":
markdownEnd = "-H2##";
break;
default:
markdownEnd = "";
}
var element = $element[0];
if (document.selection) {
element.focus();
var sel = document.selection.createRange();
sel.text = (markdown + " Text here " + markdownEnd);
element.focus();
} else if (element.selectionStart || element.selectionStart === 0) {
var startPos = element.selectionStart;
var endPos = element.selectionEnd;
var scrollTop = element.scrollTop;
var selectedVal = element.value.substring(startPos, endPos);
element.value = element.value.substring(0, startPos) + markdown + selectedVal + markdownEnd + element.value.substring(endPos, element.value.length);
element.focus();
element.selectionStart = startPos + markdown.length;
element.selectionEnd = startPos + markdown.length;
element.scrollTop = scrollTop;
} else {
element.value += (markdown + " Text here " + markdownEnd);
element.focus();
}
$(element).trigger('input');
}
}
return directive;
}
angular.module('bizPart').directive('bizTooltip', bizTooltip);
function bizTooltip() {
var directive = {
restrict: "A",
link: linkFunction,
};
function linkFunction(scope, element, attrs) {
var stop = attrs.$observe('bizTooltip', function (value) {
element.attr('data-toggle', 'tooltip');
if (value) {
element.attr('title', value);
element.tooltip();
stop();
};
});
}
return directive;
}
angular.module('bizPart').directive('bizCopyUrl', bizCopyUrl);
bizCopyUrl.$inject = ["bizCore"];
function bizCopyUrl(bizCoreProvider) {
var directive = {
restrict: "E",
scope: {
url: "=",
urlCopyPrefix: "@",
disabled: "@?"
},
templateUrl: bizCoreProvider.getView('core.directives.bizcopyurl', "Js/AngularModules/BizPart/views/bizCopyUrl.html"),
link: function (scope, element) {
scope.copyUrl = function () {
var input = element.find('input')[0];
var textToCopy = scope.urlCopyPrefix + input.value;
navigator.clipboard.writeText(textToCopy).then(
() => {
console.log('Copying', textToCopy);
},
() => {
console.error('Error copying to clipboard');
}
);
};
},
};
return directive;
}
angular.module('bizPart').directive('bizHighlight', bizHighlight);
function bizHighlight() {
var directive = {
restrict: "A",
scope: {
bizHighlight: "@",
bizHighlightText: "@",
bizHighlightClass: "@?"
},
link: linkFunction
};
function linkFunction(scope, element, attrs) {
scope.$watch(function () { return scope.bizHighlight }, function () {
if (!scope.bizHighlightText)
return;
if (!scope.bizHighlight) {
element.html(scope.bizHighlightText);
return;
}
var className = scope.bizHighlightClass || "biz-highlight";
element.html(scope.bizHighlightText.replace(new RegExp(scope.bizHighlight, "gi"), function (match) {
return '' + match + ' ';
}));
});
}
return directive;
}
angular.module('bizPart').directive('bizBackground', bizBackground);
bizBackground.$inject = ['bizLazyLoadService'];
function bizBackground(bizLazyLoadService) {
var directive = {
restrict: "A",
link: linkFunction,
};
function linkFunction(scope, element, attrs) {
bizLazyLoadService.OnLazyLoadEnabledChange(function (enabled) {
if (enabled)
return;
attrs.$observe('bizBackground', function (value) {
if (value) {
element.css({ 'background-image': 'url(' + value.split(" ").join("%20") + ')' });
element.css({ 'background-size': attrs.bizBackgroundSize || 'cover' });
element.css({ 'background-position': attrs.bizBackgroundPosition || 'center' });
element.css({ 'background-repeat': attrs.bizBackgroundRepeat || 'no-repeat' });
}
else {
element.css({ 'background-image': 'none' });
}
element.addClass('loaded');
});
}, scope);
var imageSrc = attrs.bizBackground;
scope.loadBackground = function (changes) {
imageSrc = attrs.bizBackground;
if (!imageSrc) {
scope.elem.style.backgroundImage = 'none';
return;
}
changes.forEach(function (change) {
if (!change.isIntersecting)
return;
var url = imageSrc.split(" ").join("%20");
var extension = url.substring(url.lastIndexOf("."));
url = url.substring(0, url.lastIndexOf("."));
var scalableExtensions = [".jpg", ".png"];
if (url.toLowerCase().indexOf("mediabank/files") >= 0 && scalableExtensions.indexOf(extension) > -1) {
if (change.target.offsetWidth <= 300) {
url = url + "_Sm";
}
//MOBILE
else if (change.target.offsetWidth <= 960) {
url = url + "_Mobile";
}
//PAD
else if (change.target.offsetWidth <= 1280) {
url = url + "_Pad";
}
}
change.target.style.backgroundImage = 'url(' + attrs.bizBackground.split(" ").join("%20") + ')';
change.target.style.backgroundSize = attrs.bizBackgroundSize || 'cover';
change.target.style.backgroundPosition = attrs.bizBackgroundPosition || 'center';
change.target.style.backgroundRepeat = attrs.bizBackgroundRepeat || 'no-repeat';
change.target.classList.add('loaded');
});
};
attrs.$observe('bizBackground', function (value) {
if (!value) {
element.css({ 'background-image': 'none' });
return;
}
if ('IntersectionObserver' in window &&
'IntersectionObserverEntry' in window &&
'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
scope.observer = new IntersectionObserver(scope.loadBackground);
scope.elem = angular.element(element)[0];
scope.observer.observe(scope.elem);
}
else {
element.css({ 'background-image': 'url(' + value.split(" ").join("%20") + ')' });
element.css({ 'background-size': attrs.bizBackgroundSize || 'cover' });
element.css({ 'background-position': attrs.bizBackgroundPosition || 'center' });
element.css({ 'background-repeat': attrs.bizBackgroundRepeat || 'no-repeat' });
}
});
}
return directive;
}
angular.module('bizPart').directive('bizBackgroundSquare', bizBackgroundSquare);
function bizBackgroundSquare() {
var directive = {
restrict: "A",
link: linkFunction,
};
function linkFunction(scope, element, attrs) {
var stop = attrs.$observe('bizBackgroundSquare', function (value) {
if (value) {
element.css({ 'background-image': 'url(' + value.split(" ").join("%20") + ')' });
element.css({ 'background-size': 'contain' });
element.css({ 'background-position': 'center' });
element.css({ 'background-repeat': 'no-repeat' });
element.css({ 'padding-top': '100%' });
stop();
};
});
}
return directive;
}
angular.module('bizPart').directive('bizPhrase', bizPhraseDirective);
bizPhraseDirective.$inject = ["$translate", "bizPhraseLogService", "$rootScope"];
function bizPhraseDirective($translate, bizPhraseLogService, $rootScope) {
var directive = {
restrict: "A",
scope: {
bizPhrase: "@",
bizPhrasePlaceholders: "=",
bizPhraseEditable: "@",
},
link: linkFunction
};
function linkFunction(scope, element, attrs) {
$translate(scope.bizPhrase).then(function (translation) {
var text = translation.toString();
if (!bizPhraseLogService.Phrases.GetItemByValue('Key', attrs.bizPhrase)) {
bizPhraseLogService.LogPhrase(attrs.bizPhrase, text, $translate.use());
bizPhraseLogService.Phrases.push({ Key: attrs.bizPhrase });
}
if (scope.bizPhrasePlaceholders) {
angular.forEach(scope.bizPhrasePlaceholders, function (value, key) {
var regex = new RegExp(key, 'g');
text = text.replace(regex, value);
});
}
element.text(text);
}, function () {
//console.warn(String.format("bizPhrase | Phrase not found for current culture ({0}): {1}", $translate.use(), attrs.bizPhrase));
});
//if (scope.bizPhraseEditable !== undefined) {
// console.log('Editable...', scope.bizPhrase);
// if ($rootScope.LoggedInUser) { // And has permissions to edit...
// console.log($rootScope.LoggedInUser);
// }
// element.addClass('bizFrontendEditPermitted');
//}
}
return directive;
}
angular.module('bizPart').directive('bizPhraseAlt', bizPhraseAltDirective);
function bizPhraseAltDirective($translate, bizPhraseLogService, $rootScope) {
var directive = {
restrict: "A",
scope: {
bizPhraseAlt: "@",
},
link: linkFunction
};
function linkFunction(scope, element, attrs) {
console.log("phrase alt", attrs.bizPhraseAlt)
$translate(scope.bizPhraseAlt).then(function (translation) {
var text = translation.toString();
//console.log("phrase alt text", text)
if (!bizPhraseLogService.Phrases.GetItemByValue('Key', attrs.bizPhraseAlt)) {
bizPhraseLogService.LogPhrase(attrs.bizPhraseAlt, text, $translate.use());
bizPhraseLogService.Phrases.push({ Key: attrs.bizPhraseAlt });
}
element[0].setAttribute('alt', text);
}, function () {
//console.warn(String.format("bizPhraseAlt | Phrase not found for current culture ({0}): {1}", $translate.use(), attrs.bizPhraseAlt));
});
}
return directive;
}
angular.module('bizPart').directive('bizPhraseAriaLabel', bizPhraseAriaLabelDirective);
function bizPhraseAriaLabelDirective($translate, bizPhraseLogService, $rootScope) {
var directive = {
restrict: "A",
scope: {
bizPhraseAriaLabel: "@",
},
link: linkFunction
};
function linkFunction(scope, element, attrs) {
//console.log("bizPhraseAriaLabel", attrs.bizPhraseAriaLabel)
$translate(scope.bizPhraseAriaLabel).then(function (translation) {
var text = translation.toString();
//console.log("bizPhraseAriaLabel", text)
if (!bizPhraseLogService.Phrases.GetItemByValue('Key', attrs.bizPhraseAriaLabel)) {
bizPhraseLogService.LogPhrase(attrs.bizPhraseAriaLabel, text, $translate.use());
bizPhraseLogService.Phrases.push({ Key: attrs.bizPhraseAriaLabel });
}
element[0].setAttribute('aria-label', text);
}, function () {
//console.warn(String.format("bizPhraseAriaLabel | Phrase not found for current culture ({0}): {1}", $translate.use(), attrs.bizPhrase));
});
}
return directive;
}
angular.module('bizPart').directive('bizPhrasePlaceholder', bizPhrasePlaceholderDirective);
function bizPhrasePlaceholderDirective() {
var directive = {
restrict: "A",
link: linkFunction,
scope: {
bizPhrasePlaceholder: '@'
}
};
function linkFunction(scope, element, attrs) {
var phrase = BizPart.Client.Core.CurrentTab.GetPhrase(scope.bizPhrasePlaceholder);
if (phrase)
element[0].placeholder = phrase;
}
return directive;
}
angular.module('bizPart').directive('bizGo', bizGoDirective);
function bizGoDirective() {
var directive = {
restrict: "A",
link: bizGoLink
};
function bizGoLink(scope, element, attrs) {
var path = "";
attrs.$observe('bizGo', function (val) {
path = val;
});
element.bind('click', function () {
if (path && path != "") {
window.location.href = path;
}
});
}
return directive;
}
angular.module('bizPart').directive('bizBackButton', bizBackButton);
function bizBackButton() {
var directive = {
restrict: "E",
scope: {
href: '@'
},
bindToController: true,
controllerAs: 'vm',
controller: bizBackButtonController
};
bizBackButtonController.$inject = ["$scope", "$compile"];
function bizBackButtonController($scope, $compile) {
var vm = this;
vm.GoBack = GoBack;
function GoBack() {
if (vm.href)
window.location.href = $rootScope.BackUrl;
else
window.history.back();
}
var element = angular.element('.biz-back-button');
if (!element.length)
angular.element(document.body).append($compile(' ')($scope));
}
return directive;
}
angular.module('bizPart').directive('bizVideoModuleEvents', bizVideoModuleEventsDirective);
bizVideoModuleEventsDirective.$inject = ["bizCoreService"];
function bizVideoModuleEventsDirective(bizCoreService) {
var directive = {
restrict: "A",
link: linkFunction,
scope: {
onEnded: "&",
onPlay: "&?"
}
};
function linkFunction(scope, element, attrs) {
element[0].onended = function () {
scope.$apply(scope.onEnded());
}
element[0].onplay = function () {
if (scope.onPlay) {
scope.$apply(scope.onPlay());
}
}
}
return directive;
}
angular.module('bizPart').directive('bizLoader', bizLoader);
bizLoader.$inject = ["bizLoaderService", "$timeout"];
function bizLoader(bizLoaderService, $timeout) {
var directive = {
restrict: "E",
link: linkFunction,
template: '
'
//template: ""
};
function linkFunction(scope, element, attrs) {
scope.progressIcon = siteRootPath + bizLoaderService.LoaderIcon;
scope.radius = attrs.radius;
scope.loadertype = getLoader('sonar');
var delayShow = attrs.delay || 1500;
$timeout(function () {
scope.loaded = true;
}, delayShow);
}
return directive;
}
angular.module('bizPart').directive('bizStateUrl', bizStateUrl);
bizStateUrl.$inject = ["$state", "$compile"];
function bizStateUrl($state, $compile) {
var allStates = $state.get();
var directive = {
restrict: "A",
scope: {
bizStateUrl: "@",
bizStateUrlParams: "="
},
link: linkFunction
}
function linkFunction(scope, elem, attrs) {
attrs.$observe("bizStateUrl", function (stateUrl) {
if (!stateUrl)
return;
if (scope.bizStateUrlParams) {
for (var prop in scope.bizStateUrlParams) {
stateUrl = stateUrl + "/:" + prop;
}
}
var state = allStates.GetItemByValue("url", stateUrl);
if (!state)
return;
elem.unbind('click');
elem.css("cursor", "pointer");
elem.bind('click', function (event) {
$state.go(state.name, scope.bizStateUrlParams);
});
});
}
return directive;
}
angular.module('bizPart').directive('bizFullPageLoader', bizFullPageLoader);
function bizFullPageLoader() {
var directive = {
restrict: "E",
template: '',
controller: bizFullPageLoaderController,
controllerAs: "vm"
};
bizFullPageLoaderController.$inject = ["bizLoaderService"]
function bizFullPageLoaderController(bizLoaderService) {
var vm = this;
vm.ShowLoader = ShowLoader;
vm.ProgressIcon = siteRootPath + bizLoaderService.LoaderIcon
function ShowLoader() {
return bizLoaderService.FullPageLoaderRequests > 0;
}
}
return directive;
}
angular.module('bizPart').directive('bizBackgroundImage', bizBackgroundImageDirective);
bizBackgroundImageDirective.$inject = ["bizCoreService"];
function bizBackgroundImageDirective(bizCoreService) {
var directive = {
restrict: "A",
link: linkFunction
};
function linkFunction(scope, element) {
bizCoreService.GetPortalsetting('bizBackgroundImage').success(getPortalsettingCallback);
function getPortalsettingCallback(response) {
if (response.d != "") {
setElementAttributes(response.d);
}
}
function setElementAttributes(backgroundImage) {
backgroundImage = siteRootPath + backgroundImage;
angular.element(element).css('background', 'url(' + backgroundImage + ')');
angular.element(element).css('background-size', 'cover');
}
setElementAttributes('images/common/background.jpg');
}
return directive;
}
angular.module('bizPart').directive('bizVideoEvents', bizVideoEventsDirective);
bizVideoEventsDirective.$inject = ["bizCoreService"];
function bizVideoEventsDirective(bizCoreService) {
var directive = {
restrict: "A",
link: linkFunction
};
function linkFunction(scope, element, attrs) {
element.ready(function () {
element[0].onplay = function () {
bizCoreService.EventStart(scope.$eval(attrs.bizVideoEvents).Id, attrs.bizVideoEventsStart);
};
element[0].onended = function () {
bizCoreService.EventEnd(scope.$eval(attrs.bizVideoEvents).Id, attrs.bizVideoEventsEnd);
};
});
}
return directive;
}
angular.module('bizPart').directive('afterRender', afterRender);
afterRender.$inject = ["$timeout"];
function afterRender($timeout) {
return {
restrict: 'A',
terminal: true,
transclude: false,
link: function (scope, element, attrs) {
if (attrs.afterRender) {
$timeout(scope.$eval(attrs.afterRender), 500); //Calling a scoped method
}
}
};
}
angular.module('bizPart').directive('onFinishRender', onFinishRender);
onFinishRender.$inject = ["$timeout"];
function onFinishRender($timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last) {
$timeout(function () {
scope.$eval(attr.onFinishRender);
})
}
}
}
}
angular.module('bizPart').directive('bizClickOutside', bizClickOutside);
bizClickOutside.$inject = ['$document', '$timeout'];
function bizClickOutside($document, $timeout) {
return {
link: function postLink(scope, element, attrs) {
var onClick = function (event) {
var isChild = element[0].contains(event.target);
var isSelf = element[0] == event.target;
var isInside = isChild || isSelf;
if (!isInside) {
scope.$apply(attrs.bizClickOutside)
}
}
var timeoutPromise;
if(attrs.bizClickOutsideActive === undefined) {
$document.bind('click', onClick);
}
scope.$watch(function () { return attrs.bizClickOutsideActive }, function (newValue, oldValue) {
$timeout.cancel(timeoutPromise);
timeoutPromise = $timeout(function() {
if (newValue !== oldValue && newValue == "true") {
$document.bind('click', onClick);
}
else if (newValue !== oldValue && newValue == "false") {
$document.unbind('click', onClick);
}
}, 150);
});
}
};
};
angular.module('bizPart').directive('fadeIn', fadeIn);
fadeIn.$inject = ["$timeout"];
function fadeIn($timeout) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
if (attrs.fadeIn) {
element.ready(function () {
$timeout(function () { $(attrs.fadeIn).toggleClass("shown"); }, attrs.fadeInTime || 0);
});
}
else {
element.ready(function () {
$timeout(function () { $(element).toggleClass("shown"); }, attrs.fadeInTime || 0);
});
}
}
}
}
angular.module('bizPart').directive('refreshSlickOnLoad', refreshSlickOnLoad);
refreshSlickOnLoad.$inject = ["$timeout"];
function refreshSlickOnLoad($timeout) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.ready(function () {
if (attrs.refreshSlickOnLoad) {
$timeout(function () { $(attrs.refreshSlickOnLoad + ' .slick-slider')[0].slick.refresh(); }, 16);
}
else {
$timeout(function () { $(".slick-slider")[0].slick.refresh(); }, 16);
}
$('.slick-dots').find('li button').attr('disabled', true);
});
}
}
}
angular.module('bizPart').directive('getVideoDuration', getVideoDuration);
function getVideoDuration() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.ready(function () {
$(element)[0].addEventListener('loadedmetadata', function () {
var vlength = $(element)[0].duration;
var sec_num = parseInt(vlength, 10);
var minutes = Math.floor(sec_num / 60);
var seconds = sec_num - (minutes * 60);
if (minutes < 10) { minutes = "0" + minutes; }
if (seconds < 10) { seconds = "0" + seconds; }
var time = minutes + ':' + seconds;
$(element).parent().parent().find('.video-length').text(time);
});
});
}
}
}
angular.module('bizPart').directive('bizVideoLength', bizVideoLength);
bizVideoLength.$inject = ["$parse"];
function bizVideoLength($parse) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.ready(function () {
element[0].addEventListener('loadedmetadata', function () {
scope.$apply(function () {
$parse(attrs.bizVideoLength).assign(scope.$parent, element[0].duration);
})
});
});
}
}
}
angular.module('bizPart').directive('fitYoutubeVideo', fitYoutubeVideo);
function fitYoutubeVideo() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.ready(function () {
setTimeout(function () {
var video = element.find('iframe[src*=youtube]');
if (video.length) {
var wrapper = angular.element('
');
wrapper.insertBefore(video);
video.attr('style', 'position:absolute;top:0;left:0;height:100%;width:100%');
wrapper.append(video);
}
});
});
}
}
}
angular.module('bizPart').directive('bizCheckboxList', bizCheckboxList);
bizCheckboxList.$inject = ["$compile"];
function bizCheckboxList($compile) {
var directive = {
restrict: 'E',
scope: {
ngModel: "=",
options: "@"
},
template: '',
link: linkFunction,
controllerAs: 'vm',
bindToController: true,
controller: bizCheckboxListController
};
function linkFunction(scope, elem, attrs) {
if (!attrs.options) {
console.error("bizCheckboxList: No options expression supplied");
return;
}
var regex = new RegExp(/(.*?) as (.*?) for (.*?) in (.*)/, 'i');
var groups = attrs.options.match(regex);
if (!groups) {
console.error("bizCheckboxList: Invalid options expression. Must be in the format (.*?) as (.*?) for (.*?) in (.*)");
return;
}
var html = '{{' + groups[2] + '}} ';
elem.html(html);
$compile(elem.contents())(scope);
}
bizCheckboxListController.$inject = ["$scope"];
function bizCheckboxListController($scope) {
var vm = this;
vm.toggled = toggled;
vm.toggle = toggle;
function toggled(value) {
return vm.ngModel && vm.ngModel.indexOf(value) > -1;
}
function toggle(value) {
if (!vm.ngModel)
vm.ngModel = [];
if (vm.toggled(value))
vm.ngModel.Remove(value);
else
vm.ngModel.push(value);
}
}
return directive;
}
angular.module('bizPart').directive('bizTranslateBind', bizTranslateBind);
function bizTranslateBind() {
var directive = {
restrict: "A",
scope: {
Translations: "=bizTranslateBind"
},
link: linkFunction
};
function linkFunction(scope, elem, attr) {
if(scope.Translations) {
var translatedObj = scope.Translations.GetItemByValue('CultureId', currentCultureId);
if (translatedObj && translatedObj.Value) {
elem.html(translatedObj.Value);
}
}
}
return directive;
}
angular.module('bizPart').directive('bizTranslate', bizTranslate);
bizTranslate.$inject = ["$rootScope"];
function bizTranslate($rootScope) {
var directive = {
restrict: "A",
scope: {
Translations: "=bizTranslateItems",
Culture: "=bizTranslateCulture",
Type: "@?bizTranslateType",
OnChange: "&?bizTranslateChange",
Model: "=?ngModel",
setDirty: "@?"
},
link: linkFunction
};
return directive;
function linkFunction(scope, element, attrs) {
scope.$watch(function () { return scope.Translations; }, handleTranslations(true) );
scope.$watch(function () { return scope.Culture; }, handleTranslations(false) );
scope.$watch(function () { return scope.Model; }, handleModelUpdate);
element.on('propertychange keyup input cut paste', function () {
if (scope.CurrentTranslation) {
scope.CurrentTranslation.Value = this.value;
if (scope.OnChange) {
scope.OnChange({ $value: scope.CurrentTranslation.Value });
}
SetDirty();
}
});
function handleModelUpdate(newValue, oldValue) {
if (!scope.disableNextOnChange && newValue && newValue != oldValue && scope.CurrentTranslation && scope.Model !== undefined) {
scope.CurrentTranslation.Value = scope.Model;
if (scope.OnChange) {
scope.OnChange({ $value: scope.CurrentTranslation.Value });
}
}
scope.disableNextOnChange = false;
}
function handleTranslations(triggerOnChange) {
return function () {
if (!scope.Culture)
return;
if (!scope.Translations)
scope.Translations = [];
var translations = scope.Translations;
if (scope.Type)
translations = translations.GetItemsByValue('Type', scope.Type);
scope.CurrentTranslation = translations.GetItemByValue('CultureId', scope.Culture.Id);
if (!scope.CurrentTranslation) {
scope.CurrentTranslation = {
CultureId: scope.Culture.Id,
Type: ~~scope.Type,
Value: ""
}
scope.Translations.push(scope.CurrentTranslation);
}
element.val(scope.CurrentTranslation.Value);
scope.disableNextOnChange = !triggerOnChange;
scope.Model = scope.CurrentTranslation.Value;
}
}
function SetDirty() {
if (scope.setDirty) {
$rootScope.$broadcast('PAGE_DIRTY', true);
}
}
}
}
angular.module('bizPart').directive('bizAutofocus', bizAutofocus);
function bizAutofocus() {
return {
restrict: 'A',
link: function (scope, element, attributes) {
element[0].focus();
}
}
}
angular.module('bizPart').directive('bizFocusIf', bizFocusIf);
bizFocusIf.$inject = ["$timeout"]
function bizFocusIf($timeout) {
return {
restrict: 'A',
scope: { bizFocusIf: '=' },
link: function (scope, element) {
scope.$watch('bizFocusIf', function (value) {
if (value === true) {
$timeout(function () {
element[0].focus();
});
}
});
}
};
}
angular.module('bizPart').directive('bizSelectOnFocus', bizSelectOnFocus);
bizSelectOnFocus.$inject = ["$window"];
function bizSelectOnFocus($window) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.on('focus', function () {
if (!$window.getSelection().toString()) {
this.setSelectionRange(0, this.value.length)
}
});
}
};
}
angular.module('bizPart').directive('bizDotdotdot', dotdotdotDirective);
function dotdotdotDirective() {
return {
restrict: 'A',
link: function (scope, element, attributes) {
setTimeout(function () {
if (element.dotdotdot)
element.dotdotdot({ watch: true });
})
}
}
}
angular.module('bizPart').directive('bizToggleTrueHeight', bizToggleTrueHeight);
bizToggleTrueHeight.$inject = ["$timeout"]
function bizToggleTrueHeight($timeout) {
return {
restrict: 'A',
scope: {
showTrueHeight: '=',
baseHeight: '@?'
},
link: function (scope, element, attributes) {
const baseHeight = scope.baseHeight || '0';
function Init() {
if (scope.showTrueHeight) {
$timeout(function () {
var height = element[0].scrollHeight;
element.css('height', height + 'px');
});
} else {
element.css('height', baseHeight + 'px');
}
}
scope.$watch('showTrueHeight', function (value) {
Init();
});
Init();
}
}
}
angular.module('bizPart').directive('bizLineLimit', bizLineLimit);
bizLineLimit.$inject = ["$timeout", "$window", "$compile", "$interpolate", "$filter"]
function bizLineLimit($timeout, $window, $compile, $interpolate, $filter) {
return {
restrict: 'A',
transclude: true,
scope: {
bizLineLimit: '=',
bizLineLimitTruncated: "=?",
disableTakeUnnecessarySpace: "=?",
ngBind: '=?',
ngBindHtml: '=?'
},
link: function (scope, element, attrs, ctrl, transclude) {
var lineHeight = 0;
var initialized = false;
var lineCount = 1;
if (Array.isArray(scope.bizLineLimit)) {
if ($(window).width() < 960)
lineCount = scope.bizLineLimit[0]; //Mobile
else
lineCount = scope.bizLineLimit[1]; //Desktop
}
else {
lineCount = scope.bizLineLimit;
}
scope.$watch('ngBind', function (value) {
if (initialized) {
element.html(StripHtml(value));
}
})
scope.$watch('ngBindHtml', function (value) {
if (initialized) {
element.html(StripHtml(value));
}
})
function Init() {
if (!element.is(':visible'))
return HandleInvisibleElement();
LimitLines();
if(!scope.ngBind && !scope.ngBindHtml) {
transclude(function (clone) {
if (clone.length) {
element.html(clone);
}
});
}
$timeout(function () {
element.dotdotdot({ watch: 'window', callback: Truncated });
});
}
function HandleInvisibleElement() {
var cancel = scope.$watch(function () { return element.is(':visible'); }, function (visible) {
if (!visible)
return;
Init();
cancel();
});
}
function Truncated(isTruncated) {
scope.bizLineLimitTruncated = isTruncated;
}
function StripHtml(content) {
return content;
if (content && content.indexOf('<') >= 0) {
content = $filter('stripHtml')(content);
}
return content;
}
function LimitLines() {
element.html(' ');
if (!lineHeight || ~~lineHeight <= 0)
lineHeight = element.height();
if (scope.ngBind)
element.html(StripHtml(scope.ngBind));
if (scope.ngBindHtml)
element.html(StripHtml(scope.ngBindHtml));
var newHeight = lineHeight * lineCount;
if (scope.disableTakeUnnecessarySpace == undefined || scope.disableTakeUnnecessarySpace == false) {
element.css('height', newHeight + 'px');
} else {
element.css('text-overflow', 'ellipsis');
element.css('display', '-webkit-box');
element.css('max-height', newHeight);
element.css('-webkit-line-clamp', lineCount);
element.css('-webkit-box-orient', 'vertical');
}
element.css('line-height', lineHeight + 'px');
element.css('overflow', 'hidden');
if (element.css('display') == 'inline') //Can't have hidden overflow in an inline element
element.css('display', 'block');
initialized = true;
}
Init();
}
}
}
angular.module('bizPart').directive('bizContainerLimit', bizContainerLimit);
function bizContainerLimit() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.css('white-space', 'nowrap');
setTimeout(function () {
ContainerLimit();
if (element.dotdotdot)
element.dotdotdot({ watch: true });
})
function ContainerLimit() {
var containerHeight = element.outerHeight();
element.css('max-height', containerHeight);
}
}
}
}
angular.module('bizPart').directive('bizLoadingValue', bizLoadingValue);
bizLoadingValue.$inject = ["$timeout"];
function bizLoadingValue($timeout) {
return {
restrict: 'A',
transclude: true,
scope: {
ngBind: '=?',
},
link: function (scope, element, attrs, ctrl, transclude) {
var w = scope.$watch('ngBind', function (value) {
if (value) {
element.html(value);
w();
}
});
function Init() {
$timeout(function () {
element.html(' ');
});
}
Init();
}
}
}
angular.module('bizPart').directive('bizCollapse', collapseDirective);
function collapseDirective() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.ready(function () {
if (attrs.bizCollapse) {
element.bind('click', function () {
$(attrs.bizCollapse).toggleClass('collapsed')
$(element).toggleClass('plus')
});
}
});
}
}
}
angular.module('bizPart').directive('stopEvent', stopEvent);
function stopEvent() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.bind('click', function (e) {
e.stopPropagation();
});
}
}
}
angular.module('bizPart').directive('toggleClass', toggleClass);
function toggleClass() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
if (attrs.toggleClass) {
element.bind('click', function () {
element.toggleClass(attrs.toggleClass);
});
}
}
}
}
angular.module('bizPart').directive('bizExpand', expandDirective);
function expandDirective() {
return {
restrict: 'A',
scope: { expand: "=" },
link: function (scope, element, attributes) {
var expandButton = angular.element('Expand
');
expandButton.insertAfter(element);
$(".expandButton").click(function () {
element.dotdotdot({ watch: true, ellipsis: '' });
element.trigger("isTruncated", function (isTruncated) {
if (isTruncated) {
element.trigger("destroy");
element.removeClass('expandMaxHeight');
}
else {
element.addClass('expandMaxHeight');
}
});
});
},
controller: function ($scope, $element, $timeout) {
$scope.$watch("expand", function () {
$timeout(function () {
$element.dotdotdot({ watch: true, ellipsis: '' });
}, 0);
}, true);
}
}
}
angular.module('bizPart').directive('bizQueryClass', bizQueryClassDirective);
function bizQueryClassDirective() {
return {
restrict: 'A',
scope: {
bizQueryClass: "="
},
link: function (scope, element) {
if (scope.bizQueryClass) {
if (scope.bizQueryClass.Name && scope.bizQueryClass.Value && scope.bizQueryClass.Class) {
if (getParameterByName(scope.bizQueryClass.Name) == scope.bizQueryClass.Value)
element.addClass(scope.bizQueryClass.Class);
}
}
}
}
}
angular.module('bizPart').directive('bizExpandIf', bizExpandIfDirective);
function bizExpandIfDirective() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var expanded = false;
element.hide();
scope.$watch(attrs.bizExpandIf, function (value) {
if (expanded == value)
return;
if (value)
element.slideDown('fast');
else
element.slideUp('fast');
expanded = value;
});
}
}
}
angular.module('bizPart').directive('bizContractIf', bizContractIfDirective);
function bizContractIfDirective() {
return {
restrict: 'A',
scope: {
bizContractIf: "="
},
link: function (scope, element) {
if (scope.bizContractIf) {
element.css('display', 'none');
}
scope.$watch(function () { return scope.bizContractIf },
function (oldValue, newValue) {
if (oldValue != newValue) {
if (newValue)
element.slideDown('fast');
else
element.slideUp('fast');
}
});
}
}
}
angular.module('bizPart').directive('bizProgressCircle', bizProgressCircle);
bizProgressCircle.$inject = ['$timeout'];
function bizProgressCircle($timeout) {
return {
restrict: 'E',
scope: {
progress: '@'
},
template: ' ',
link: linkFunction
};
function linkFunction(scope, elem, attrs) {
var circle = elem.find('circle')[0];
function CalculateCircle(value) {
value = ~~value;
if (value > 100) value = 100;
else if (value < 0) value = 0;
var radius = circle.r.baseVal.value;
var circumference = radius * 2 * Math.PI;
circle.style.strokeDasharray = circumference + " " + circumference;
circle.style.strokeDashoffset = "" + circumference;
const offset = circumference - (value || 0) / 100 * circumference;
circle.style.strokeDashoffset = offset;
scope.initialized = true;
}
CalculateCircle(100);
scope.$watch('progress', function (newVal, oldVal) {
if (newVal && (newVal != oldVal || newVal !== scope.currentValue)) {
$timeout(function () {
try {
CalculateCircle(newVal);
} catch(e) {
console.error("error calculating the progress", e);
}
}, 500);
}
});
}
}
angular.module('bizPart').directive('scrollToBottom', scrollToBottom);
function scrollToBottom() {
return {
restrict: 'A',
scope: { scrollToBottom: "=" },
link: function (scope, element, attributes) {
var initializing = true;
scope.$watchCollection('scrollToBottom', function (newValue) {
if (newValue && newValue.length > 0 && !$(element).is(':animated')) {
setTimeout(function () {
if (initializing) {
$(element).animate({ scrollTop: $(element).prop("scrollHeight") }, 400);
initializing = false;
}
else {
$(element).animate({ scrollTop: $(element).prop("scrollHeight") }, 400);
}
}, 1);
}
});
}
}
}
angular.module('bizPart').directive('keyboardEnter', keyboardEnter);
function keyboardEnter() {
return {
restrict: 'A',
link: function (scope, element, attributes) {
element.bind("keydown keypress", function (event) {
if (event.keyCode == 13 && !event.shiftKey) {
//Checking phase so apply won't generate script-errors.
if (!scope.$$phase) {
scope.$apply(function () {
if (scope.$$childHead && scope.$$childHead.$mdAutocompleteCtrl)
scope.$$childHead.$mdAutocompleteCtrl.hidden = true;
scope.$eval(attributes.keyboardEnter);
});
}
event.preventDefault();
}
});
}
}
}
angular.module('bizPart').directive('hideButton', hideButtonDirective);
hideButtonDirective.$inject = ["$window", "$timeout"];
function hideButtonDirective($window, $timeout) {
var directive = {
restrict: "A",
link: linkFunction
};
function linkFunction($scope, element, attr) {
$scope.Hide = function () {
if (attr.hideButton == "true")
angular.element(element).addClass('hide-button-0');
else
angular.element(element).addClass('hide-button-20');
};
$scope.Show = function () {
if (attr.hideButton == "true")
angular.element(element).removeClass('hide-button-0');
else
angular.element(element).removeClass('hide-button-20');
};
$scope.HideButton = function () {
$scope.HidingButton = $timeout(function () {
$scope.Hide();
}, 2500);
};
$scope.OnScroll = function () {
$timeout.cancel($scope.HidingButton);
$scope.Show();
$scope.HideButton();
};
$scope.OnClick = function () {
$timeout.cancel($scope.HidingButton);
$scope.Show();
$scope.HideButton();
};
angular.element($window).bind('scroll', $scope.OnScroll);
angular.element($window).bind('click', $scope.OnClick);
$scope.HideButton();
}
return directive;
}
angular.module('bizPart').directive('bizIsFullscreen', bizIsFullscreen);
function bizIsFullscreen() {
var directive = {
restrict: "A",
scope: {
bizIsFullscreen: '='
},
link: linkFunction
};
function linkFunction(scope, element, attrs) {
element.on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function (e) {
var fs = document.fullScreenElement;
var wfs = document.webkitFullscreenElement;
var mfs = document.mozFullScreenElement;
var msfs = document.msFullscreenElement;
if (fs || wfs || mfs || msfs) {
scope.bizIsFullscreen = true;
} else {
scope.bizIsFullscreen = false;
}
scope.$apply();
});
}
return directive;
}
angular.module('bizPart').directive('fallbackSrc', fallbackSrc);
function fallbackSrc() {
var directive = {
restrict: "A",
link: linkFunction
};
function linkFunction(scope, element, attrs) {
if(element[0].src == "") {
element[0].src = attrs.fallbackSrc;
}
element.bind('error', function () {
angular.element(this).attr('src', attrs.fallbackSrc);
});
}
return directive;
}
angular.module('bizPart').directive('fitImage', fitImage);
function fitImage() {
var directive = {
restrict: "A",
link: linkFunction
};
return directive;
function linkFunction(scope, element, attrs) {
$(element).css('overflow', 'hidden');
$(element).find("img").on('load', function () {
var limit = 100;
if (attrs.fitImage != "")
limit = ~~attrs.fitImage;
if (this.width == this.height) {
this.width = limit;
this.height = limit;
}
else if (this.width > this.height) {
this.height = limit;
var offset = (this.width - limit) / 2;
$(this).css("margin-left", "-" + offset + "px");
}
else if (this.height > this.width) {
this.width = limit;
var offset = (this.height - limit) / 2;
$(this).css("margin-top", "-" + offset + "px");
}
});
}
}
angular.module('bizPart').directive('bizColorFill', bizColorFill);
function bizColorFill() {
var directive = {
restrict: "A",
link: linkFunction
};
return directive;
function linkFunction(scope, element, attrs) {
var canvas = element[0];
var image = new Image();
image.src = attrs.bizColorFill;
image.onload = function () {
var ratio = canvas.width / image.width;
canvas.height = image.height * ratio;
var ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
ctx.globalCompositeOperation = "source-in";
ctx.fillStyle = "#CCCCCC";
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
}
}
angular.module('bizPart').directive('bizOnLoad', bizOnLoad);
bizOnLoad.$inject = ["$timeout"];
function bizOnLoad($timeout) {
var directive = {
restrict: "A",
scope: {
bizOnLoad: "&"
},
link: linkFunction
};
return directive;
function linkFunction(scope, element, attrs) {
if (element[0].onload != undefined) {
element[0].onload = function () {
if (scope.bizOnLoad)
scope.bizOnLoad();
}
}
else if (scope.bizOnLoad) {
$timeout(scope.bizOnLoad, 100);
}
}
}
angular.module('bizPart').directive('bizOn', bizOn);
bizOn.$inject = ["$timeout"];
function bizOn($timeout) {
var directive = {
restrict: "A",
scope: {
bizOn: "&"
},
link: linkFunction
};
return directive;
function linkFunction(scope, element, attrs) {
if (!attrs.bizOnEvent)
return;
element.on(attrs.bizOnEvent, scope.bizOn);
}
}
angular.module('bizPart').directive('bizSticky', bizSticky);
bizSticky.$inject = ["$window"];
function bizSticky($window) {
var directive = {
restrict: "A",
link: linkFunction
};
return directive;
function linkFunction(scope, element, attrs) {
function setSticky() {
scope.prevWidth = scope.parent.width();
scope.isSticky = true;
scope.parent.css("padding-top", element.height());
element.addClass("sticky");
element.css("position", "fixed");
element.css("width", scope.prevWidth);
element.css("max-width", "100%");
element.css("top", "0");
element.css("z-index", "8000");
}
function removeSticky() {
scope.isSticky = false;
scope.parent.css("padding-top", "0px");
element.removeClass("sticky");
element.css("position", "static");
}
function checkWidth() {
if (scope.prevWidth != scope.parent.width()) {
scope.prevWidth = scope.parent.width();
element.css("width", scope.prevWidth);
}
}
function checkScroll() {
var top = angular.element($window).scrollTop();
scope.bottom = element.offset().top;
if (scope.bottom < top && !scope.isSticky) {
setSticky();
scope.stickyBottom = scope.bottom;
}
else if (scope.stickyBottom > top && scope.isSticky)
removeSticky();
}
function init() {
scope.parent = element.parent();
scope.bottom = element.offset().top;
}
scope.$watch(function () { return attrs.bizSticky; }, function () {
init();
if (attrs.bizSticky == "true") {
angular.element($window).bind('scroll', checkScroll);
angular.element($window).bind('resize', checkWidth);
}
else {
angular.element($window).unbind('scroll', checkScroll);
angular.element($window).unbind('resize', checkWidth);
removeSticky();
}
})
}
}
angular.module('bizPart').directive('bizProgressBar', bizProgressBar);
function bizProgressBar() {
var directive = {
restrict: "E",
template: '' +
'
' +
'
{{getLabel()}}
' +
'
',
scope: {
current: "=current",
total: "=total"
},
link: linkFunction
};
function linkFunction(scope, element, attr) {
scope.getLabel = function () {
if (scope.current < 0 || scope.total <= 0)
return "N/A";
return Math.round((scope.current / scope.total) * 100) + '%'
}
scope.getPercentage = function () {
if (scope.current < 0 || scope.total <= 0)
return '0%';
return Math.round((scope.current / scope.total) * 100) + '%'
}
}
return directive;
}
angular.module('bizPart').directive('bizBlogSearch', bizBlogSearch);
bizBlogSearch.$inject = [];
function bizBlogSearch() {
var directive = {
restrict: "E",
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizBlogSearch.html",
scope: {
blogMoiId: "@blogMoiId",
categoryIds: "@categoryIds",
focusMe: "=focusMe"
},
controller: loginController,
controllerAs: "vm",
bindToController: true,
link: function (scope, element, attr) {
scope.toggleSelect = function () {
scope.vm.ShowSearchResult = !scope.vm.ShowSearchResult;
}
$(document).bind('click', function (event) {
var isClickedElementChildOfPopup = element
.find(event.target)
.length > 0;
if (isClickedElementChildOfPopup) {
return;
}
scope.$apply(function () {
scope.vm.ShowSearchResult = false;
});
});
}
};
loginController.$inject = ["blogSearchService"];
function loginController(blogSearchService) {
var vm = this;
vm.ShowSearchResult = false;
vm.SearchTerm = '';
vm.SearchResult = [];
//Search
vm.KeyEnter = function () {
vm.SearchResult = [];
var promise = blogSearchService.GetBlogPostsSearch(vm.blogMoiId, vm.categoryIds, vm.SearchTerm);
promise.success(BlogPostSearchCallback);
}
function BlogPostSearchCallback(response) {
vm.ShowSearchResult = true;
vm.SearchResult = response.d;
angular.forEach(vm.SearchResult, function (item, index) {
item.ImagePathToUse = item.ImageUrl;
item.FullFriendlyUrl = siteRootPath + item.CategoryFriendlyUrlName + item.UrlRewrite
if (item.ImageUrlFirstOfContent == "") {
item.ImagePathToUse = item.ImageUrlFirstOfContent;
}
if (item.ImagePathToUse != "") {
item.ImagePathToUse = siteRootPath + item.ImagePathToUse;
}
});
}
}
return directive;
}
//angular.module('bizPart').directive('bizLogin', bizLoginDirective);
//bizLoginDirective.$inject = [];
//function bizLoginDirective() {
// var directive = {
// restrict: "E",
// templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/login.html",
// scope: {
// showRegister: "=",
// loggedIn: "="
// },
// controller: loginController,
// controllerAs: "vm",
// bindToController: true
// };
// loginController.$inject = ["loginService", "$timeout"];
// function loginController(loginService, $timeout) {
// var vm = this;
// vm.LoginDetails = {
// UserName: "",
// Password: ""
// };
// vm.LoginError = false;
// vm.AllowingOpenRegistration = false;
// vm.Login = Login;
// vm.Register = Register;
// vm.AllowOpenRegistration = AllowOpenRegistration;
// function Login() {
// loginService.AuthorizeUser(vm.LoginDetails.UserName, vm.LoginDetails.Password, true).then(AuthorizeUserCallback);
// function AuthorizeUserCallback(response) {
// if (response.d.Result == true && ~~response.d.ResultMessage > 0) {
// //We are logged in....
// loginService.GetLoggedInUser().success(GetLoggedInUserCallback);
// }
// else {
// vm.LoginError = true;
// $timeout(function () {
// vm.LoginError = false;
// }, 5000);
// }
// }
// function GetLoggedInUserCallback(response) {
// BizPart.Client.Core.CurrentUser.Initialize(response.d);
// vm.loggedIn = true;
// }
// }
// function Register() {
// loginService.CreateUser(vm.Register.FirstName, vm.Register.LastName, vm.Register.Username, vm.Register.Password, vm.Register.Email).then(RegisterCallback);
// function RegisterCallback(response) {
// if (~~response.d > 0)
// vm.Signup = false;
// }
// }
// function AllowOpenRegistration() {
// loginService.AllowOpenRegistration().then(AllowOpenRegistrationCallback);
// function AllowOpenRegistrationCallback(response) {
// vm.AllowingOpenRegistration = response.d;
// }
// }
// vm.AllowOpenRegistration();
// }
// return directive;
//}
angular.module('bizPart').directive('bizLogin', bizLoginDirective);
bizLoginDirective.$inject = ["bizCore"];
function bizLoginDirective(bizCoreProvider) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('core.directives.login', "Js/AngularModules/BizPart/views/login.html"),
scope: {
showRegister: "=",
loggedIn: "=",
openIdProviderId: "@?"
},
controller: loginController,
controllerAs: "vm",
bindToController: true
};
loginController.$inject = ["loginService", "$timeout", "$state", "$window", "$rootScope"];
function loginController(loginService, $timeout, $state, $window, $rootScope) {
var vm = this;
vm.LoginError = false;
vm.Login = Login;
vm.Hide = Hide;
vm.Init = Init;
if (vm.showRegister === undefined)
vm.showRegister = true;
function Hide() {
$rootScope.$broadcast('HIDE-LOGIN-DIRECTIVE');
}
function Login() {
loginService.Login(vm.UserName, vm.Password).then(LoginCallback);
function LoginCallback(response) {
if (response.data.Token && response.data.Token != "") {
deleteStorage("BizPartAuthToken");
setBizPartAuthToken(response.data.Token, response.data.Id);
}
if (response.data.Id > -1 && response.data.Name == "User")
$window.location.reload();
else if (response.data.Id > -1 && response.data.Name == "Admin") {
$state.go("admin.home");
$window.location.reload();
}
else {
vm.LoginError = true;
}
}
}
function Init() {
}
vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizTree', recurveDirective);
function recurveDirective() {
return {
template: ' {{tree.Name}} ' +
'' +
'
' +
'{{leaf.Name}}' +
'
' +
'
' +
'',
scope: {
tree: '=',
childProperty: '@',
leafProperty: '@'
},
}
}
angular.module('bizPart').directive('bizRecursive', bizRecursive);
function bizRecursive() {
return {
template: '',
scope: {
root: '=',
filter: '&?',
itemClick: '&?',
itemMouseenter: '&?',
itemMouseleave: '&?',
itemDragover: '&?',
childProperty: '@'
},
link: function (scope, element, attrs) {
scope.ItemClick = ItemClick;
scope.MouseEnter = MouseEnter;
scope.MouseLeave = MouseLeave;
scope.GetFilter = GetFilter;
function GetFilter(child) {
if (scope.filter)
return scope.filter()(child);
else
return true;
}
function ItemClick(e) {
if (scope.itemClick) {
scope.itemClick()(scope.root);
}
e.stopPropagation();
e.preventDefault();
}
function MouseEnter() {
if (scope.itemMouseenter)
scope.itemMouseenter()(scope.root);
}
function MouseLeave() {
if (scope.itemMouseleave)
scope.itemMouseleave()(scope.root);
}
}
}
}
angular.module('bizPart').directive('bizEnter', enterDirective);
function enterDirective() {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if (event.which === 13) {
scope.$apply(function () {
scope.$eval(attrs.bizEnter, { 'event': event });
});
event.preventDefault();
}
});
};
}
/**
* @name bizArrowValueChange
* @element input
* @description
* Changes value for input when using arrow up/down or shift + up/down for +/-10 units.
* @param {boolean} [allownegative] Use attribute allownegative for allowing negative numbers.
* @example
*
*
*
*/
angular.module('bizPart').directive('bizArrowValueChange', arrowValueChangeDirective);
function arrowValueChangeDirective() {
return {
restrict: "A",
scope: {},
require: '?ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind("keydown keypress", function (event) {
if (event.key == 'ArrowUp' || event.key == 'ArrowDown') {
changeValue(event);
}
});
function changeValue(event) {
var suffix = '';
var newValue = ngModel.$modelValue;
var currentNumberValue = parseInt(ngModel.$modelValue);
var allowNegativeNumbers = (attrs.allownegative == "" || attrs.allownegative == "true");
var result = ngModel.$modelValue.match(/[a-z|%].*/i);
if (result != null && result.length > 0)
suffix = result[0];
if (isNaN(currentNumberValue))
currentNumberValue = 0;
if (event.key == 'ArrowUp') {
newValue = (currentNumberValue + (event.shiftKey ? 10 : 1));
}
else if (event.key == 'ArrowDown') {
if (currentNumberValue > 0 || (currentNumberValue <= 0 && allowNegativeNumbers))
newValue = (currentNumberValue - (event.shiftKey ? 10 : 1));
if (!allowNegativeNumbers && newValue < 0 || newValue == "")
newValue = 0;
}
ngModel.$setViewValue(parseInt(newValue) + suffix);
ngModel.$render();
event.preventDefault();
}
}
}
}
angular.module('bizPart').directive('bizCkeditor', ckeditorDirective);
function ckeditorDirective() {
return {
require: '?ngModel',
link: function (scope, element, attrs, ngModel) {
var ck = CKEDITOR.replace(element[0]);
ck.on('pasteState', function () {
scope.$apply(function () {
ngModel.$setViewValue(ck.getData());
})
})
ngModel.$render = function (value) {
ck.setData(ngModel.$modelValue);
}
}
}
}
angular.module('bizPart').directive('bizTagView', bizTagView);
bizTagView.$inject = ["bizCore"];
function bizTagView(bizCoreProvider) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('bizTagView', 'Js/AngularModules/BizPart/views/bizTagView.html'),
scope: {
item: "=",
hideTitle: "@?"
},
controller: bizTagViewController,
controllerAs: "vm",
bindToController: true
};
function bizTagViewController() {
var vm = this;
}
return directive;
}
angular.module('bizPart').directive('bizTagCloud', bizTagCloud);
bizTagCloud.$inject = ["bizCore"];
function bizTagCloud(bizCoreProvider) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('bizTagCloud', 'js/AngularModules/BizPart/views/tagcloud-clean.html'),
scope: {
sourceType: "@",
state: "@",
selectedTag: "=",
showDialog: "@",
expandIfSelectedTag: "=?"
},
controller: tagCloudController,
controllerAs: "vm",
bindToController: true
};
tagCloudController.$inject = ["tagCloudService", "$state", "$cookies", "$window", "$scope", "$timeout"];
function tagCloudController(tagCloudService, $state, $cookies, $window, $scope, $timeout) {
var vm = this;
vm.Init = Init;
vm.RedirectToProvidedState = RedirectToProvidedState;
vm.GetAllTagsWithOccurrenceBySource = GetAllTagsWithOccurrenceBySource;
vm.ShowDialog = ShowDialog;
vm.SetCookie = SetCookie;
vm.ScrollTop = ScrollTop;
vm.Tags = [];
vm.ExpandCloud = false;
$scope.$watch('vm.selectedTag', function (newVal, oldVal) {
if (newVal != oldVal && newVal) {
if (vm.expandIfSelectedTag == true && vm.selectedTag > 0) {
vm.ExpandCloud = true;
}
}
});
function ShowDialog() {
var showDialogCookie = getLocalStorage('tagCloudDialogCookieShown');
if (showDialogCookie)
return false;
else
return true;
}
function ScrollTop() {
$window.scrollTo(0, 0);
}
function SetCookie() {
var dialogCookieShown = getLocalStorage('tagCloudDialogCookieShown');
if (!dialogCookieShown)
setLocalStorage('tagCloudDialogCookieShown', 'true');
}
function GetAllTagsWithOccurrenceBySource() {
tagCloudService.GetAllTagsWithOccurenceForItemsByType(vm.sourceType).then(GetAllTagsWithOccurenceForItemsByTypeSuccess);
function GetAllTagsWithOccurenceForItemsByTypeSuccess(response) {
vm.Tags = response.data;
}
}
function RedirectToProvidedState(tag) {
var originalState = getSessionStorage("tag.cloud.original.state");
if(tag.Id == vm.selectedTag && originalState) {
$state.go(originalState);
setSessionStorage('tag.cloud.setexpand', true);
}
else {
if ($state.$current.name !== vm.state) {
setSessionStorage('tag.cloud.original.state', $state.$current.name);
}
vm.selectedTag = tag.Id;
$state.go(vm.state, { tagSystemName: tag.SystemName });
}
}
function Init() {
var expand = getSessionStorage("tag.cloud.setexpand");
if (expand) {
deleteSessionStorage("tag.cloud.setexpand");
vm.ExpandCloud = true;
}
vm.GetAllTagsWithOccurrenceBySource();
if (vm.ShowDialog()) {
$timeout(() => {
vm.SetCookie();
}, 5000);
}
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
angular.module('bizPart').directive('bizLikeActions', bizLikeActions);
bizLikeActions.$inject = ["bizCore"];
function bizLikeActions(bizCoreProvider) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('bizLikeActions', 'Js/AngularModules/BizPart/views/bizLikeActions.html'),
scope: {
likeActions: "=",
item: "=",
likeKey: "@",
showActions: "=?",
showHeader: "=?",
allowComment: "=?"
},
controller: bizLikeActionsController,
controllerAs: "vm",
bindToController: true
};
bizLikeActionsController.$inject = ["bizLikeActionsService", "$state", "$scope", "$rootScope", "bizUser", "$timeout"];
function bizLikeActionsController(bizLikeActionsService, $state, $scope, $rootScope, bizUser, $timeout) {
var vm = this;
vm.ShowCommentInput = false;
vm.SuccessfulLikeActionId = -1;
vm.SuccessfulCommentAction = false;
vm.HasUserLiked = false;
vm.Init = Init;
vm.PerformLikeAction = PerformLikeAction;
vm.UpdateComment = UpdateComment;
vm.IsImage = IsImage;
vm.FilterImages = FilterImages;
vm.FilterIcons = FilterIcons;
function IsImage(action) {
if (!action.Icon) return false;
if (action.Icon.indexOf('/') >= 0 && action.Icon.indexOf('.') >= 0) return true;
return false;
}
function FilterImages(action) {
return vm.IsImage(action.Action);
}
function FilterIcons(action) {
return !vm.IsImage(action.Action);
}
function PerformLikeAction(object, action) {
action.Submitting = true;
bizLikeActionsService.PerformLikeAction(object.CreatedByUserId, object.Id, action.Action.Id, vm.likeKey, vm.comment).then(function (response) {
$timeout(function () {
action.Submitting = false;
}, 1000);
vm.SuccessfulLikeActionId = BizPartCoreHelpers.getResponseValue(response);
if (vm.SuccessfulLikeActionId > 0 || vm.SuccessfulLikeActionId === true) {
action.LikeActionPerformedByUser = true;
action.Count++;
var totalCount = 0;
var totalValue = 0;
for (var i = 0; i < object.LikeActions.length; i++) {
totalCount += object.LikeActions[i].Count;
totalValue += object.LikeActions[i].Action.Value * object.LikeActions[i].Count;
}
object.AverageLikeValue = totalValue / totalCount;
vm.HasUserLiked = true;
}
});
}
function UpdateComment() {
if (vm.SuccessfulLikeActionId > 0 && vm.SuccessfulCommentAction === false) {
bizLikeActionsService.UpdateCommentForLikeAction(vm.SuccessfulLikeActionId, vm.comment).then(function (response) {
vm.SuccessfulCommentAction = BizPartCoreHelpers.getResponseValue(response);
});
}
}
function Init() {
vm.IsAllowedForCurrentUser = $rootScope.MiniSettings["LikeActions"]["ForRolesOnly"].length == 0 || HasRequiredRole();
function HasRequiredRole() {
vm.LoggedInUser = bizUser.getLoggedInUser();
console.log("via bizuser", vm.LoggedInUser);
if (vm.LoggedInUser && vm.LoggedInUser.Roles) {
var allowedRoles = $rootScope.MiniSettings["LikeActions"]["ForRolesOnly"];
for (var i = 0; i < allowedRoles.length; i++) {
var x = vm.LoggedInUser.Roles.GetItemByValue('SystemName', allowedRoles[i]);
if (x) {
return true;
}
}
}
return false;
}
}
$scope.$watch('vm.item', function (newVal, oldVal) {
if (newVal != oldVal) {
if (vm.item.LikeActions.GetItemByValue('LikeActionPerformedByUser', true)) {
vm.HasUserLiked = true;
vm.showRatingIcons = true;
}
}
});
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
angular.module('bizPart').directive('bizLikeView', bizLikeView);
bizLikeView.$inject = ["bizCore"];
function bizLikeView(bizCoreProvider) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('bizLikeView', 'Js/AngularModules/BizPart/views/bizLikeView.html'),
scope: {
item: "="
},
controller: bizLikeViewController,
controllerAs: "vm",
bindToController: true
};
function bizLikeViewController() {
}
return directive;
}
angular.module('bizPart').directive('bizItemType', bizItemType);
bizItemType.$inject = ["bizCore", "$rootScope"];
function bizItemType(bizCoreProvider, $rootScope) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('bizItemType', 'Js/AngularModules/BizPart/views/bizItemType.html'),
scope: {
item: "=",
type: "@",
name: "=",
icon: "=",
id: "="
},
controller: bizItemTypeController,
controllerAs: "vm",
bindToController: true
};
bizItemTypeController.$inject = ["$rootScope", "$state"];
function bizItemTypeController($rootScope, $state) {
var vm = this;
vm.OverrideName = '';
vm.Init = Init;
function Init() {
if (vm.name && vm.name.length > 0) {
vm.OverrideName = vm.name;
return;
}
if ($rootScope.showFirstTagForTypes && $rootScope.showFirstTagForTypes.indexOf(vm.type) >= 0) {
if (vm.item && vm.item.Tags && vm.item.Tags.length > 0 && vm.item.Tags[0].Name.length > 0) {
vm.OverrideName = vm.item.Tags[0].Name;
return;
}
}
vm.OverrideName = '';
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
angular.module('bizPart').directive('bizItemNotFound', bizItemNotFound);
bizItemNotFound.$inject = ["bizCore", "$rootScope"];
function bizItemNotFound(bizCoreProvider, $rootScope) {
var directive = {
restrict: "E",
templateUrl: bizCoreProvider.getView('bizItemNotFound', 'Js/AngularModules/BizPart/views/bizItemNotFound.html'),
scope: {
type: "@?",
image: "=?"
},
controller: bizItemNotFoundController,
controllerAs: "vm",
bindToController: true
};
bizItemNotFoundController.$inject = ["$rootScope"];
function bizItemNotFoundController($rootScope) {
var vm = this;
//vm.Init = Init;
//function Init() {
//}
//vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizContainerModulesList', bizContainerModulesList);
bizContainerModulesList.$inject = [];
function bizContainerModulesList() {
var directive = {
restrict: "E",
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizContainerModulesList.html?v=" + bizPartVersion,
scope: {
adminType: "@"
},
controller: bizContainerModulesListController,
controllerAs: "vm",
bindToController: true
};
bizContainerModulesListController.$inject = ["bizContainerService", "$rootScope", "$mdDialog", "bizCoreService"];
function bizContainerModulesListController(bizContainerService, $rootScope, $mdDialog, bizCoreService) {
var vm = this;
vm.Init = Init;
vm.GetAllContainerModuleAbstracts = GetAllContainerModuleAbstracts;
vm.UpdateContainerModules = UpdateContainerModules;
vm.ToggleModules = ToggleModules;
vm.ContainerModuleAbstracts = [];
vm.CurrentModules = [];
vm.Setting =
{
Key: 'ACTIVE_CONTAINER_MODULES',
Value: '',
ObjectId: 0
};
function GetAllContainerModuleAbstracts() {
var abstractFolders = ['~/Modules/BizPart.BizContainer/CMS/GUI/Modules',
'~/Modules/BizPart.BizContainer/CMS/GUI/Modules/Product',
'~/Modules/BizPart.BizContainer/Campaign/GUI/Modules',
'~/Modules/BizPart.BizContainer/OnlineEducation/GUI/Modules',
'~/Modules/BizPart.BizContainer/Layout/GUI/Modules'];
if ($rootScope.PortalCustomerName) {
abstractFolders.push('~/Customers/BizContainerCustomModules/' + $rootScope.PortalCustomerName + '/CMS');
abstractFolders.push('~/Customers/BizContainerCustomModules/' + $rootScope.PortalCustomerName + '/Campaign');
abstractFolders.push('~/Customers/BizContainerCustomModules/' + $rootScope.PortalCustomerName + '/OnlineEducation');
abstractFolders.push('~/Customers/BizContainerCustomModules/' + $rootScope.PortalCustomerName + '/Layout');
}
bizContainerService.GetAllModuleAbstracts(abstractFolders).then(GetAllModuleAbstractsSuccess);
function GetAllModuleAbstractsSuccess(response) {
vm.ContainerModuleAbstracts = response.data;
bizCoreService.Admin.GetGenericSetting(vm.adminType, 'ACTIVE_CONTAINER_MODULES', 0).then(GetGenericSettingSuccess);
}
}
function ToggleModules(module) {
vm.CurrentModules.indexOf(module.SystemName) > -1 ? vm.CurrentModules.splice(vm.CurrentModules.indexOf(module.SystemName), 1) : vm.CurrentModules.push(module.SystemName);
}
function UpdateContainerModules() {
var confirm = $mdDialog.confirm({
title: 'Are you sure you want to update the modules used in the admin?',
content: 'The modules accessible in this admin will be updated',
ok: "Yes",
cancel: "No",
parent: angular.element(document.body)
});
$mdDialog.show(confirm).then(okSave);
function okSave() {
vm.Setting.Value = JSON.stringify(vm.CurrentModules);
vm.Setting.Type = vm.adminType;
bizCoreService.Admin.UpdateGenericSetting(vm.Setting).then(okSaveSuccess);
function okSaveSuccess(response) {
}
}
}
function Init() {
vm.GetAllContainerModuleAbstracts();
}
function GetGenericSettingSuccess(response) {
if (!response.data) {
//for (var i = 0; i < vm.ContainerModuleAbstracts.length; i++) {
// vm.CurrentModules.push(vm.ContainerModuleAbstracts[i].Name);
//}
}
else
vm.CurrentModules = JSON.parse(response.data.Value);
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
angular.module('bizPart').directive('bizXp', bizXp);
bizXp.$inject = ["bizCore"];
function bizXp(bizCoreProvider) {
var directive = {
restrict: "E",
scope: {
points: '=?', // points to give (recommended to use, only use the ones below if really needed)
givePoints: '=?', //for when there is a boolean variable that decides if points should be given or not
type: '@?', // not really used, but could in theory be used to tell the directive to set a + char in front of the point value (using type 'add')
object: '=?', // for legacy support, needed to send the entire object so different properties can be used in new and old core
objectType: '@?' // type of object, so the proper property can be selected for the points value
},
templateUrl: bizCoreProvider.getView('core.directives.xp', "Js/AngularModules/BizPart/views/bizExperiencePoints.html"),
bindToController: true,
controller: bizXPController,
controllerAs: "vm",
replace:true
}
function bizXPController() {
var vm = this;
vm.Init = Init;
function Init() {
if (typeof vm.givePoints === 'undefined') {
vm.givePoints = true;
}
if (vm.objectType == 'blog') {
vm.points = vm.object.ExperienceGive;
} else if (vm.objectType == 'integer') {
vm.points = vm.object;
}
}
vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizCurrency', bizCurrency);
bizCurrency.$inject = ["bizCore"];
function bizCurrency(bizCoreProvider) {
var directive = {
restrict: "E",
scope: {
currency: '=?', // currency value to give (recommended to use, only use the ones below if really needed)
giveCurrency: '=?', //for when there is a boolean variable that decides if currency should be given or not
type: '@?', // not really used, but could in theory be used to tell the directive to set a + char in front of the currency value (using type 'add')
objectType: '@?', // for legacy support, needed to send the entire object so different properties can be used in new and old core
object: '=' // type of object, so the proper property can be selected for the currency value
},
templateUrl: bizCoreProvider.getView('core.directives.currency', "Js/AngularModules/BizPart/views/bizCurrency.html"),
bindToController: true,
controller: bizCurrencyController,
controllerAs: "vm"
}
function bizCurrencyController() {
var vm = this;
vm.Init = Init;
function Init() {
if (typeof vm.giveCurrency === 'undefined') {
vm.giveCurrency = true;
}
if (vm.objectType == 'blog') {
vm.currency = vm.object.VirtualCurrencyGive;
} else if (vm.objectType == 'integer') {
vm.currency = vm.object;
}
}
vm.$onInit = vm.Init;
}
return directive;
}
angular.module('bizPart').directive('bizUnitLogo', bizUnitLogo);
bizUnitLogo.$inject = ["bizCore"];
function bizUnitLogo(bizCoreProvider) {
var directive = {
restrict: "E",
scope: {
},
templateUrl: bizCoreProvider.getView('core.directives.unitlogo', "Js/AngularModules/BizPart/views/bizUnitLogo.html"),
//bindToController: true,
controller: bizUnitLogoController,
controllerAs: "vm"
}
bizUnitLogoController.$inject = ["bizCoreService", "$window"];
function bizUnitLogoController(bizCoreService, $window) {
var vm = this;
vm.logoAlt = '';
vm.Init = Init;
function Init() {
vm.logoAlt = $window.portalName + ' logotype'
if (!portalSettings.IsUnitEnabled) {
vm.Logo = portalSettings['logo'];
}
else {
bizCoreService.GetUnitLogoForLoggedInUser().then(GetUnitLogoCallback);
function GetUnitLogoCallback(response) {
vm.Logo = BizPartCoreHelpers.getResponseValue(response)
//Fallback to portal logo if the unit doesn't have a logo.
if (!vm.Logo || vm.Logo === "") {
vm.Logo = portalSettings['logo'];
}
}
}
}
vm.$onInit = vm.Init;
}
return directive;
}
angular.module("bizPart").directive("bizSaveBtn", bizSaveBtn);
function bizSaveBtn() {
var directive = {
restrict: 'E',
scope: {
status: "=",
isLead: "=?",
isDisabled: "=?",
saveText: "@?",
savingText: "@?",
savedText: "@?",
errorText: "=?",
initialIcon: "@?",
customClass: "@?"
},
templateUrl: siteRootPath + 'Js/AngularModules/BizPart/views/save-btn.html?v=' + bizPartVersion,
bindToController: true,
controllerAs: 'vm',
controller: bizSaveBtnController
};
bizSaveBtnController.$inject = ["$rootScope", "$scope", "$timeout"];
function bizSaveBtnController($rootScope, $scope, $timeout) {
var vm = this;
vm.Initialize = Initialize;
function Initialize() {
if (!vm.status) {
vm.status = 'INITIAL';
}
$scope.$watch('vm.status', function (newValue, oldValue) {
if (newValue === 'SAVED' && oldValue !== 'SAVED') {
$timeout(function () {
if (vm.status === 'SAVED') {
vm.status = "INITIAL";
}
}, 2000);
} else if (newValue === 'ERROR' && oldValue !== 'ERROR') {
$timeout(function () {
if (vm.status === 'ERROR') {
vm.status = "INITIAL";
}
}, 3000);
}
});
}
$rootScope.Initialized.then(vm.Initialize);
}
return directive;
}
})(window.angular);
// By Luis Perez
// From blog post: http://www.simplygoodcode.com/2014/04/angularjs-getting-around-ngapp-limitations-with-ngmodule/
(function () {
function initNgModules(element) {
var elements = [element],
moduleElements = [],
modules = [],
names = ['ng:module', 'ng-module', 'x-ng-module', 'data-ng-module', 'ng:modules', 'ng-modules', 'x-ng-modules', 'data-ng-modules'],
NG_MODULE_CLASS_REGEXP = /\sng[:\-]module[s](:\s*([\w\d_]+);?)?\s/;
function append(element) {
element && elements.push(element);
}
for (var i = 0; i < names.length; i++) {
var name = names[i];
append(document.getElementById(name));
name = name.replace(':', '\\:');
if (element.querySelectorAll) {
var elements2;
elements2 = element.querySelectorAll('.' + name);
for (var j = 0; j < elements2.length; j++) append(elements2[j]);
elements2 = element.querySelectorAll('.' + name + '\\:');
for (var j = 0; j < elements2.length; j++) append(elements2[j]);
elements2 = element.querySelectorAll('[' + name + ']');
for (var j = 0; j < elements2.length; j++) append(elements2[j]);
}
}
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
var className = ' ' + element.className + ' ';
var match = NG_MODULE_CLASS_REGEXP.exec(className);
if (match) {
moduleElements.push(element);
modules.push((match[2] || '').replace(/\s+/g, ','));
} else {
if (element.attributes) {
for (var j = 0; j < element.attributes.length; j++) {
var attr = element.attributes[j];
if (names.indexOf(attr.name) != -1) {
moduleElements.push(element);
modules.push(attr.value);
}
}
}
}
}
for (var i = 0; i < moduleElements.length; i++) {
var moduleElement = moduleElements[i];
var module = modules[i].replace(/ /g, '').split(",");
angular.bootstrap(moduleElement, module);
}
}
angular.element(document).ready(function () {
initNgModules(document);
});
angular.module('bizPart').value('bizApiControllerUrls', {
FormsUser: "api/FormsUser/",
FormsAdmin: "api/FormsAdmin/",
GenericTag: "api/GenericTag/",
MediabankUser: "api/MediabankUser/"
});
})();
angular.module('bizPart').directive('bizJourney', bizJourneyDirective);
angular.module('bizPart').directive('bizJourneyShowOne', bizJourneyShowOneDirective);
angular.module('bizPart').directive('bizJourneyShowOneGrid', bizJourneyShowOneGridDirective);
angular.module('bizPart').directive('bizJourneyShowOneCarousel', bizJourneyShowOneCarouselDirective);
angular.module('bizPart').directive('bizJourneyGridSlick', bizJourneyGridSlickDirective);
angular.module('bizPart').directive('bizJourneyButtons', bizJourneyButtonsDirective);
angular.module('bizPart').service('bizJourneyService', bizJourneyService);
bizJourneyDirective.$inject = [];
bizJourneyShowOneDirective.$inject = [];
bizJourneyShowOneGridDirective.$inject = [];
bizJourneyShowOneCarouselDirective.$inject = [];
bizJourneyGridSlickDirective.$inject = [];
bizJourneyService.$inject = ["$http", "$state"];
function bizJourneyDirective() {
var directive = {
restrict: "E",
scope: {
itemsPerRow: "=?",
hideFavorites: "=?",
miniSettings: "=?",
item: "=?",
typeName: "@?",
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizJourney.html",
controller: bizJourneyController,
controllerAs: "vm",
bindToController: true
};
bizJourneyController.$inject = ["$rootScope", "bizJourneyService", "$state"];
function bizJourneyController($rootScope, bizJourneyService, $state) {
var vm = this;
vm.Journeys = [];
vm.GetItemWidth = GetItemWidth;
vm.Description;
function GetItemWidth() {
return 100 / vm.itemsPerRow;
}
$rootScope.$watch('HideFavoritesForUser', function (newVal, oldVal) {
if (newVal && newVal != oldVal) {
if ($rootScope.HideFavoritesForUser !== undefined && $rootScope.HideFavoritesForUser === true) {
vm.hideFavorites = true;
}
}
});
function Init() {
//console.log("journey init");
if (!vm.itemsPerRow) vm.itemsPerRow = 4;
if (vm.miniSettings) {
vm.JourneyDisplayType = 'STANDARD';
} else {
vm.JourneyDisplayType = 'CAROUSEL';
}
if (vm.miniSettings && vm.miniSettings.ShowTags !== undefined) {
vm.hideFavorites = !vm.miniSettings.ShowTags;
}
vm.hideFavorites = true;//favs not used in journey right now
if (!vm.hideFavorites && ($rootScope.HideFavoritesForUser !== undefined && $rootScope.HideFavoritesForUser === true)) {
vm.hideFavorites = true;
}
if (vm.item && vm.item.Id > 0 && (vm.item.EngageObjectType > -1 || vm.typeName)) {
//console.log('vm.item.EngageObjectType', vm.item.EngageObjectType);
}
SetMainJourneyDescription();
$rootScope.JourneysInitialized.then(InitJourneys);
function InitJourneys() {
var journeys = FilterJourneyList($rootScope.Journeys);
vm.Journeys = journeys;
}
function SetMainJourneyDescription() {
bizJourneyService.GetJourneyDescription().then(function (response) {
vm.Description = response.data;
});
}
function FilterJourneyList(jList) {
if (!vm.miniSettings) return jList;
if (!vm.item || vm.item.Id <= 0) return jList;
var filteredList = [];
for (var i = 0; i < jList.length; i++) {
var itemIsInJourney = false;
for (var j = 0; j < jList[i].EngageObjects.length; j++) {
var eo = jList[i].EngageObjects[j];
if (eo.Id === vm.item.Id && eo.EngageObjectType === vm.item.EngageObjectType) {
itemIsInJourney = true;
}
}
if (itemIsInJourney) {
filteredList.push(jList[i]);
}
}
return filteredList;
}
}
this.$onInit = Init;
$rootScope.$on('favorites.change', Init);
}
return directive;
}
function bizJourneyShowOneDirective() {
var directive = {
restrict: "E",
scope: {
journey: "=",
itemsPerRow: "=?",
miniSettings: '=?',
item: "=?",
typeName: "=?",
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizJourneyShowOne.html",
controller: bizJourneyShowOneController,
controllerAs: "vm",
bindToController: true
};
bizJourneyShowOneController.$inject = ["$state", "bizJourneyService", "bizCoreService", "$scope", "$rootScope", "$timeout"];
function bizJourneyShowOneController($state, bizJourneyService, bizCoreService, $scope, $rootScope, $timeout) {
var vm = this;
vm.journeyToShow = {};
vm.isSpecificJourneyEnabled = false;
vm.GetDirection = GetDirection;
vm.Init = Init;
vm.GetItemIcon = bizJourneyService.GetItemIcon;
vm.GoToEngageItem = bizJourneyService.GoToEngageItem;
vm.GetItemWidth = GetItemWidth;
vm.HasPrevEobj = HasPrevEobj;
vm.HasMoreEobj = HasMoreEobj;
vm.IsCurrentItem = IsCurrentItem;
vm.GetJourneySettings = GetJourneySettings;
function GetJourneySettings() {
bizJourneyService.GetJourneySettings().then(GetJourneySettingsCallback);
function GetJourneySettingsCallback(response) {
vm.JourneySettings = response.data;
}
}
function IsCurrentItem(item) {
if (vm.mini && vm.item && vm.item.Id !== undefined) {
if (vm.item.EngageObjectType < 1 && vm.typeName)
vm.item.EngageObjectType = bizJourneyService.GetItemIdByName(vm.typeName);
if (item.Id == vm.item.Id && item.EngageObjectType == vm.item.EngageObjectType)
return true;
}
return false;
}
function HasMoreEobj(item) {
if (vm.mini && item && vm.journeyToShow.EngageObjects[vm.journeyToShow.EngageObjects.length - 1].Id != item.Id) {
return true;
}
return false;
}
function HasPrevEobj(item) {
if (vm.mini && item && vm.journeyToShow.EngageObjects[0].Id != item.Id) {
return true;
}
return false;
}
function GetItemWidth() {
return 100 / vm.itemsPerRow;
}
function GetDirection(index) {
if(index >= 1 || vm.mini) return "top";
else return "bottom";
}
function HandleJourneyData() {
vm.journeyToShow = angular.copy(vm.journey);
if (vm.miniSettings && vm.miniSettings.ShowOwnTypeOnly) {
var objectType = bizJourneyService.GetItemIdByName(vm.miniSettings.ItemType);
vm.journeyToShow.EngageObjects = vm.journeyToShow.EngageObjects.GetItemsByValue('EngageObjectType', objectType);
}
vm.journeyToShow.EngageObjectsDone = [];
if(!vm.isSpecificJourneyEnabled) {
for(var x = 0; x < vm.journeyToShow.EngageObjects.length; x++) {
if(vm.journeyToShow.EngageObjects[x].Status == 3) {
vm.journeyToShow.EngageObjectsDone.push(angular.copy(vm.journeyToShow.EngageObjects[x]));
vm.journeyToShow.EngageObjects.splice(x, 1);
x--;
}
}
}
var counter = 0;
var index = 0;
vm.journeyToShow.EObjects = [];
if(!vm.isSpecificJourneyEnabled) {
for(var x = 0; x < vm.journeyToShow.EngageObjectsDone.length; x++) {
if(counter % vm.itemsPerRow == 0) {
index = counter / vm.itemsPerRow;
if(!vm.journeyToShow.EObjects[index]) {
vm.journeyToShow.EObjects[index] = [];
}
}
vm.journeyToShow.EngageObjectsDone[x].Index = counter + 1;
vm.journeyToShow.EObjects[index].push(vm.journeyToShow.EngageObjectsDone[x]);
counter++;
}
}
var hasFoundFirstUnfinishedObject = false;
var firstUnfinishedObjectIndex = -1;
for(var x = 0; x < vm.journeyToShow.EngageObjects.length; x++) {
if(counter % vm.itemsPerRow == 0) {
index = counter / vm.itemsPerRow;
if(!vm.journeyToShow.EObjects[index]) {
vm.journeyToShow.EObjects[index] = [];
}
}
if(!hasFoundFirstUnfinishedObject && vm.journeyToShow.EngageObjects[x].Status != 3) {
vm.journeyToShow.EngageObjects[x].ShowProgressIndicator = true;
hasFoundFirstUnfinishedObject = true;
firstUnfinishedObjectIndex = x;
}
vm.journeyToShow.EngageObjects[x].Index = counter + 1;
vm.journeyToShow.EObjects[index].push(vm.journeyToShow.EngageObjects[x]);
counter++;
}
if (vm.mini && vm.journeyToShow.EngageObjects.length) {
if (firstUnfinishedObjectIndex < 0) {
firstUnfinishedObjectIndex = 0;
for (var i = 0; i < vm.journeyToShow.EngageObjects.length; i++) {
if (IsCurrentItem(vm.journeyToShow.EngageObjects[i])) {
firstUnfinishedObjectIndex = i;
}
}
}
var miniList = [vm.journeyToShow.EngageObjects[firstUnfinishedObjectIndex]];
//console.log(firstUnfinishedObjectIndex);
//console.log(miniList);
var shift = 1;
while (miniList.length < vm.itemsPerRow && miniList.length < vm.journeyToShow.EngageObjects.length) {
var previous = firstUnfinishedObjectIndex - shift;
var next = firstUnfinishedObjectIndex + shift;
if (previous >= 0)
miniList.unshift(vm.journeyToShow.EngageObjects[previous]);
if (next < vm.journeyToShow.EngageObjects.length)
miniList.push(vm.journeyToShow.EngageObjects[next]);
shift++;
}
vm.journeyToShow.EObjects = [miniList];
}
if ($rootScope.mobile && !vm.mini && firstUnfinishedObjectIndex > 0) {
vm.scrollTo = 'journey-item-' + vm.journeyToShow.EngageObjects[firstUnfinishedObjectIndex].Id;
}
}
function Init() {
if (!vm.itemsPerRow) vm.itemsPerRow = 4;
if (vm.miniSettings && vm.miniSettings.ItemCount) {
vm.itemsPerRow = vm.miniSettings.ItemCount;
}
vm.mini = vm.miniSettings !== undefined;
bizCoreService.GetPortalsetting("IsSpecificJourneyEnabled").then(GetPortalsettingSuccess);
vm.GetJourneySettings();
}
function GetPortalsettingSuccess(response) {
vm.isSpecificJourneyEnabled = (response.data == 'True' || response.data === true ? true : false);
HandleJourneyData();
}
vm.$onInit = vm.Init;
$scope.$on('engageobject.finished', function (event, params) {
if (params) {
for (var i = 0; i < vm.journey.EngageObjects.length; i++) {
if (vm.journey.EngageObjects[i].Id === params.objectId && vm.journey.EngageObjects[i].EngageObjectType === params.objectType) {
vm.journey.EngageObjects[i].Status = params.status;
}
}
}
vm.Init();
});
}
return directive;
}
function bizJourneyShowOneGridDirective() {
var directive = {
restrict: "E",
scope: {
journey: "="
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizJourneyShowOneGrid.html",
controller: bizJourneyShowOneGridController,
controllerAs: "vm",
bindToController: true
};
bizJourneyShowOneGridController.$inject = ["$filter"];
function bizJourneyShowOneGridController($filter) {
var vm = this;
function Init() {
vm.OnlineEducations = $filter('filter')(vm.journey.EngageObjects, {EngageObjectType: 1}, true);
vm.Blogs = $filter('filter')(vm.journey.EngageObjects, {EngageObjectType: 2}, true);
vm.Videos = $filter('filter')(vm.journey.EngageObjects, {EngageObjectType: 3}, true);
//DO WE WANT HTML5 AND SCORM EDUCATIONS IN SAME OR SPLIT?
var scormEducations = $filter('filter')(vm.journey.EngageObjects, {EngageObjectType: 4}, true);
if(scormEducations.length > 0)
vm.OnlineEducations.push(scormEducations);
}
vm.$onInit = Init;
}
return directive;
}
function bizJourneyShowOneCarouselDirective() {
var directive = {
restrict: "E",
scope: {
journey: "="
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizJourneyShowOneCarousel.html",
controller: bizJourneyShowOneCarouselController,
controllerAs: "vm",
bindToController: true
};
bizJourneyShowOneCarouselController.$inject = ["bizJourneyService", "$timeout"];
function bizJourneyShowOneCarouselController(bizJourneyService, $timeout) {
var vm = this;
vm.GetItemIcon = bizJourneyService.GetItemIcon;
vm.GoToEngageItem = bizJourneyService.GoToEngageItem;
vm.GoToFirstNew = GoToFirstNew;
vm.Round = Round;
function Round(i) {
return Math.round(i);
}
function GoToFirstNew() {
var firstNewIndex = -1;
for (var i = 0; i < vm.journey.EngageObjects.length; i++) {
if (vm.journey.EngageObjects[i].Status !== 3) {
firstNewIndex = i;
break;
}
}
if (firstNewIndex < 0)
firstNewIndex = vm.journey.EngageObjects.length - 1;
if (firstNewIndex > 0) {
$timeout(function () {
$(vm.slickId).slick('slickGoTo', firstNewIndex);
}, 1000);
}
}
function Init() {
vm.SlickSettings = {
arrows: true,
dots: false,
infinite: false,
slidesToShow: 6.5,
slidesToScroll: 5,
method: {},
customPaging: function () {
return ' ';
},
responsive: [{
breakpoint: 960,
settings: {
slidesToShow: 2.2,
slidesToScroll: 2
}
}]
}
vm.slickId = "#journey-" + vm.journey.Id + "-slick";
$timeout(function () {
vm.SlickDataLoaded = true;
vm.GoToFirstNew();
});
}
vm.$onInit = Init;
}
return directive;
}
function bizJourneyGridSlickDirective() {
var directive = {
restrict: "E",
scope: {
engageObjects: "=",
typeName: "@?"
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizJourneyGridSlick.html",
controller: bizJourneyGridSlickController,
controllerAs: "vm",
bindToController: true
};
bizJourneyGridSlickController.$inject = ["$state", "bizJourneyService"];
function bizJourneyGridSlickController($state, bizJourneyService) {
var vm = this;
vm.GetItemIcon = bizJourneyService.GetItemIcon;
vm.GoToEngageItem = bizJourneyService.GoToEngageItem;
function Init() {
vm.SlickSettings = {
arrows: true,
dots: false,
infinite: false,
slidesToShow: 5,
slidesToScroll: 5,
customPaging: function () {
return ' ';
},
responsive: [{
breakpoint: 960,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
}]
}
}
vm.$onInit = Init;
}
return directive;
}
function bizJourneyButtonsDirective() {
var directive = {
restrict: "E",
scope: {
typeName: "@?",
item: "="
},
templateUrl: siteRootPath + "Js/AngularModules/BizPart/views/bizJourneyNextOrPrev.html",
controller: bizJourneyButtonsController,
controllerAs: "vm",
bindToController: true
};
bizJourneyButtonsController.$inject = ["$rootScope", "bizJourneyService", "$scope", "$location", "anchorSmoothScroll", "$timeout"];
function bizJourneyButtonsController($rootScope, bizJourneyService, $scope, $location, anchorSmoothScroll, $timeout) {
var vm = this;
vm.Journeys = [];
vm.ItemIdProperty = 'Id';
vm.ShowPrevButton = false;
vm.ShowNextButton = false;
vm.JourneyIsFinished = false;
vm.IsInitialized = false;
vm.GetItemIdProperty = GetItemIdProperty;
vm.SetCurrentEOItemAndJourney = SetCurrentEOItemAndJourney;
vm.GoToNextEngageItem = GoToNextEngageItem;
vm.GoToPrevEngageItem = GoToPrevEngageItem;
vm.EngageObjectFinishedEvent = EngageObjectFinishedEvent;
vm.UpdateJourneyFinishedStatus = UpdateJourneyFinishedStatus;
vm.UpdateEngageObjectStatusToFinished = UpdateEngageObjectStatusToFinished;
vm.ShowFeedbackLink = ShowFeedbackLink;
vm.SetNextJourney = SetNextJourney;
vm.GoToNextJourney = GoToNextJourney;
function GetItemIdProperty() {
if (vm.typeName === 'Speedquiz') {
return 'PluginInstanceId';
}
return 'Id';
}
function SetCurrentEOItemAndJourney() {
if (!vm.item) return;
var itemIdProperty = vm.GetItemIdProperty();
for (var i = 0; i < vm.Journeys.length; i++) {
for (var j = 0; j < vm.Journeys[i].EngageObjects.length; j++) {
if (vm.Journeys[i].EngageObjects[j].Id === vm.item[itemIdProperty]) {
vm.CurrentEOItem = vm.Journeys[i].EngageObjects[j];
vm.CurrentJourney = vm.Journeys[i];
}
}
}
}
function GoToPrevEngageItem() {
bizJourneyService.GoToNextEngageItem(vm.CurrentEOItem, vm.CurrentJourney.EngageObjects, false);
}
function GoToNextEngageItem() {
bizJourneyService.GoToNextEngageItem(vm.CurrentEOItem, vm.CurrentJourney.EngageObjects, true, false);
}
function GoToNextJourney() {
$rootScope.SetCurrentJourney(vm.NextJourney.Id, true);
}
var w = $scope.$watch('vm.item', function (newVal, oldVal) {
if (newVal && newVal != oldVal) {
if (newVal && newVal[vm.GetItemIdProperty()]) {
vm.SetCurrentEOItemAndJourney();
HandleButtons();
}
}
});
function HandleButtons() {
if (vm.item && vm.CurrentEOItem && vm.CurrentEOItem.Id > 0 && (vm.item.EngageObjectType > -1 || vm.typeName)) {
w();
if (vm.item && vm.item.EngageObjectType < 1 && vm.typeName)
vm.item.EngageObjectType = bizJourneyService.GetItemIdByName(vm.typeName);
// Next btn
var lastEo = vm.CurrentJourney.EngageObjects[vm.CurrentJourney.EngageObjects.length - 1];
if (lastEo.Id == vm.CurrentEOItem.Id && lastEo.EngageObjectType == vm.item.EngageObjectType) {
}
else {
vm.ShowNextButton = true;
}
// Prev btn
var firstEo = vm.CurrentJourney.EngageObjects[0];
if (firstEo.Id == vm.CurrentEOItem.Id && firstEo.EngageObjectType == vm.item.EngageObjectType) {
}
else {
vm.ShowPrevButton = true;
}
vm.UpdateJourneyFinishedStatus();
if (!vm.ShowNextButton) {
vm.SetNextJourney();
}
}
else {
console.log('EngageObjectType cant be determined for', vm.item);
}
}
function SetNextJourney() {
var unfinishedJourneysAll = [];
var unfinishedJourneysWHigherOrder = [];
for (var i = 0; i < vm.Journeys.length; i++) {
if (vm.Journeys[i].TotalProgress < 100 && vm.Journeys[i].Id !== vm.CurrentJourney.Id) {
unfinishedJourneysAll.push(vm.Journeys[i]);
if (vm.Journeys[i].Order > vm.CurrentJourney.Order) {
unfinishedJourneysWHigherOrder.push(vm.Journeys[i]);
}
}
}
if (unfinishedJourneysWHigherOrder.length > 0) {
vm.NextJourney = unfinishedJourneysWHigherOrder[0];//first one after
} else if (unfinishedJourneysAll.length > 0) {
vm.NextJourney = unfinishedJourneysAll[unfinishedJourneysAll.length - 1];//first one before...maybe not the best, but seems better than to always send to first
}
//saved in case needed later
//var notStartedJourneys = [];
//var startedJourneys = [];
//var otherFinishedJourneys = [];
////console.log("journeys", vm.Journeys);
//for (var i = 0; i < vm.Journeys.length; i++) {
// var journey = vm.Journeys[i];
// if (!vm.CurrentJourney || vm.CurrentJourney.Id !== journey.Id) {
// var anyStarted = false;
// var anyNotFinished = false;
// for (var j = 0; j < journey.EngageObjects.length; j++) {
// var eoStatus = journey.EngageObjects[j].Status;
// if (eoStatus >= 1) {
// anyStarted = true;
// }
// if (eoStatus !== 3) {
// anyNotFinished = true;
// }
// }
// if (anyNotFinished == false) {
// otherFinishedJourneys.push(journey);
// } else if (anyStarted) {
// startedJourneys.push(journey);
// } else {
// notStartedJourneys.push(journey);
// }
// }
//}
//vm.NotStartedJourneys = notStartedJourneys;
//vm.StartedJourneys = startedJourneys;
//vm.OtherFinishedJourneys = otherFinishedJourneys;
//console.log("vm.NotStartedJourneys", vm.NotStartedJourneys)
//console.log("vm.StartedJourneys", vm.StartedJourneys)
//console.log("vm.OtherFinishedJourneys", vm.OtherFinishedJourneys)
}
function Init() {
$rootScope.JourneysInitialized.then(InitJourneys);
function InitJourneys() {
vm.Journeys = $rootScope.Journeys;
if (vm.Journeys.length > 0) {
vm.SetCurrentEOItemAndJourney();
if (vm.CurrentEOItem && vm.CurrentEOItem.Id !== undefined) {
HandleButtons();
vm.IsInitialized = true;
}
}
}
}
function ShowFeedbackLink(afterFinishedEvent, stateChanged) {
//bizJourneyService.GetJourneySettings().then(GetJourneySettingsCallback);
//function GetJourneySettingsCallback(response) {
// var journeySettings = response.data;
// vm.FeedbackLink = journeySettings.FeedbackPage;
// if (afterFinishedEvent && vm.item.EngageObjectType === 3) {
// $location.hash('bizjourneybuttons');
// anchorSmoothScroll.scrollTo('bizjourneybuttons', 600, 1000);
// }
//}
}
function UpdateJourneyFinishedStatus(afterFinishedEvent) {
if (!vm.Journeys || !vm.Journeys.length || !vm.CurrentJourney || !vm.CurrentJourney.EngageObjects) return false;
if (vm.ShowNextButton) return;//if the current item is not the last one, none of this is needed
var allFinished = true;
for (var i = 0; i < vm.CurrentJourney.EngageObjects.length; i++) {
if (vm.CurrentJourney.EngageObjects[i].Status !== 3) {
allFinished = false;
}
}
if (allFinished) {
var stateChangedToFinished = allFinished && !vm.JourneyIsFinished;
vm.JourneyIsFinished = allFinished;
vm.ShowFeedbackLink(afterFinishedEvent, stateChangedToFinished)
}
}
function UpdateEngageObjectStatusToFinished(objectId, objectType) {
if (!vm.Journeys || !vm.Journeys.length || !vm.CurrentJourney || !vm.CurrentJourney.EngageObjects) return false;
for (var i = 0; i < vm.CurrentJourney.EngageObjects.length; i++) {
var eo = vm.CurrentJourney.EngageObjects[i];
if (eo.Id === objectId && eo.EngageObjectType === objectType) {
eo.Status = 3;
}
}
}
function EngageObjectFinishedEvent(e, p) {
if (!p.passed) return;
vm.UpdateEngageObjectStatusToFinished(p.objectId, p.objectType);
vm.UpdateJourneyFinishedStatus(true);
}
vm.$onInit = Init;
$rootScope.$on('favorites.change', Init);
$rootScope.$on('engageobject.finished', vm.EngageObjectFinishedEvent);
}
return directive;
}
function bizJourneyService($http, $state) {
this.GetEngageJourneys = function() {
return $http.get(siteRootPath + "api/engage/GetEngageJourneys?deepload=true");
};
this.GetEngageJourneysByFavoriteTags = function() {
return $http.get(siteRootPath + "api/engage/GetEngageJourneysByFavoriteTags?deepload=true");
};
this.GetJourneySettings = function () {
return $http.get(siteRootPath + "api/engage/GetGeneralJourneySettings");
};
this.GetJourneyDescription = function () {
return $http.get(siteRootPath + "api/engage/GetJourneyDescription");
};
this.SetCurrentJourney = function (id) {
return $http.post(siteRootPath + "api/engage/SetCurrentJourney", id);
};
this.GoToNextEngageItem = function (currentItem, engageobjects, next, onlyUnfinished) {
var goToItem = null;
for (var i = 0; i < engageobjects.length; i++) {
var currentEo = engageobjects[i];
if (currentItem.Id == currentEo.Id && currentItem.EngageObjectType == currentEo.EngageObjectType) {
if (next && engageobjects.length > i) {
goToItem = engageobjects[i + 1];
}
else if (!next && i > 0) {
goToItem = engageobjects[i - 1];
}
this.GoToEngageItem(goToItem);
break;
}
}
};
this.GetItemIdByName = function (itemName) {
switch (itemName) {
case "HTML5":
return 1;
case "Blog":
return 2;
case "MediabankFile":
return 3;
case "SCORM":
return 4;
case "Speedquiz":
return 5;
case "Certification":
return 6;
case "Mission":
return 7;
}
}
this.GetItemIcon = function(item) {
switch(item.EngageObjectType) {
case 1:
return "fa-graduation-cap"
case 2:
return "fa-newspaper-o"
case 3:
return "fa-play-circle-o"
case 4:
return "fa-graduation-cap"
case 5:
return "fas fa-gamepad"
case 6:
return "far fa-file-certificate";
case 7:
return "fas fa-gamepad"
}
};
this.GoToEngageItem = function(item) {
switch(item.EngageObjectType) {
case 1:
//console.log("going to education", item);
$state.go('base.modules.html5education', { id: item.UrlRewrite || item.Id});
break;
case 2:
$state.go('base.modules.blogtitle', {title: item.UrlRewrite});
break;
case 3:
$state.go('base.modules.mediafile', {id: item.UrlRewrite || item.Id});
break;
case 4:
window.open(siteRootPath + 'scorm/' + item.Id);
break;
case 5:
$state.go('base.modules.speedquizone', {urlRewrite: item.UrlRewrite, pluginInstanceId: item.Id});
break;
case 6:
$state.go('base.modules.certifications');
break;
case 7:
$state.go('base.modules.missionsview', {id: item.Id});
break;
}
};
}
var htmlEnDeCode = (function() {
var charToEntityRegex,
entityToCharRegex,
charToEntity,
entityToChar;
function resetCharacterEntities() {
charToEntity = {};
entityToChar = {};
// add the default set
addCharacterEntities({
'&' : '&',
'>' : '>',
'<' : '<',
'"' : '"',
''' : "'"
});
}
function addCharacterEntities(newEntities) {
var charKeys = [],
entityKeys = [],
key, echar;
for (key in newEntities) {
echar = newEntities[key];
entityToChar[key] = echar;
charToEntity[echar] = key;
charKeys.push(echar);
entityKeys.push(key);
}
charToEntityRegex = new RegExp('(' + charKeys.join('|') + ')', 'g');
entityToCharRegex = new RegExp('(' + entityKeys.join('|') + '|[0-9]{1,5};' + ')', 'g');
}
function htmlEncode(value){
var htmlEncodeReplaceFn = function(match, capture) {
return charToEntity[capture];
};
return (!value) ? value : String(value).replace(charToEntityRegex, htmlEncodeReplaceFn);
}
function htmlDecode(value) {
var htmlDecodeReplaceFn = function(match, capture) {
return (capture in entityToChar) ? entityToChar[capture] : String.fromCharCode(parseInt(capture.substr(2), 10));
};
return (!value) ? value : String(value).replace(entityToCharRegex, htmlDecodeReplaceFn);
}
resetCharacterEntities();
return {
htmlEncode: htmlEncode,
htmlDecode: htmlDecode
};
})();
(function (angular) {
/* DIRECTIVES */
/* directive: bizVideo */
angular.module('bizPart').directive('bizBindElement', bizBindElementDirective);
function bizBindElementDirective() {
var directive = {
restrict: 'A',
link: linkFunction,
scope: {
bizBindElement: '=',
bizBindElementOnBound: '&?'
}
};
function linkFunction(scope, element, attrs) {
scope.bizBindElement = element[0];
scope.$watch('bizBindElement', function (element) {
if (element && scope.bizBindElementOnBound)
scope.bizBindElementOnBound({ $element: element });
});
}
return directive;
}
/* directive: bizVideo */
angular.module('bizPart').directive('bizVideo', bizVideoDirective);
function bizVideoDirective() {
var directive = {
restrict: "A",
link: linkFunction,
scope: {
bizVideo: "="
}
};
function linkFunction(scope, element, attrs) {
scope.bizVideo = element[0];
}
return directive;
}
/* directive/service: bizCodeEditor */
angular.module('bizPart').directive('bizCodeEditor', bizCodeEditor);
angular.module('bizPart').service('bizCodeEditorService', bizCodeEditorService);
bizCodeEditor.$inject = ["$sce", "$rootScope", "bizTextEditorService"];
bizCodeEditorService.$inject = ["$mdDialog"];
function bizCodeEditorService($mdDialog) {
this.OpenEditorAsDialog = function (content, language) {
return $mdDialog.show({
parent: angular.element(document.body),
templateUrl: siteRootPath + 'Js/AngularModules/BizPart/views/bizCodeEditorDialog.html',
controller: OpenEditorAsDialogController,
controllerAs: "vm",
bindToController: true,
locals: {
content,
language
}
}, function () {
console.log("closed without saving");
});
OpenEditorAsDialogController.$inject = ["$mdDialog"];
function OpenEditorAsDialogController($mdDialog) {
var vm = this;
vm.Language = language;
vm.Content = content;
vm.Save = Save;
vm.Cancel = Cancel;
function Cancel() {
$mdDialog.hide();
}
function Save() {
$mdDialog.hide(vm.Content);
}
}
};
}
function bizCodeEditor($sce, $rootScope, bizTextEditorService) {
var directive = {
restrict: "EA",
require: "ngModel",
scope: {
language: "@",
},
link: monacoLink
};
function monacoLink(scope, element, attrs, ngModel) {
const id = bizTextEditorService.getUniqueId("ui-monaco");
attrs.$set('id', id);
var editor = monaco.editor.create(document.getElementById(id), {
language: scope.language,
minimap: {
enabled: false
},
lineNumbers: 'off'
});
editor.getModel().onDidChangeContent(function (event) {
var content = editor.getValue();
content = $sce.trustAsHtml(content);
ngModel.$setViewValue(content);
if (!$rootScope.$$phase) {
scope.$digest();
}
});
ngModel.$formatters.unshift(function (modelValue) {
return modelValue ? $sce.trustAsHtml(modelValue) : '';
});
ngModel.$parsers.unshift(function (viewValue) {
return viewValue ? $sce.getTrustedHtml(viewValue) : '';
});
ngModel.$render = function () {
var viewValue = ngModel.$viewValue ?
$sce.getTrustedHtml(ngModel.$viewValue) : '';
editor.getModel().setValue(viewValue);
}
}
return directive;
}
/* directive: bizTextEditor */
var useLegacyEditor = false;
angular.module('bizPart').directive('bizTextEditor', bizTextEditor);
angular.module('bizPart').service('bizTextEditorService', bizTextEditorService);
bizTextEditor.$inject = ["bizMediabankService", "$filter", "$compile", "$timeout", "$rootScope", "$sce", "$q", "bizTextEditorService", "bizCodeEditorService"];
function bizTextEditorService() {
var UITinymceService = function () {
var ID_ATTR = 'ui-tinymce';
// uniqueId keeps track of the latest assigned ID
var uniqueId = 0;
// getUniqueId returns a unique ID
var getUniqueId = function (nameOverride) {
uniqueId++;
var idAttr = nameOverride ? nameOverride : ID_ATTR;
return idAttr + '-' + uniqueId;
};
// return the function as a public method of the service
return {
getUniqueId: getUniqueId
};
};
// return a new instance of the service
return new UITinymceService();
}
function bizTextEditor(bizMediabankService, $filter, $compile, $timeout, $rootScope, $sce, $q, bizTextEditorService, bizCodeEditorService) {
var directive = {
restrict: "EA",
require: "ngModel",
scope: {
styles: "=?",
fullpage: "=?",
extraMenubarItems: "=?",
inline: "=?",
menuContainer: "=?",
textOutline: "=?"
},
link: useLegacyEditor ? tuiEditorLink : tinyEditorLink
};
function tinyEditorLink(scope, element, attrs, ngModel) {
const id = bizTextEditorService.getUniqueId();
console.log("id", id);
attrs.$set('id', id);
console.log("tiny styles", scope.style);
var selector = "#" + id;
var tinyInstance;
var tinyInitialised = $q.defer();
var customMenu = {};
customMenu["bizpart"] = { title: 'Bizpart' };
var promiseWrapper = function (func, processResultFunc) {
var defer = $q.defer();
func().then(function (data) {
var dataToReturn = processResultFunc ? processResultFunc(data) : data;
defer.resolve(dataToReturn);
});
return defer.promise;
};
var bizpartMenuItems = [
{
itemName: 'bizimage',
itemText: 'Image',
order: 10,
getContentPromise: function () {
return promiseWrapper(function () {
return bizMediabankService.ShowMediabankDialog(bizMediabankService.FileTypes.Image);
}, function (file) {
if (!file)
return '';
return String.format(' ', $filter("siteroot")(file.FileUrl), "");
});
}
},
{
itemName: 'bizvideo',
itemText: 'Video',
order: 11,
getContentPromise: function () {
return promiseWrapper(function () {
return bizMediabankService.ShowMediabankDialog(bizMediabankService.FileTypes.Video);
}, function (file) {
if (!file)
return '';
return '##VIDEO-' + file.Id + '-VIDEO##';
});
}
},
{
itemName: 'bizdoc',
itemText: 'Document',
order: 12,
getContentPromise: function () {
return promiseWrapper(function () {
return bizMediabankService.ShowMediabankDialog(bizMediabankService.FileTypes.Document);
}, function (file) {
if (!file)
return '';
return '##DOCUMENT-' + file.Id + '-DOCUMENT##';
});
}
},
{ itemName: 'bizfirstname', itemText: 'First name', content: '##FIRSTNAME##', order: 20 },
{ itemName: 'bizlastname', itemText: 'Last name', content: '##LASTNAME##', order: 21 },
{ itemName: 'bizfullname', itemText: 'Full name', content: '##FULLNAME##', order: 22 },
{
itemName: 'bizcodeeditor',
itemText: 'Source code',
order: 9999,
replaceContentPromise: function (content) {
return promiseWrapper(function () {
return bizCodeEditorService.OpenEditorAsDialog(content, 'html');
}, function (newContent) {
return newContent;
});
}
}
];
if (IsPortalSettingTrue('IsLevelSystemEnabled')) {
bizpartMenuItems.push(
{ itemName: 'bizlevel', itemText: 'Level', content: '##LEVEL##', order: 30 }
);
bizpartMenuItems.push(
{ itemName: 'bizexperience', itemText: 'Experience', content: '##EXPERIENCE##', order: 31 }
)
}
if (scope.extraMenubarItems) {
for (var i = 0; i < scope.extraMenubarItems.length; i++) {
bizpartMenuItems.push({
itemName: scope.extraMenubarItems[i].itemName,
itemText: scope.extraMenubarItems[i].itemText,
content: scope.extraMenubarItems[i].content,
getContentPromise: scope.extraMenubarItems[i].extraMenubarItems,
order: scope.extraMenubarItems[i].order
});
}
}
function updateView(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().setAttribute('contenteditable', false);
}
} else {
ensureInstance();
if (tinyInstance && !tinyInstance.options.readonly && tinyInstance.getDoc()) {
tinyInstance.getBody().setAttribute('contenteditable', true);
}
}
}
function debounce(func, wait) {
var debounceTimeout;
return function () {
var context = this;
var args = arguments;
var later = function () {
debounceTimeout = null;
func.apply(context, args);
}
$timeout.cancel(debounceTimeout);
debounceTimeout = $timeout(later, wait);
}
}
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 debouncedReInitialize = debounce(function (middleFunction) {
ensureInstance();
if (tinyInstance) {
tinyInstance.remove();
}
tinyInstance = null;
if (middleFunction) {
middleFunction();
}
tinyInitialised = $q.defer();
console.log("reinit tiny")
initialize();
}, 500);
var options = {
setup: function (ed) {
ed.on('init', function () {
ngModel.$render();
ngModel.$setPristine();
ngModel.$setUntouched();
});
ed.on('ExecCommand change NodeChange ObjectResized', function () {
debouncedUpdate(ed);
});
bizpartMenuItems.sort(function (a, b) {
return a.order - b.order;
});
var itemNames = [];
for (var i = 0; i < bizpartMenuItems.length; i++) {
var mi = bizpartMenuItems[i];
ed.ui.registry.addMenuItem(mi.itemName, {
text: mi.itemText,
onAction: (function (mi) {
return function () {
if (mi.content) {
ed.insertContent(mi.content);
}
else if (mi.getContentPromise) {
mi.getContentPromise().then(function (content) {
ed.insertContent(content);
});
}
else if (mi.replaceContentPromise) {
mi.replaceContentPromise(ed.getContent()).then(function (content) {
if (content) {
ed.setContent(content);
updateView(ed);
}
});
}
}
})(mi)
});
itemNames.push(mi.itemName);
}
customMenu['bizpart'].items = itemNames.join(' ');
},
height: 400,
selector,
inline: scope.inline || false,
convert_urls: false,
paste_as_text: true,
menu: customMenu,
menubar: 'edit view insert format bizpart',
toolbar: 'undo redo | formatselect | bold italic underline | alignleft aligncenter alignright alignjustify | forecolor backcolor removeformat | link | numlist bullist | emoticons'
};
const pluginLoadList = ['link', 'lists', 'emoticons', 'code'];
SetPlugins();
function SetPlugins() {
SetPluginStatus('fullpage', scope.fullpage);
options.plugins = pluginLoadList.join(" ");
console.log("loading plugins", options.plugins);
function SetPluginStatus(name, active) {
var index = pluginLoadList.indexOf(name);
if (active && index < 0) {
pluginLoadList.push(name);
} else if (!active && index >= 0) {
pluginLoadList.splice(index, 1);
}
}
}
if (scope.fullpage) {
options.plugins = options.plugins + ' fullpage';
}
if (scope.menuContainer) {
options.fixed_toolbar_container = scope.menuContainer;
}
scope.$watch(function () {
return scope.fullpage;
}, function (newVal, oldVal) {
console.log("updating fullpage")
if (newVal !== undefined && newVal !== oldVal) {
console.log("updating fullpage changed")
debouncedReInitialize(SetPlugins);
}
});
function GetBaseStyle() {
if (scope.textOutline) {
return 'body { -webkit-text-stroke: 0.3px #000; }';
} else {
return '';
}
}
if (scope.styles) {
function SetContentStyle() {
var styleStr;
if (typeof scope.styles === 'object') {
styleStr = 'body {';
var props = Object.keys(scope.styles);
for (var i = 0; i < props.length; i++) {
var prop = props[i];
styleStr += ' ' + prop + ': ' + scope.styles[prop] + '; ';
}
styleStr += ' }';
} else {
styleStr = scope.styles;
}
//console.log("setting styles", styleStr);
styleStr = styleStr + ' ' + GetBaseStyle();
options.content_style = styleStr;
}
SetContentStyle();
scope.$watch(function () {
return scope.styles;
}, function (newVal, oldVal) {
console.log("updating styles")
if (newVal && newVal !== oldVal) {
console.log("updating styles changed")
debouncedReInitialize(SetContentStyle);
}
});
} else {
options.content_style = GetBaseStyle();
}
function initialize() {
$timeout(function () {
var maybeInitPromise = tinymce.init(options);
if (maybeInitPromise && typeof maybeInitPromise.then === 'function') {
maybeInitPromise.then(function () {
tinyInitialised.resolve('');
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) : '';
tinyInitialised.promise.then(function () {
if (tinyInstance && tinyInstance.getDoc()) {
tinyInstance.setContent(viewValue);
//tinyInstance.fire('change');
} else {
console.log("content could not be set")
}
});
}
scope.$on('$destroy', function () {
console.log("destroying tiny")
ensureInstance();
if (tinyInstance) {
tinyInstance.remove();
tinyInstance = null;
}
});
function ensureInstance() {
if (!tinyInstance) {
tinyInstance = tinymce.get(attrs.id);
}
}
initialize();
}
function tuiEditorLink(scope, element, attrs, ngModel) {
var toolbarItems = ['heading', 'bold', 'italic', 'hr', 'divider', 'ul', 'ol', 'table', 'link', 'divider', 'code',
// 'task','quote','strike''code','codeblock','indent','outdent'
];
var bizCustomToolbarItems = [{
Name: "Image",
Event: "bizimage",
EventHandler: imageEventHandler,
Class: "fa fa-image",
Order: 1
}, {
Name: "Video",
Event: "bizvideo",
EventHandler: videoEventHandler,
Class: 'fa fa-video'
}, {
Name: "Document",
Event: "bizdocument",
EventHandler: docEventHandler,
Class: 'fal fa-file-pdf'
}, {
Name: "First name",
Event: "bizfirstname",
Content: "##FIRSTNAME##",
Class: "fal fa-user-tag",
EventHandler: placeholderEventHandler
}, {
Name: "Last name",
Event: "bizlastname",
Content: "##LASTNAME##",
Class: "far fa-user-tag",
EventHandler: placeholderEventHandler
}, {
Name: "Full name",
Event: "fullname",
Content: "##FULLNAME##",
Class: "fas fa-user-tag",
EventHandler: placeholderEventHandler
}];
if (IsPortalSettingTrue('IsLevelSystemEnabled')) {
bizCustomToolbarItems.push({
Name: "Level",
Event: "bizlevel",
Content: "##LEVEL##",
Class: "fa fa-trophy-alt",
EventHandler: placeholderEventHandler
});
bizCustomToolbarItems.push({
Name: "Experience",
Event: "bizexperience",
Content: "##EXPERIENCE##",
Class: "fa fa-trophy",
EventHandler: placeholderEventHandler
});
}
if (scope.extraMenubarItems) {
console.log("adding extra toolbar items", scope.extraMenubarItems);
for (var i = 0; i < scope.extraMenubarItems.length; i++) {
scope.extraMenubarItems[i].EventHandler = localItemEventHandler;
//legacy fix:
scope.extraMenubarItems[i].Name = scope.extraMenubarItems[i].itemText;
scope.extraMenubarItems[i].Event = scope.extraMenubarItems[i].itemName;
scope.extraMenubarItems[i].Class = scope.extraMenubarItems[i].class;
scope.extraMenubarItems[i].Order = scope.extraMenubarItems[i].order;
bizCustomToolbarItems.push(scope.extraMenubarItems[i]);
}
}
var editor = new tui.Editor({
el: element[0],
initialEditType: 'wysiwyg',
height: 'auto',
intialValue: ngModel.$viewValue,
hideModeSwitch: false,
exts: ['colorSyntax', 'table'],
toolbarItems: toolbarItems,
events: {
load: editorLoaded,
change: editorValueChange
}
});
editor.on('pasteBefore', function (event) {
var html = scope.prevPasteData.replace(/(?:\r\n|\r|\n)/g, ' ');
event.$clipboardContainer.html(html);
});
editor.on("paste", function (event) {
scope.prevPasteData = event.data.clipboardData.getData('text') || "";
});
ngModel.$render = function () {
editor.setHtml(ngModel.$modelValue);
}
var toolbar = editor.getUI().getToolbar();
for (var i = 0; i < bizCustomToolbarItems.length; i++) {
createToolbarItem(bizCustomToolbarItems[i]);
}
$compile(element.find('.tui-editor-defaultUI-toolbar'))(scope);
element.find(".te-editor").attr("ng-style", "style");
$compile(element.find(".te-editor"))(scope);
function createToolbarItem(item) {
editor.eventManager.addEventType(item.Event);
editor.eventManager.listen(item.Event, createEventHandler(item));
if (!item.Button)
item.Button = String.format(' ', item.Class);
var button = $(item.Button);
toolbar.addButton({
className: "",
name: item.Name,
event: item.Event,
tooltip: item.Name,
$el: button
});
}
function editorLoaded() {
}
function editorValueChange() {
var html = editor.getHtml();
ngModel.$setViewValue(html);
}
function createEventHandler(item) {
return function () {
item.EventHandler(item);
}
}
function reloadContent() {
editor.setHtml(editor.getHtml());
}
function insertHtml(html) {
var fullHtml = editor.getHtml();
fullHtml = fullHtml + html;
editor.setHtml(fullHtml);
editorValueChange();
}
function placeholderEventHandler(item) {
editor.insertText(item.Content);
}
function localItemEventHandler(item) {
if (item.GetContent) {
item.GetContent().then(function (result) {
editor.insertText(result);
});
} else {
editor.insertText(item.content);
}
if (item.Reload) {
reloadContent();
}
}
function imageEventHandler(item) {
bizMediabankService.ShowMediabankDialog(bizMediabankService.FileTypes.Image).then(function (file) {
if (!file)
return;
editor.insertText(String.format(' ', $filter("siteroot")(file.FileUrl), ""));
reloadContent();
});
}
function docEventHandler(item) {
bizMediabankService.ShowMediabankDialog(bizMediabankService.FileTypes.Document).then(function (file) {
if (!file)
return;
//directly creating a link here doesnt seem to work, html gets fucked up
//editor.insertText(String.format('Link to file ', $filter("siteroot")(file.FileUrl)));
console.log("file", file);
editor.insertText("##DOCUMENT-" + file.Id + "-DOCUMENT##");//get module guid somehow? to fix permissions in getfilehandler??
reloadContent();
});
}
function videoEventHandler(item) {
bizMediabankService.ShowMediabankDialog(bizMediabankService.FileTypes.Video).then(function (file) {
if (!file)
return;
editor.insertText("##VIDEO-" + file.Id + "-VIDEO##");
});
}
}
return directive;
}
/* directive: bizTextViewer */
angular.module('bizPart').directive('bizTextViewer', bizTextViewer);
bizTextViewer.$inject = ["bizPlaceholderService", "$compile", "$sce", "$timeout"];
function bizTextViewer(bizPlaceholderService, $compile, $sce, $timeout) {
var directive = {
restrict: "E",
require: "ngModel",
scope: {
ngModel: "=",
customPlaceholders: "=?",
moduleGuid: "=?",
containerRef: "=?"
},
link: link
};
function link(scope, element, attrs, ngModel) {
var debounceTime = 1000;
var timeout = null;
var prevValue = null;
ngModel.$render = function () {
if (prevValue == htmlEnDeCode.htmlDecode(ngModel.$modelValue))
return;
prevValue = htmlEnDeCode.htmlDecode(ngModel.$modelValue);
if (!timeout) {
element.html(bizPlaceholderService.ReplacePlaceholders(htmlEnDeCode.htmlDecode(ngModel.$modelValue), scope.customPlaceholders, scope.moduleGuid, scope.containerRef));
$compile(element.contents())(scope);
timeout = $timeout(function () { timeout = null; }, debounceTime);
return;
}
$timeout.cancel(timeout);
timeout = $timeout(function () {
element.html(bizPlaceholderService.ReplacePlaceholders(htmlEnDeCode.htmlDecode(ngModel.$modelValue), scope.customPlaceholders, scope.moduleGuid, scope.containerRef));
$compile(element.contents())(scope);
timeout = null;
}, debounceTime);
}
}
return directive;
}
/* FILTERS */
/* filter: bizSumColumn*/
angular.module('bizPart').filter('bizSumColumn', function () {
return function (collection, column) {
var total = 0;
collection.forEach(function (item) {
total += parseFloat(item[column]);
});
return total;
};
});
/* SERVICES */
angular.module('bizPart').service('bizLazyLoadService', bizLazyLoadService);
function bizLazyLoadService() {
var lazyLoadEnabled = true;
var lazyLoadChangeListeners = [];
return {
SetLazyLoadEnabled: SetLazyLoadEnabled,
OnLazyLoadEnabledChange: OnLazyLoadEnabledChange
};
function OnLazyLoadEnabledChange(fn, scope) {
fn(lazyLoadEnabled);
lazyLoadChangeListeners.push(fn);
scope.$on('$destroy', function () {
lazyLoadChangeListeners.Remove(fn);
});
}
function SetLazyLoadEnabled(enabled) {
if (enabled == lazyLoadEnabled)
return;
lazyLoadEnabled = enabled;
for (var i = 0; i < lazyLoadChangeListeners.length; i++) {
lazyLoadChangeListeners[i](lazyLoadEnabled);
}
}
}
/* service: bizPlaceholderService */
angular.module('bizPart').service('bizPlaceholderService', bizPlaceholderService);
bizPlaceholderService.$inject = ["$rootScope"];
function bizPlaceholderService($rootScope) {
this.ReplacePlaceholders = function (text, customPlaceholders, moduleGuid, containerRef) {
if (!text)
return text;
if (!this.Placeholders) {
this.Placeholders = [
{ Name: "Relative paths", Regex: /src="\//gmi, Content: 'src="' + siteRootPath },
{ Name: "Icon", Regex: /##ICON-(.*?)-ICON##/gmi, Content: ' ' },
{ Name: "Bold", Regex: /##B-(.*?)-B##/gmi, Content: '$1 ' },
{ Name: "Bold 2", Regex: /##B-(.*?)##/gmi, Content: '$1 ' },
{ Name: "Itallic", Regex: /##I-(.*?)##/gmi, Content: '$1 ' },
{ Name: "Color", Regex: /##C(.*?)-(.*?)##/gmi, Content: '$2 ' },
{ Name: "Link", Regex: /##LINK\$(.*?)\$(.*?)##(.*?)##LINK##/gmi, Content: '$3 ' },
{ Name: "Heading 1", Regex: /##H1-(.*?)-H1##/gmi, Content: '$1 ' }, //This inline style should not be here /AF
{ Name: "Heading 2", Regex: /##H2-(.*?)-H2##/gmi, Content: '$1 ' }, //This inline style should not be here /AF
{ Name: "Heading 3", Regex: /##H3-(.*?)-H3##/gmi, Content: '$1 ' }, //This inline style should not be here /AF
{ Name: "Heading 4", Regex: /##H4-(.*?)-H4##/gmi, Content: '$1 ' }, //This inline style should not be here /AF
{ Name: "Heading 5", Regex: /##H5-(.*?)-H5##/gmi, Content: '$1 ' }, //This inline style should not be here /AF
{ Name: "Heading 6", Regex: /##H6-(.*?)-H6##/gmi, Content: '$1 ' }, //This inline style should not be here /AF
{ Name: "Mediabank Video", Regex: /##VIDEO-(.*?)-VIDEO##/gmi, Content: ' ' },
{ Name: "Mediabank Document", Regex: /##DOCUMENT-(.*?)-DOCUMENT##/gmi, ContentFunc: GetMediabankDocumentLink },
{ Name: "Experience", Regex: /##EXPERIENCE##/gmi, Content: $rootScope.LoggedInUser ? $rootScope.LoggedInUser.DefaultExperiencePoints : "" },
{ Name: "Full name", Regex: /##FULLNAME##/gmi, Content: $rootScope.LoggedInUser ? $rootScope.LoggedInUser.FullName : "" },
{ Name: "Firstname", Regex: /##FIRSTNAME##/gmi, Content: $rootScope.LoggedInUser ? $rootScope.LoggedInUser.FirstName : "" },
{ Name: "Lastname", Regex: /##LASTNAME##/gmi, Content: $rootScope.LoggedInUser ? $rootScope.LoggedInUser.LastName : "" },
{ Name: "Level", Regex: /##LEVEL##/gmi, Content: $rootScope.LoggedInUser && $rootScope.LoggedInUser.DefaultLevel ? $rootScope.LoggedInUser.DefaultLevel.Id : "" },
{ Name: "Chain", Regex: /##CHAIN##/gmi, Content: $rootScope.LoggedInUser ? $rootScope.LoggedInUser.CustomerName : "" },
{ Name: "Store", Regex: /##STORE##/gmi, Content: $rootScope.LoggedInUser ? $rootScope.LoggedInUser.CustomerParentName : "" }
];
}
for (var i = 0; i < this.Placeholders.length; i++) {
if (this.Placeholders[i].ContentFunc) {
text = text.replace(this.Placeholders[i].Regex, this.Placeholders[i].ContentFunc(moduleGuid, containerRef));
} else {
text = text.replace(this.Placeholders[i].Regex, this.Placeholders[i].Content);
}
}
if (customPlaceholders) {
for (var i = 0; i < customPlaceholders.length; i++) {
text = text.replace(customPlaceholders[i].Regex, customPlaceholders[i].Content);
}
}
return text;
function GetMediabankDocumentLink(moduleGuid, containerRef) {
var mediabankDocmentLink = ' ';
if (moduleGuid && containerRef) {
mediabankDocmentLink = ' ';
}
return mediabankDocmentLink;
}
}
}
})(window.angular)
angular.module('bizSelect', ['ngSanitize'])
.directive('bizSelect', ["$filter", "$timeout", function ($filter, $timeout) {
return {
restrict: "E",
scope:
{
items: "=",
selectedItem: "=",
noSelectText: "@",
orderBy: "@",
filterDisabled: "=?",
filter: "=?",
propertyName: "=",
disabled: '=?',
disabledSearch: '=?',
disableDefaultSelect: '=?',
selectedItemChange: "&?",
imagePropertyName: "=",
selectionAriaLabelPhrase: "=?",
image:"="
},
templateUrl: siteRootPath + 'Js/AngularModules/BizSelect/bizselect.html',
link: function (scope, element, attrs) {
scope.IsOpen = false;
scope.Key = scope.propertyName ? scope.propertyName : "Name";
scope.ImageKey = scope.imagePropertyName ? scope.imagePropertyName : "Image";
scope.ImageAltPhraseKey = "ImageAltPhrase";
scope.ImageAltSelectedKey = "ImageAltSelected";
scope.searchFilter = {};
scope.searchFilter[scope.Key] = "";
scope.SelectedIndex = -1;
scope.required = attrs.required != undefined;
scope.formname = attrs.name;
scope.GetSelectedAltText = function(item) {
console.log("item", item);
}
scope.CheckItems = function () {
if (scope.items && scope.items.length == 1 && !scope.disableDefaultSelect)
scope.SelectItem(scope.items[0]);
};
scope.Blur = function () {
scope.IsOpen = false;
scope.searchFilter[scope.Key] = "";
scope.SelectedIndex = -1;
if (scope.$root.$$phase != '$apply' && scope.$root.$$phase != '$digest') {
scope.$digest();
}
};
scope.GetPlaceholder = function () {
var regex = /(<([^>]+)>)/ig
if (scope.noSelectText && scope.noSelectText != ""
&& (!scope.selectedItem || scope.selectedItem[scope.Key] == undefined))
return scope.noSelectText.replace(regex, " ");
else if (scope.selectedItem && scope.selectedItem[scope.Key] != undefined)
return scope.selectedItem[scope.Key].replace(regex, " ");
};
scope.GetValue = function () {
var regex = /(<([^>]+)>)/ig
if (scope.noSelectText && scope.noSelectText != ""
&& (!scope.selectedItem || scope.selectedItem[scope.Key] == undefined))
return "";
else if (scope.selectedItem && scope.selectedItem[scope.Key] != undefined)
return scope.selectedItem[scope.Key].replace(regex, " ");
}
scope.SelectNone = function () {
scope.selectedItem = undefined;
scope.Blur();
};
scope.SelectItem = function (item) {
if (!item.Disabled) {
scope.selectedItem = item;
//console.log("selected item", item);
scope.Blur();
}
};
scope.$watch('selectedItem', function (newVal, oldVal) {
if (newVal != scope.previous) {
if (scope.selectedItemChange)
scope.selectedItemChange({ newVal: newVal, oldVal: scope.previous });
scope.previous = newVal;
//console.log("selected item", newVal);
}
});
scope.$watch('items', function (newVal, oldVal) {
if (newVal != oldVal)
scope.CheckItems();
}, true);
scope.$watch('items', function (newVal, oldVal) {
if (newVal != oldVal && (scope.orderBy && scope.orderBy != ""))
scope.items = $filter('orderBy')(scope.items, scope.orderBy);
}, true);
$(element).find(".select").on('click', function () {
if (scope.disabled)
return;
scope.IsOpen = !scope.IsOpen;
if (!scope.disabledSearch)
$(element).find("input").focus();
scope.$digest();
});
$(document).mouseup(function (e) {
var container = $(element);
if (!container.is(e.target) && container.has(e.target).length === 0) {
scope.Blur();
}
});
$(element).on('keyup', function (event) {
if (event.keyCode == 40) {
if (scope.SelectedIndex < $(element).find('ul li:not(.ng-hide)').length - 1) {
scope.SelectedIndex++;
$(element).find('ul li:not(.ng-hide)')[scope.SelectedIndex].focus();
}
event.stopPropagation();
}
else if (event.keyCode == 38) {
if (scope.SelectedIndex > 0) {
scope.SelectedIndex--;
$(element).find('ul li:not(.ng-hide)')[scope.SelectedIndex].focus();
}
event.stopPropagation();
}
});
$(element).on('keydown', function (event) {
if (event.keyCode == 40 || event.keyCode == 38) {
event.stopPropagation();
return false;
}
});
scope.CheckItems();
LoadCss(siteRootPath + 'Js/AngularModules/BizSelect/bizselect.css');
}
};
}]);
angular.module('bizPart').directive('bizGauge', bizGaugeDirective);
bizGaugeDirective.$inject = [];
function bizGaugeDirective() {
var directive = {
restrict: "E",
scope: {
min: "=",
max: "=",
val: "=",
absoluteVal: "=",
isReversed: "=?",
badColor: "@?",
goodColor: "@?",
settings: "=?",
lblFunction: "&?",
lblFuncObj: "=?"
},
templateUrl: siteRootPath + "Js/AngularModules/BizGauge/bizGauge.html",
controller: bizGaugeController,
controllerAs: "vm",
bindToController: true
};
bizGaugeController.$inject = ["$scope", "$timeout"];
function bizGaugeController($scope, $timeout) {
var vm = this;
vm.gaugeId = guid();
vm.gauge = undefined;
function Init() {
if(!vm.badColor) vm.badColor = "#f7aa38";
if(!vm.goodColor) vm.goodColor = "#5ee432";
if(!vm.settings) vm.settings = {};
$timeout(function(vm) {
//Reset the element...
document.getElementById(vm.gaugeId).innerHTML = "";
vm.gauge = Gauge(
document.getElementById(vm.gaugeId),
{
min: vm.min,
max: vm.max * 2,
dialStartAngle: vm.settings.dialStartAngle || 180,
dialEndAngle: vm.settings.dialEndAngle || 0,
value: 0,
viewBox: vm.settings.viewBox || "0 0 100 57",
color: function (value) {
//if(vm.isReversed) return vm.badColor;
if (value < vm.max) {
return vm.isReversed == true ? (vm.goodColor || "#5ee432") : (vm.badColor || "#f7aa38");
} else if (value >= vm.max) {
return vm.isReversed == true ? (vm.badColor || "#f7aa38") : (vm.goodColor || "#5ee432");
}
},
label: function(val) {
if(vm.lblFunction ) {
return vm.lblFunction()(vm.absoluteVal, vm.max, vm.lblFuncObj);
}
return Math.round(val) + "%";
},
textY: vm.settings.textY || 46.5,
textX: vm.settings.textX || 50
}
);
vm.gauge.setValueAnimated(vm.val, 1.5);
}, 1, true, vm);
$scope.$watch(function() { return vm.val; }, function(newVal, oldVal) {
if(newVal) {
vm.gauge.setValueAnimated(newVal, 1.5);
}
});
$scope.$watch('vm.isReversed', function(newVal, oldVal) {
if(newVal !== undefined && newVal != oldVal) {
Init();
}
});
LoadCss(siteRootPath + 'Js/AngularModules/BizGauge/bizGauge.css');
}
vm.$onInit = Init;
}
return directive;
}
/* global window, define, module */
(function(global, factory) {
var Gauge = factory(global);
if(typeof define === "function" && define.amd) {
// AMD support
define(function() {return Gauge;});
}else if(typeof module === "object" && module.exports) {
// CommonJS support
module.exports = Gauge;
}else {
// We are probably running in the browser
global.Gauge = Gauge;
}
})(typeof window === "undefined" ? this : window, function(global, undefined) {
var document = global.document,
slice = Array.prototype.slice,
requestAnimationFrame = (global.requestAnimationFrame ||
global.mozRequestAnimationFrame ||
global.webkitRequestAnimationFrame ||
global.msRequestAnimationFrame ||
function(cb) {
return setTimeout(cb, 1000 / 60);
});
// EXPERIMENTAL!!
/**
* Simplistic animation function for animating the gauge. That's all!
* Options are:
* {
* duration: 1, // In seconds
* start: 0, // The start value
* end: 100, // The end value
* step: function, // REQUIRED! The step function that will be passed the value and does something
* easing: function // The easing function. Default is easeInOutCubic
* }
*/
function Animation(options) {
var duration = options.duration,
currentIteration = 1,
iterations = 60 * duration,
start = options.start || 0,
end = options.end,
change = end - start,
step = options.step,
easing = options.easing || function easeInOutCubic(pos) {
// https://github.com/danro/easing-js/blob/master/easing.js
if ((pos/=0.5) < 1) return 0.5*Math.pow(pos,3);
return 0.5 * (Math.pow((pos-2),3) + 2);
};
function animate() {
var progress = currentIteration / iterations,
value = change * easing(progress) + start;
// console.log(progress + ", " + value);
step(value, currentIteration);
currentIteration += 1;
if(progress < 1) {
requestAnimationFrame(animate);
}
}
// start!
requestAnimationFrame(animate);
}
var Gauge = (function() {
var SVG_NS = "http://www.w3.org/2000/svg";
var GaugeDefaults = {
centerX: 50,
centerY: 50
};
var defaultOptions = {
dialRadius: 40,
dialStartAngle: 135,
dialEndAngle: 45,
value: 0,
max: 100,
min: 0,
valueDialClass: "value",
valueClass: "value-text",
dialClass: "dial",
gaugeClass: "gauge",
showValue: true,
gaugeColor: null,
label: function(val) {return Math.round(val);}
};
function shallowCopy(/* source, ...targets*/) {
var target = arguments[0], sources = slice.call(arguments, 1);
sources.forEach(function(s) {
for(var k in s) {
if(s.hasOwnProperty(k)) {
target[k] = s[k];
}
}
});
return target;
}
/**
* A utility function to create SVG dom tree
* @param {String} name The SVG element name
* @param {Object} attrs The attributes as they appear in DOM e.g. stroke-width and not strokeWidth
* @param {Array} children An array of children (can be created by this same function)
* @return The SVG element
*/
function svg(name, attrs, children) {
var elem = document.createElementNS(SVG_NS, name);
for(var attrName in attrs) {
elem.setAttribute(attrName, attrs[attrName]);
}
if(children) {
children.forEach(function(c) {
elem.appendChild(c);
});
}
return elem;
}
/**
* Translates percentage value to angle. e.g. If gauge span angle is 180deg, then 50%
* will be 90deg
*/
function getAngle(percentage, gaugeSpanAngle) {
return percentage * gaugeSpanAngle / 100;
}
function normalize(value, min, limit) {
var val = Number(value);
if(val > limit) return limit;
if(val < min) return min;
return val;
}
function getValueInPercentage(value, min, max) {
var newMax = max - min, newVal = value - min;
return 100 * newVal / newMax;
// var absMin = Math.abs(min);
// return 100 * (absMin + value) / (max + absMin);
}
/**
* Gets cartesian co-ordinates for a specified radius and angle (in degrees)
* @param cx {Number} The center x co-oriinate
* @param cy {Number} The center y co-ordinate
* @param radius {Number} The radius of the circle
* @param angle {Number} The angle in degrees
* @return An object with x,y co-ordinates
*/
function getCartesian(cx, cy, radius, angle) {
var rad = angle * Math.PI / 180;
return {
x: Math.round((cx + radius * Math.cos(rad)) * 1000) / 1000,
y: Math.round((cy + radius * Math.sin(rad)) * 1000) / 1000
};
}
// Returns start and end points for dial
// i.e. starts at 135deg ends at 45deg with large arc flag
// REMEMBER!! angle=0 starts on X axis and then increases clockwise
function getDialCoords(radius, startAngle, endAngle) {
var cx = GaugeDefaults.centerX,
cy = GaugeDefaults.centerY;
return {
end: getCartesian(cx, cy, radius, endAngle),
start: getCartesian(cx, cy, radius, startAngle)
};
}
/**
* Creates a Gauge object. This should be called without the 'new' operator. Various options
* can be passed for the gauge:
* {
* dialStartAngle: The angle to start the dial. MUST be greater than dialEndAngle. Default 135deg
* dialEndAngle: The angle to end the dial. Default 45deg
* radius: The gauge's radius. Default 400
* max: The maximum value of the gauge. Default 100
* value: The starting value of the gauge. Default 0
* label: The function on how to render the center label (Should return a value)
* }
* @param {Element} elem The DOM into which to render the gauge
* @param {Object} opts The gauge options
* @return a Gauge object
*/
return function Gauge(elem, opts) {
opts = shallowCopy({}, defaultOptions, opts);
var gaugeContainer = elem,
limit = opts.max,
min = opts.min,
value = normalize(opts.value, min, limit),
radius = opts.dialRadius,
displayValue = opts.showValue,
startAngle = opts.dialStartAngle,
endAngle = opts.dialEndAngle,
valueDialClass = opts.valueDialClass,
valueTextClass = opts.valueClass,
valueLabelClass = opts.valueLabelClass,
dialClass = opts.dialClass,
gaugeClass = opts.gaugeClass,
gaugeColor = opts.color,
textX = opts.textX,
textY = opts.textY,
gaugeValueElem,
gaugeValuePath,
label = opts.label,
viewBox = opts.viewBox,
instance;
if(startAngle < endAngle) {
console.log("WARN! startAngle < endAngle, Swapping");
var tmp = startAngle;
startAngle = endAngle;
endAngle = tmp;
}
function pathString(radius, startAngle, endAngle, largeArc) {
var coords = getDialCoords(radius, startAngle, endAngle),
start = coords.start,
end = coords.end,
largeArcFlag = typeof(largeArc) === "undefined" ? 1 : largeArc;
return [
"M", start.x, start.y,
"A", radius, radius, 0, largeArcFlag, 1, end.x, end.y
].join(" ");
}
function initializeGauge(elem) {
gaugeValueElem = svg("text", {
x: textX || 50,
y: textY || 50,
fill: "#999",
"class": valueTextClass,
"font-size": "100%",
"font-family": "sans-serif",
"font-weight": "normal",
"text-anchor": "middle",
"alignment-baseline": "middle",
"dominant-baseline": "central"
});
gaugeValuePath = svg("path", {
"class": valueDialClass,
fill: "none",
stroke: "#666",
"stroke-width": 2.5,
d: pathString(radius, startAngle, startAngle) // value of 0
});
var angle = getAngle(100, 360 - Math.abs(startAngle - endAngle));
var flag = angle <= 180 ? 0 : 1;
var gaugeElement = svg("svg", {"viewBox": viewBox || "0 0 100 100", "class": gaugeClass},
[
svg("path", {
"class": dialClass,
fill: "none",
stroke: "#eee",
"stroke-width": 2,
d: pathString(radius, startAngle, endAngle, flag)
}),
gaugeValueElem,
gaugeValuePath
]
);
elem.appendChild(gaugeElement);
}
function updateGauge(theValue, frame) {
var val = getValueInPercentage(theValue, min, limit),
// angle = getAngle(val, 360 - Math.abs(endAngle - startAngle)),
angle = getAngle(val, 360 - Math.abs(startAngle - endAngle)),
// this is because we are using arc greater than 180deg
flag = angle <= 180 ? 0 : 1;
if(displayValue) {
gaugeValueElem.textContent = label.call(opts, theValue);
}
gaugeValuePath.setAttribute("d", pathString(radius, startAngle, angle + startAngle, flag));
}
function setGaugeColor(value, duration) {
var c = gaugeColor.call(opts, value),
dur = duration * 1000,
pathTransition = "stroke " + dur + "ms ease";
// textTransition = "fill " + dur + "ms ease";
gaugeValuePath.style.stroke = c;
gaugeValuePath.style["-webkit-transition"] = pathTransition;
gaugeValuePath.style["-moz-transition"] = pathTransition;
gaugeValuePath.style.transition = pathTransition;
/*
gaugeValueElem.style = [
"fill: " + c,
"-webkit-transition: " + textTransition,
"-moz-transition: " + textTransition,
"transition: " + textTransition,
].join(";");
*/
}
instance = {
setMaxValue: function(max) {
limit = max;
},
setValue: function(val) {
value = normalize(val, min, limit);
if(gaugeColor) {
setGaugeColor(value, 0)
}
updateGauge(value);
},
setValueAnimated: function(val, duration) {
var oldVal = value;
value = normalize(val, min, limit);
if(oldVal === value) {
return;
}
if(gaugeColor) {
setGaugeColor(value, duration);
}
Animation({
start: oldVal || 0,
end: value,
duration: duration || 1,
step: function(val, frame) {
updateGauge(val, frame);
}
});
},
getValue: function() {
return value;
}
};
initializeGauge(gaugeContainer);
instance.setValue(value);
return instance;
};
})();
return Gauge;
});
/**
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/**
* Implementing Drag and Drop functionality in AngularJS is easier than ever.
* Demo: http://codef0rmer.github.com/angular-dragdrop/
*
* @version 1.0.13
*
* (c) 2013 Amit Gharat a.k.a codef0rmer - amitgharat.wordpress.com
*/
!function (e, a, t, n) { "use strict"; var i = a.module("ngDragDrop", []).service("ngDragDropService", ["$timeout", "$parse", "$q", function (r, l, o) { this.draggableScope = null, this.droppableScope = null, t("head").prepend(''), this.callEventCallback = function (e, a, n, i) { function r(a) { var n = -1 !== a.indexOf("(") ? a.indexOf("(") : a.length, i = -1 !== a.lastIndexOf(")") ? a.lastIndexOf(")") : a.length, r = a.substring(n + 1, i), o = -1 !== a.indexOf(".") ? a.substr(0, a.indexOf(".")) : null; return o = e[o] && "function" == typeof e[o].constructor ? o : null, { callback: a.substring(o && o.length + 1 || 0, n), args: t.map(r && r.split(",") || [], function (a) { return [l(a)(e)] }), constructor: o } } if (a) { var o = r(a), d = o.callback, s = o.constructor, p = [n, i].concat(o.args); return (e[d] || e[s][d]).apply(e[d] ? e : e[s], p) } }, this.invokeDrop = function (e, l, d, s) { var p, c, u, g = "", f = "", b = {}, h = {}, v = null, y = {}, x = {}, m = null, D = this.droppableScope, q = this.draggableScope, j = null, k = []; g = e.ngattr("ng-model"), f = l.ngattr("ng-model"), p = q.$eval(g), c = D.$eval(f), m = l.find("[jqyoui-draggable]:last,[data-jqyoui-draggable]:last"), h = D.$eval(l.attr("jqyoui-droppable") || l.attr("data-jqyoui-droppable")) || [], b = q.$eval(e.attr("jqyoui-draggable") || e.attr("data-jqyoui-draggable")) || [], b.index = this.fixIndex(q, b, p), h.index = this.fixIndex(D, h, c), v = a.isArray(p) ? b.index : null, y = a.isArray(p) ? p[v] : p, b.deepCopy && (y = a.copy(y)), x = a.isArray(c) && h && h.index !== n ? c[h.index] : a.isArray(c) ? {} : c, h.deepCopy && (x = a.copy(x)), b.beforeDrop && k.push(this.callEventCallback(q, b.beforeDrop, d, s)), o.all(k).then(a.bind(this, function () { if (b.insertInline && g === f) { if (b.index > h.index) { u = p[b.index]; for (var n = b.index; n > h.index; n--) c[n] = a.copy(c[n - 1]), c[n - 1] = {}, c[n][b.direction] = "left"; c[h.index] = u } else { u = p[b.index]; for (var n = b.index; n < h.index; n++) c[n] = a.copy(c[n + 1]), c[n + 1] = {}, c[n][b.direction] = "right"; c[h.index] = u } this.callEventCallback(D, h.onDrop, d, s) } else b.animate === !0 ? (j = e.clone(), j.css({ position: "absolute" }).css(e.offset()), t("body").append(j), e.addClass("angular-dragdrop-hide"), this.move(j, m.length > 0 ? m : l, null, "fast", h, function () { j.remove() }), this.move(m.length > 0 && !h.multiple ? m : [], e.parent("[jqyoui-droppable],[data-jqyoui-droppable]"), i.startXY, "fast", h, a.bind(this, function () { r(a.bind(this, function () { e.css({ position: "relative", left: "", top: "" }).removeClass("angular-dragdrop-hide"), m.css({ position: "relative", left: "", top: "", display: "none" === m.css("display") ? "" : m.css("display") }), this.mutateDraggable(q, h, b, g, f, x, e), this.mutateDroppable(D, h, b, f, y, v), this.callEventCallback(D, h.onDrop, d, s) })) }))) : r(a.bind(this, function () { this.mutateDraggable(q, h, b, g, f, x, e), this.mutateDroppable(D, h, b, f, y, v), this.callEventCallback(D, h.onDrop, d, s) })) }))["finally"](a.bind(this, function () { this.restore(e) })) }, this.move = function (a, t, i, r, l, o) { if (0 === a.length) return o && e.setTimeout(function () { o() }, 300), !1; var d = a.css("z-index"), s = a[l.containment || "offset"](), p = t.css("display"), c = t.hasClass("ng-hide"), u = t.hasClass("angular-dragdrop-hide"); null === i && t.length > 0 && ((t.attr("jqyoui-draggable") || t.attr("data-jqyoui-draggable")) !== n && t.ngattr("ng-model") !== n && t.is(":visible") && l && l.multiple ? (i = t[l.containment || "offset"](), l.stack === !1 ? i.left += t.outerWidth(!0) : i.top += t.outerHeight(!0)) : (c && t.removeClass("ng-hide"), u && t.removeClass("angular-dragdrop-hide"), i = t.css({ visibility: "hidden", display: "block" })[l.containment || "offset"](), t.css({ visibility: "", display: p }))), a.css({ position: "absolute", "z-index": 9999 }).css(s).animate(i, r, function () { c && t.addClass("ng-hide"), u && t.addClass("angular-dragdrop-hide"), a.css("z-index", d), o && o() }) }, this.mutateDroppable = function (e, t, n, i, r, o) { var d = e.$eval(i); e.dndDragItem = r, a.isArray(d) ? (t && t.index >= 0 ? d[t.index] = r : d.push(r), n && n.placeholder === !0 && (d[d.length - 1].jqyoui_pos = o)) : (l(i + " = dndDragItem")(e), n && n.placeholder === !0 && (d.jqyoui_pos = o)) }, this.mutateDraggable = function (e, t, i, r, o, d, s) { var p = a.equals(d, {}) || !d, c = e.$eval(r); e.dndDropItem = d, i && i.placeholder ? "keep" != i.placeholder && (a.isArray(c) && i.index !== n ? c[i.index] = d : l(r + " = dndDropItem")(e)) : a.isArray(c) ? p ? i && i.placeholder !== !0 && "keep" !== i.placeholder && c.splice(i.index, 1) : c[i.index] = d : (l(r + " = dndDropItem")(e), e.$parent && l(r + " = dndDropItem")(e.$parent)), this.restore(s) }, this.restore = function (e) { e.css({ "z-index": "", left: "", top: "" }) }, this.fixIndex = function (e, t, i) { if (t.applyFilter && a.isArray(i) && i.length > 0) { var r = e[t.applyFilter](), l = r[t.index], o = n; return i.forEach(function (e, t) { a.equals(e, l) && (o = t) }), o } return t.index } }]).directive("jqyouiDraggable", ["ngDragDropService", function (e) { return { require: "?jqyouiDroppable", restrict: "A", link: function (n, r, l) { var o, d, s, p, c = t(r), u = function (r, u) { r ? (o = n.$eval(c.attr("jqyoui-draggable") || c.attr("data-jqyoui-draggable")) || {}, d = n.$eval(l.jqyouiOptions) || {}, c.draggable({ disabled: !1 }).draggable(d).draggable({ start: function (a, r) { e.draggableScope = n, s = t(d.helper ? r.helper : this).css("z-index"), t(d.helper ? r.helper : this).css("z-index", 9999), i.startXY = t(this)[o.containment || "offset"](), e.callEventCallback(n, o.onStart, a, r) }, stop: function (a, i) { t(d.helper ? i.helper : this).css("z-index", s), e.callEventCallback(n, o.onStop, a, i) }, drag: function (a, t) { e.callEventCallback(n, o.onDrag, a, t) } })) : c.draggable({ disabled: !0 }), p && a.isDefined(r) && (a.equals(l.drag, "true") || a.equals(l.drag, "false")) && (p(), p = null) }; p = n.$watch(function () { return n.$eval(l.drag) }, u), u(), c.on("$destroy", function () { c.draggable({ disabled: !0 }).draggable("destroy") }) } } }]).directive("jqyouiDroppable", ["ngDragDropService", "$q", function (e, n) { return { restrict: "A", priority: 1, link: function (i, r, l) { var o, d, s, p = t(r), c = function (r, c) { r ? (o = i.$eval(t(p).attr("jqyoui-droppable") || t(p).attr("data-jqyoui-droppable")) || {}, d = i.$eval(l.jqyouiOptions) || {}, p.droppable({ disabled: !1 }).droppable(d).droppable({ over: function (a, t) { e.callEventCallback(i, o.onOver, a, t) }, out: function (a, t) { e.callEventCallback(i, o.onOut, a, t) }, drop: function (r, s) { var p = null; p = o.beforeDrop ? e.callEventCallback(i, o.beforeDrop, r, s) : function () { var e = n.defer(); return e.resolve(), e.promise }(), p.then(a.bind(this, function () { t(s.draggable).ngattr("ng-model") && l.ngModel ? (e.droppableScope = i, e.invokeDrop(t(s.draggable), t(this), r, s)) : e.callEventCallback(i, o.onDrop, r, s) }), function () { s.draggable.animate({ left: "", top: "" }, d.revertDuration || 0) }) } })) : p.droppable({ disabled: !0 }), s && a.isDefined(r) && (a.equals(l.drop, "true") || a.equals(l.drop, "false")) && (s(), s = null) }; s = i.$watch(function () { return i.$eval(l.drop) }, c), c(), p.on("$destroy", function () { p.droppable({ disabled: !0 }).droppable("destroy") }) } } }]); t.fn.ngattr = function (e, a) { var t = this[0]; return t.getAttribute(e) || t.getAttribute("data-" + e) } }(window, window.angular, window.jQuery);
/**
* angular-drag-and-drop-lists v2.1.0
*
* Copyright (c) 2014 Marcel Juenemann marcel@juenemann.cc
* Copyright (c) 2014-2017 Google Inc.
* https://github.com/marceljuenemann/angular-drag-and-drop-lists
*
* License: MIT
*/
(function (dndLists) {
// In standard-compliant browsers we use a custom mime type and also encode the dnd-type in it.
// However, IE and Edge only support a limited number of mime types. The workarounds are described
// in https://github.com/marceljuenemann/angular-drag-and-drop-lists/wiki/Data-Transfer-Design
var MIME_TYPE = 'application/x-dnd';
var EDGE_MIME_TYPE = 'application/json';
var MSIE_MIME_TYPE = 'Text';
// All valid HTML5 drop effects, in the order in which we prefer to use them.
var ALL_EFFECTS = ['move', 'copy', 'link'];
/**
* Use the dnd-draggable attribute to make your element draggable
*
* Attributes:
* - dnd-draggable Required attribute. The value has to be an object that represents the data
* of the element. In case of a drag and drop operation the object will be
* serialized and unserialized on the receiving end.
* - dnd-effect-allowed Use this attribute to limit the operations that can be performed. Valid
* options are "move", "copy" and "link", as well as "all", "copyMove",
* "copyLink" and "linkMove". The semantics of these operations are up to you
* and have to be implemented using the callbacks described below. If you
* allow multiple options, the user can choose between them by using the
* modifier keys (OS specific). The cursor will be changed accordingly,
* expect for IE and Edge, where this is not supported.
* - dnd-type Use this attribute if you have different kinds of items in your
* application and you want to limit which items can be dropped into which
* lists. Combine with dnd-allowed-types on the dnd-list(s). This attribute
* must be a lower case string. Upper case characters can be used, but will
* be converted to lower case automatically.
* - dnd-disable-if You can use this attribute to dynamically disable the draggability of the
* element. This is useful if you have certain list items that you don't want
* to be draggable, or if you want to disable drag & drop completely without
* having two different code branches (e.g. only allow for admins).
*
* Callbacks:
* - dnd-dragstart Callback that is invoked when the element was dragged. The original
* dragstart event will be provided in the local event variable.
* - dnd-moved Callback that is invoked when the element was moved. Usually you will
* remove your element from the original list in this callback, since the
* directive is not doing that for you automatically. The original dragend
* event will be provided in the local event variable.
* - dnd-copied Same as dnd-moved, just that it is called when the element was copied
* instead of moved, so you probably want to implement a different logic.
* - dnd-linked Same as dnd-moved, just that it is called when the element was linked
* instead of moved, so you probably want to implement a different logic.
* - dnd-canceled Callback that is invoked if the element was dragged, but the operation was
* canceled and the element was not dropped. The original dragend event will
* be provided in the local event variable.
* - dnd-dragend Callback that is invoked when the drag operation ended. Available local
* variables are event and dropEffect.
* - dnd-selected Callback that is invoked when the element was clicked but not dragged.
* The original click event will be provided in the local event variable.
* - dnd-callback Custom callback that is passed to dropzone callbacks and can be used to
* communicate between source and target scopes. The dropzone can pass user
* defined variables to this callback.
*
* CSS classes:
* - dndDragging This class will be added to the element while the element is being
* dragged. It will affect both the element you see while dragging and the
* source element that stays at it's position. Do not try to hide the source
* element with this class, because that will abort the drag operation.
* - dndDraggingSource This class will be added to the element after the drag operation was
* started, meaning it only affects the original element that is still at
* it's source position, and not the "element" that the user is dragging with
* his mouse pointer.
*/
dndLists.directive('dndDraggable', ['$parse', '$timeout', function ($parse, $timeout) {
return function (scope, element, attr) {
// Set the HTML5 draggable attribute on the element.
element.attr("draggable", "true");
// If the dnd-disable-if attribute is set, we have to watch that.
if (attr.dndDisableIf) {
scope.$watch(attr.dndDisableIf, function (disabled) {
element.attr("draggable", !disabled);
});
}
/**
* When the drag operation is started we have to prepare the dataTransfer object,
* which is the primary way we communicate with the target element
*/
element.on('dragstart', function (event) {
event = event.originalEvent || event;
// Check whether the element is draggable, since dragstart might be triggered on a child.
if (element.attr('draggable') == 'false') return true;
// Initialize global state.
dndState.isDragging = true;
dndState.itemType = attr.dndType && scope.$eval(attr.dndType).toLowerCase();
// Set the allowed drop effects. See below for special IE handling.
dndState.dropEffect = "none";
dndState.effectAllowed = attr.dndEffectAllowed || ALL_EFFECTS[0];
event.dataTransfer.effectAllowed = dndState.effectAllowed;
// Internet Explorer and Microsoft Edge don't support custom mime types, see design doc:
// https://github.com/marceljuenemann/angular-drag-and-drop-lists/wiki/Data-Transfer-Design
var item = scope.$eval(attr.dndDraggable);
var mimeType = MIME_TYPE + (dndState.itemType ? ('-' + dndState.itemType) : '');
try {
event.dataTransfer.setData(mimeType, angular.toJson(item));
} catch (e) {
// Setting a custom MIME type did not work, we are probably in IE or Edge.
var data = angular.toJson({ item: item, type: dndState.itemType });
try {
event.dataTransfer.setData(EDGE_MIME_TYPE, data);
} catch (e) {
// We are in Internet Explorer and can only use the Text MIME type. Also note that IE
// does not allow changing the cursor in the dragover event, therefore we have to choose
// the one we want to display now by setting effectAllowed.
var effectsAllowed = filterEffects(ALL_EFFECTS, dndState.effectAllowed);
event.dataTransfer.effectAllowed = effectsAllowed[0];
event.dataTransfer.setData(MSIE_MIME_TYPE, data);
}
}
// Add CSS classes. See documentation above.
element.addClass("dndDragging");
$timeout(function () { element.addClass("dndDraggingSource"); }, 0);
// Try setting a proper drag image if triggered on a dnd-handle (won't work in IE).
if (event._dndHandle && event.dataTransfer.setDragImage) {
event.dataTransfer.setDragImage(element[0], 0, 0);
}
// Invoke dragstart callback and prepare extra callback for dropzone.
$parse(attr.dndDragstart)(scope, { event: event });
if (attr.dndCallback) {
var callback = $parse(attr.dndCallback);
dndState.callback = function (params) { return callback(scope, params || {}); };
}
event.stopPropagation();
});
/**
* The dragend event is triggered when the element was dropped or when the drag
* operation was aborted (e.g. hit escape button). Depending on the executed action
* we will invoke the callbacks specified with the dnd-moved or dnd-copied attribute.
*/
element.on('dragend', function (event) {
event = event.originalEvent || event;
// Invoke callbacks. Usually we would use event.dataTransfer.dropEffect to determine
// the used effect, but Chrome has not implemented that field correctly. On Windows
// it always sets it to 'none', while Chrome on Linux sometimes sets it to something
// else when it's supposed to send 'none' (drag operation aborted).
scope.$apply(function () {
var dropEffect = dndState.dropEffect;
var cb = { copy: 'dndCopied', link: 'dndLinked', move: 'dndMoved', none: 'dndCanceled' };
$parse(attr[cb[dropEffect]])(scope, { event: event });
$parse(attr.dndDragend)(scope, { event: event, dropEffect: dropEffect });
});
// Clean up
dndState.isDragging = false;
dndState.callback = undefined;
element.removeClass("dndDragging");
element.removeClass("dndDraggingSource");
event.stopPropagation();
// In IE9 it is possible that the timeout from dragstart triggers after the dragend handler.
$timeout(function () { element.removeClass("dndDraggingSource"); }, 0);
});
/**
* When the element is clicked we invoke the callback function
* specified with the dnd-selected attribute.
*/
element.on('click', function (event) {
if (!attr.dndSelected) return;
event = event.originalEvent || event;
scope.$apply(function () {
$parse(attr.dndSelected)(scope, { event: event });
});
// Prevent triggering dndSelected in parent elements.
event.stopPropagation();
});
/**
* Workaround to make element draggable in IE9
*/
element.on('selectstart', function () {
if (this.dragDrop) this.dragDrop();
});
};
}]);
/**
* Use the dnd-list attribute to make your list element a dropzone. Usually you will add a single
* li element as child with the ng-repeat directive. If you don't do that, we will not be able to
* position the dropped element correctly. If you want your list to be sortable, also add the
* dnd-draggable directive to your li element(s).
*
* Attributes:
* - dnd-list Required attribute. The value has to be the array in which the data of
* the dropped element should be inserted. The value can be blank if used
* with a custom dnd-drop handler that always returns true.
* - dnd-allowed-types Optional array of allowed item types. When used, only items that had a
* matching dnd-type attribute will be dropable. Upper case characters will
* automatically be converted to lower case.
* - dnd-effect-allowed Optional string expression that limits the drop effects that can be
* performed in the list. See dnd-effect-allowed on dnd-draggable for more
* details on allowed options. The default value is all.
* - dnd-disable-if Optional boolean expresssion. When it evaluates to true, no dropping
* into the list is possible. Note that this also disables rearranging
* items inside the list.
* - dnd-horizontal-list Optional boolean expresssion. When it evaluates to true, the positioning
* algorithm will use the left and right halfs of the list items instead of
* the upper and lower halfs.
* - dnd-external-sources Optional boolean expression. When it evaluates to true, the list accepts
* drops from sources outside of the current browser tab. This allows to
* drag and drop accross different browser tabs. The only major browser
* that does not support this is currently Microsoft Edge.
*
* Callbacks:
* - dnd-dragover Optional expression that is invoked when an element is dragged over the
* list. If the expression is set, but does not return true, the element is
* not allowed to be dropped. The following variables will be available:
* - event: The original dragover event sent by the browser.
* - index: The position in the list at which the element would be dropped.
* - type: The dnd-type set on the dnd-draggable, or undefined if non was
* set. Will be null for drops from external sources in IE and Edge,
* since we don't know the type in those cases.
* - dropEffect: One of move, copy or link, see dnd-effect-allowed.
* - external: Whether the element was dragged from an external source.
* - callback: If dnd-callback was set on the source element, this is a
* function reference to the callback. The callback can be invoked with
* custom variables like this: callback({var1: value1, var2: value2}).
* The callback will be executed on the scope of the source element. If
* dnd-external-sources was set and external is true, this callback will
* not be available.
* - dnd-drop Optional expression that is invoked when an element is dropped on the
* list. The same variables as for dnd-dragover will be available, with the
* exception that type is always known and therefore never null. There
* will also be an item variable, which is the transferred object. The
* return value determines the further handling of the drop:
* - falsy: The drop will be canceled and the element won't be inserted.
* - true: Signalises that the drop is allowed, but the dnd-drop
* callback already took care of inserting the element.
* - otherwise: All other return values will be treated as the object to
* insert into the array. In most cases you want to simply return the
* item parameter, but there are no restrictions on what you can return.
* - dnd-inserted Optional expression that is invoked after a drop if the element was
* actually inserted into the list. The same local variables as for
* dnd-drop will be available. Note that for reorderings inside the same
* list the old element will still be in the list due to the fact that
* dnd-moved was not called yet.
*
* CSS classes:
* - dndPlaceholder When an element is dragged over the list, a new placeholder child
* element will be added. This element is of type li and has the class
* dndPlaceholder set. Alternatively, you can define your own placeholder
* by creating a child element with dndPlaceholder class.
* - dndDragover Will be added to the list while an element is dragged over the list.
*/
dndLists.directive('dndList', ['$parse', function ($parse) {
return function (scope, element, attr) {
// While an element is dragged over the list, this placeholder element is inserted
// at the location where the element would be inserted after dropping.
var placeholder = getPlaceholderElement();
placeholder.remove();
var placeholderNode = placeholder[0];
var listNode = element[0];
var listSettings = {};
/**
* The dragenter event is fired when a dragged element or text selection enters a valid drop
* target. According to the spec, we either need to have a dropzone attribute or listen on
* dragenter events and call preventDefault(). It should be noted though that no browser seems
* to enforce this behaviour.
*/
element.on('dragenter', function (event) {
event = event.originalEvent || event;
// Calculate list properties, so that we don't have to repeat this on every dragover event.
var types = attr.dndAllowedTypes && scope.$eval(attr.dndAllowedTypes);
listSettings = {
allowedTypes: angular.isArray(types) && types.join('|').toLowerCase().split('|'),
disabled: attr.dndDisableIf && scope.$eval(attr.dndDisableIf),
externalSources: attr.dndExternalSources && scope.$eval(attr.dndExternalSources),
horizontal: attr.dndHorizontalList && scope.$eval(attr.dndHorizontalList)
};
var mimeType = getMimeType(event.dataTransfer.types);
if (!mimeType || !isDropAllowed(getItemType(mimeType))) return true;
event.preventDefault();
});
/**
* The dragover event is triggered "every few hundred milliseconds" while an element
* is being dragged over our list, or over an child element.
*/
element.on('dragover', function (event) {
event = event.originalEvent || event;
// Check whether the drop is allowed and determine mime type.
var mimeType = getMimeType(event.dataTransfer.types);
var itemType = getItemType(mimeType);
if (!mimeType || !isDropAllowed(itemType)) return true;
// Make sure the placeholder is shown, which is especially important if the list is empty.
if (placeholderNode.parentNode != listNode) {
element.append(placeholder);
}
if (event.target != listNode) {
// Try to find the node direct directly below the list node.
var listItemNode = event.target;
while (listItemNode.parentNode != listNode && listItemNode.parentNode) {
listItemNode = listItemNode.parentNode;
}
if (listItemNode.parentNode == listNode && listItemNode != placeholderNode) {
// If the mouse pointer is in the upper half of the list item element,
// we position the placeholder before the list item, otherwise after it.
var rect = listItemNode.getBoundingClientRect();
if (listSettings.horizontal) {
var isFirstHalf = event.clientX < rect.left + rect.width / 2;
} else {
var isFirstHalf = event.clientY < rect.top + rect.height / 2;
}
if (isFirstHalf) {
if (listItemNode.previousSibling != placeholderNode) listNode.insertBefore(placeholderNode, listItemNode);
} else {
if (listItemNode.nextSibling != placeholderNode) listNode.insertBefore(placeholderNode, listItemNode.nextSibling);
}
}
}
// In IE we set a fake effectAllowed in dragstart to get the correct cursor, we therefore
// ignore the effectAllowed passed in dataTransfer. We must also not access dataTransfer for
// drops from external sources, as that throws an exception.
var ignoreDataTransfer = mimeType == MSIE_MIME_TYPE;
var dropEffect = getDropEffect(event, ignoreDataTransfer);
if (dropEffect == 'none') return stopDragover();
// At this point we invoke the callback, which still can disallow the drop.
// We can't do this earlier because we want to pass the index of the placeholder.
if (attr.dndDragover && !invokeCallback(attr.dndDragover, event, dropEffect, itemType)) {
return stopDragover();
}
// Set dropEffect to modify the cursor shown by the browser, unless we're in IE, where this
// is not supported. This must be done after preventDefault in Firefox.
event.preventDefault();
if (!ignoreDataTransfer) {
event.dataTransfer.dropEffect = dropEffect;
}
element.addClass("dndDragover");
event.stopPropagation();
return false;
});
/**
* When the element is dropped, we use the position of the placeholder element as the
* position where we insert the transferred data. This assumes that the list has exactly
* one child element per array element.
*/
element.on('drop', function (event) {
event = event.originalEvent || event;
// Check whether the drop is allowed and determine mime type.
var mimeType = getMimeType(event.dataTransfer.types);
var itemType = getItemType(mimeType);
if (!mimeType || !isDropAllowed(itemType)) return true;
// The default behavior in Firefox is to interpret the dropped element as URL and
// forward to it. We want to prevent that even if our drop is aborted.
event.preventDefault();
// Unserialize the data that was serialized in dragstart.
try {
var data = JSON.parse(event.dataTransfer.getData(mimeType));
} catch (e) {
return stopDragover();
}
// Drops with invalid types from external sources might not have been filtered out yet.
if (mimeType == MSIE_MIME_TYPE || mimeType == EDGE_MIME_TYPE) {
itemType = data.type || undefined;
data = data.item;
if (!isDropAllowed(itemType)) return stopDragover();
}
// Special handling for internal IE drops, see dragover handler.
var ignoreDataTransfer = mimeType == MSIE_MIME_TYPE;
var dropEffect = getDropEffect(event, ignoreDataTransfer);
if (dropEffect == 'none') return stopDragover();
// Invoke the callback, which can transform the transferredObject and even abort the drop.
var index = getPlaceholderIndex();
if (attr.dndDrop) {
data = invokeCallback(attr.dndDrop, event, dropEffect, itemType, index, data);
if (!data) return stopDragover();
}
// The drop is definitely going to happen now, store the dropEffect.
dndState.dropEffect = dropEffect;
if (!ignoreDataTransfer) {
event.dataTransfer.dropEffect = dropEffect;
}
// Insert the object into the array, unless dnd-drop took care of that (returned true).
if (data !== true) {
scope.$apply(function () {
scope.$eval(attr.dndList).splice(index, 0, data);
});
}
invokeCallback(attr.dndInserted, event, dropEffect, itemType, index, data);
// Clean up
stopDragover();
event.stopPropagation();
return false;
});
/**
* We have to remove the placeholder when the element is no longer dragged over our list. The
* problem is that the dragleave event is not only fired when the element leaves our list,
* but also when it leaves a child element. Therefore, we determine whether the mouse cursor
* is still pointing to an element inside the list or not.
*/
element.on('dragleave', function (event) {
event = event.originalEvent || event;
var newTarget = document.elementFromPoint(event.clientX, event.clientY);
if (listNode.contains(newTarget) && !event._dndPhShown) {
// Signalize to potential parent lists that a placeholder is already shown.
event._dndPhShown = true;
} else {
stopDragover();
}
});
/**
* Given the types array from the DataTransfer object, returns the first valid mime type.
* A type is valid if it starts with MIME_TYPE, or it equals MSIE_MIME_TYPE or EDGE_MIME_TYPE.
*/
function getMimeType(types) {
if (!types) return MSIE_MIME_TYPE; // IE 9 workaround.
for (var i = 0; i < types.length; i++) {
if (types[i] == MSIE_MIME_TYPE || types[i] == EDGE_MIME_TYPE ||
types[i].substr(0, MIME_TYPE.length) == MIME_TYPE) {
return types[i];
}
}
return null;
}
/**
* Determines the type of the item from the dndState, or from the mime type for items from
* external sources. Returns undefined if no item type was set and null if the item type could
* not be determined.
*/
function getItemType(mimeType) {
if (dndState.isDragging) return dndState.itemType || undefined;
if (mimeType == MSIE_MIME_TYPE || mimeType == EDGE_MIME_TYPE) return null;
return (mimeType && mimeType.substr(MIME_TYPE.length + 1)) || undefined;
}
/**
* Checks various conditions that must be fulfilled for a drop to be allowed, including the
* dnd-allowed-types attribute. If the item Type is unknown (null), the drop will be allowed.
*/
function isDropAllowed(itemType) {
if (listSettings.disabled) return false;
if (!listSettings.externalSources && !dndState.isDragging) return false;
if (!listSettings.allowedTypes || itemType === null) return true;
return itemType && listSettings.allowedTypes.indexOf(itemType) != -1;
}
/**
* Determines which drop effect to use for the given event. In Internet Explorer we have to
* ignore the effectAllowed field on dataTransfer, since we set a fake value in dragstart.
* In those cases we rely on dndState to filter effects. Read the design doc for more details:
* https://github.com/marceljuenemann/angular-drag-and-drop-lists/wiki/Data-Transfer-Design
*/
function getDropEffect(event, ignoreDataTransfer) {
var effects = ALL_EFFECTS;
if (!ignoreDataTransfer) {
effects = filterEffects(effects, event.dataTransfer.effectAllowed);
}
if (dndState.isDragging) {
effects = filterEffects(effects, dndState.effectAllowed);
}
if (attr.dndEffectAllowed) {
effects = filterEffects(effects, attr.dndEffectAllowed);
}
// MacOS automatically filters dataTransfer.effectAllowed depending on the modifier keys,
// therefore the following modifier keys will only affect other operating systems.
if (!effects.length) {
return 'none';
} else if (event.ctrlKey && effects.indexOf('copy') != -1) {
return 'copy';
} else if (event.altKey && effects.indexOf('link') != -1) {
return 'link';
} else {
return effects[0];
}
}
/**
* Small helper function that cleans up if we aborted a drop.
*/
function stopDragover() {
placeholder.remove();
element.removeClass("dndDragover");
return true;
}
/**
* Invokes a callback with some interesting parameters and returns the callbacks return value.
*/
function invokeCallback(expression, event, dropEffect, itemType, index, item) {
return $parse(expression)(scope, {
callback: dndState.callback,
dropEffect: dropEffect,
event: event,
external: !dndState.isDragging,
index: index !== undefined ? index : getPlaceholderIndex(),
item: item || undefined,
type: itemType
});
}
/**
* We use the position of the placeholder node to determine at which position of the array the
* object needs to be inserted
*/
function getPlaceholderIndex() {
return Array.prototype.indexOf.call(listNode.children, placeholderNode);
}
/**
* Tries to find a child element that has the dndPlaceholder class set. If none was found, a
* new li element is created.
*/
function getPlaceholderElement() {
var placeholder;
angular.forEach(element.children(), function (childNode) {
var child = angular.element(childNode);
if (child.hasClass('dndPlaceholder')) {
placeholder = child;
}
});
return placeholder || angular.element(" ");
}
};
}]);
/**
* Use the dnd-nodrag attribute inside of dnd-draggable elements to prevent them from starting
* drag operations. This is especially useful if you want to use input elements inside of
* dnd-draggable elements or create specific handle elements. Note: This directive does not work
* in Internet Explorer 9.
*/
dndLists.directive('dndNodrag', function () {
return function (scope, element, attr) {
// Set as draggable so that we can cancel the events explicitly
element.attr("draggable", "true");
/**
* Since the element is draggable, the browser's default operation is to drag it on dragstart.
* We will prevent that and also stop the event from bubbling up.
*/
element.on('dragstart', function (event) {
event = event.originalEvent || event;
if (!event._dndHandle) {
// If a child element already reacted to dragstart and set a dataTransfer object, we will
// allow that. For example, this is the case for user selections inside of input elements.
if (!(event.dataTransfer.types && event.dataTransfer.types.length)) {
event.preventDefault();
}
event.stopPropagation();
}
});
/**
* Stop propagation of dragend events, otherwise dnd-moved might be triggered and the element
* would be removed.
*/
element.on('dragend', function (event) {
event = event.originalEvent || event;
if (!event._dndHandle) {
event.stopPropagation();
}
});
};
});
/**
* Use the dnd-handle directive within a dnd-nodrag element in order to allow dragging with that
* element after all. Therefore, by combining dnd-nodrag and dnd-handle you can allow
* dnd-draggable elements to only be dragged via specific "handle" elements. Note that Internet
* Explorer will show the handle element as drag image instead of the dnd-draggable element. You
* can work around this by styling the handle element differently when it is being dragged. Use
* the CSS selector .dndDragging:not(.dndDraggingSource) [dnd-handle] for that.
*/
dndLists.directive('dndHandle', function () {
return function (scope, element, attr) {
element.attr("draggable", "true");
element.on('dragstart dragend', function (event) {
event = event.originalEvent || event;
event._dndHandle = true;
});
};
});
/**
* Filters an array of drop effects using a HTML5 effectAllowed string.
*/
function filterEffects(effects, effectAllowed) {
if (effectAllowed == 'all') return effects;
return effects.filter(function (effect) {
return effectAllowed.toLowerCase().indexOf(effect) != -1;
});
}
/**
* For some features we need to maintain global state. This is done here, with these fields:
* - callback: A callback function set at dragstart that is passed to internal dropzone handlers.
* - dropEffect: Set in dragstart to "none" and to the actual value in the drop handler. We don't
* rely on the dropEffect passed by the browser, since there are various bugs in Chrome and
* Safari, and Internet Explorer defaults to copy if effectAllowed is copyMove.
* - effectAllowed: Set in dragstart based on dnd-effect-allowed. This is needed for IE because
* setting effectAllowed on dataTransfer might result in an undesired cursor.
* - isDragging: True between dragstart and dragend. Falsy for drops from external sources.
* - itemType: The item type of the dragged element set via dnd-type. This is needed because IE
* and Edge don't support custom mime types that we can use to transfer this information.
*/
var dndState = {};
})(angular.module('dndLists', []));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory());
})(this, (function () { 'use strict';
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
// https://github.com/bgrins/TinyColor
// Brian Grinstead, MIT License
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color, opts) {
color = color ? color : "";
opts = opts || {};
// If input is already a tinycolor, return itself
if (color instanceof tinycolor) {
return color;
}
// If we are called as a function, call using new instead
if (!(this instanceof tinycolor)) {
return new tinycolor(color, opts);
}
var rgb = inputToRGB(color);
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
this._gradientType = opts.gradientType;
// Don't let the range of [0,255] come back in [0,1].
// Potentially lose a little bit of precision here, but will fix issues where
// .5 gets interpreted as half of the total, instead of half of 1
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
if (this._r < 1) this._r = Math.round(this._r);
if (this._g < 1) this._g = Math.round(this._g);
if (this._b < 1) this._b = Math.round(this._b);
this._ok = rgb.ok;
}
tinycolor.prototype = {
isDark: function isDark() {
return this.getBrightness() < 128;
},
isLight: function isLight() {
return !this.isDark();
},
isValid: function isValid() {
return this._ok;
},
getOriginalInput: function getOriginalInput() {
return this._originalInput;
},
getFormat: function getFormat() {
return this._format;
},
getAlpha: function getAlpha() {
return this._a;
},
getBrightness: function getBrightness() {
//http://www.w3.org/TR/AERT#color-contrast
var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
},
getLuminance: function getLuminance() {
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
var rgb = this.toRgb();
var RsRGB, GsRGB, BsRGB, R, G, B;
RsRGB = rgb.r / 255;
GsRGB = rgb.g / 255;
BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
},
setAlpha: function setAlpha(value) {
this._a = boundAlpha(value);
this._roundA = Math.round(100 * this._a) / 100;
return this;
},
toHsv: function toHsv() {
var hsv = rgbToHsv(this._r, this._g, this._b);
return {
h: hsv.h * 360,
s: hsv.s,
v: hsv.v,
a: this._a
};
},
toHsvString: function toHsvString() {
var hsv = rgbToHsv(this._r, this._g, this._b);
var h = Math.round(hsv.h * 360),
s = Math.round(hsv.s * 100),
v = Math.round(hsv.v * 100);
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
},
toHsl: function toHsl() {
var hsl = rgbToHsl(this._r, this._g, this._b);
return {
h: hsl.h * 360,
s: hsl.s,
l: hsl.l,
a: this._a
};
},
toHslString: function toHslString() {
var hsl = rgbToHsl(this._r, this._g, this._b);
var h = Math.round(hsl.h * 360),
s = Math.round(hsl.s * 100),
l = Math.round(hsl.l * 100);
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
},
toHex: function toHex(allow3Char) {
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function toHexString(allow3Char) {
return "#" + this.toHex(allow3Char);
},
toHex8: function toHex8(allow4Char) {
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function toHex8String(allow4Char) {
return "#" + this.toHex8(allow4Char);
},
toRgb: function toRgb() {
return {
r: Math.round(this._r),
g: Math.round(this._g),
b: Math.round(this._b),
a: this._a
};
},
toRgbString: function toRgbString() {
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function toPercentageRgb() {
return {
r: Math.round(bound01(this._r, 255) * 100) + "%",
g: Math.round(bound01(this._g, 255) * 100) + "%",
b: Math.round(bound01(this._b, 255) * 100) + "%",
a: this._a
};
},
toPercentageRgbString: function toPercentageRgbString() {
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function toName() {
if (this._a === 0) {
return "transparent";
}
if (this._a < 1) {
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
},
toFilter: function toFilter(secondColor) {
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String = hex8String;
var gradientType = this._gradientType ? "GradientType = 1, " : "";
if (secondColor) {
var s = tinycolor(secondColor);
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
}
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
},
toString: function toString(format) {
var formatSet = !!format;
format = format || this._format;
var formattedString = false;
var hasAlpha = this._a < 1 && this._a >= 0;
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
if (needsAlphaFormat) {
// Special case for "transparent", all other non-alpha formats
// will return rgba when there is transparency.
if (format === "name" && this._a === 0) {
return this.toName();
}
return this.toRgbString();
}
if (format === "rgb") {
formattedString = this.toRgbString();
}
if (format === "prgb") {
formattedString = this.toPercentageRgbString();
}
if (format === "hex" || format === "hex6") {
formattedString = this.toHexString();
}
if (format === "hex3") {
formattedString = this.toHexString(true);
}
if (format === "hex4") {
formattedString = this.toHex8String(true);
}
if (format === "hex8") {
formattedString = this.toHex8String();
}
if (format === "name") {
formattedString = this.toName();
}
if (format === "hsl") {
formattedString = this.toHslString();
}
if (format === "hsv") {
formattedString = this.toHsvString();
}
return formattedString || this.toHexString();
},
clone: function clone() {
return tinycolor(this.toString());
},
_applyModification: function _applyModification(fn, args) {
var color = fn.apply(null, [this].concat([].slice.call(args)));
this._r = color._r;
this._g = color._g;
this._b = color._b;
this.setAlpha(color._a);
return this;
},
lighten: function lighten() {
return this._applyModification(_lighten, arguments);
},
brighten: function brighten() {
return this._applyModification(_brighten, arguments);
},
darken: function darken() {
return this._applyModification(_darken, arguments);
},
desaturate: function desaturate() {
return this._applyModification(_desaturate, arguments);
},
saturate: function saturate() {
return this._applyModification(_saturate, arguments);
},
greyscale: function greyscale() {
return this._applyModification(_greyscale, arguments);
},
spin: function spin() {
return this._applyModification(_spin, arguments);
},
_applyCombination: function _applyCombination(fn, args) {
return fn.apply(null, [this].concat([].slice.call(args)));
},
analogous: function analogous() {
return this._applyCombination(_analogous, arguments);
},
complement: function complement() {
return this._applyCombination(_complement, arguments);
},
monochromatic: function monochromatic() {
return this._applyCombination(_monochromatic, arguments);
},
splitcomplement: function splitcomplement() {
return this._applyCombination(_splitcomplement, arguments);
},
// Disabled until https://github.com/bgrins/TinyColor/issues/254
// polyad: function (number) {
// return this._applyCombination(polyad, [number]);
// },
triad: function triad() {
return this._applyCombination(polyad, [3]);
},
tetrad: function tetrad() {
return this._applyCombination(polyad, [4]);
}
};
// If input is an object, force 1 into "1.0" to handle ratios properly
// String input requires "1.0" as input, so 1 will be treated as 1
tinycolor.fromRatio = function (color, opts) {
if (_typeof(color) == "object") {
var newColor = {};
for (var i in color) {
if (color.hasOwnProperty(i)) {
if (i === "a") {
newColor[i] = color[i];
} else {
newColor[i] = convertToPercentage(color[i]);
}
}
}
color = newColor;
}
return tinycolor(color, opts);
};
// Given a string or object, convert that input to RGB
// Possible string inputs:
//
// "red"
// "#f00" or "f00"
// "#ff0000" or "ff0000"
// "#ff000000" or "ff000000"
// "rgb 255 0 0" or "rgb (255, 0, 0)"
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
//
function inputToRGB(color) {
var rgb = {
r: 0,
g: 0,
b: 0
};
var a = 1;
var s = null;
var v = null;
var l = null;
var ok = false;
var format = false;
if (typeof color == "string") {
color = stringInputToObject(color);
}
if (_typeof(color) == "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s = convertToPercentage(color.s);
v = convertToPercentage(color.v);
rgb = hsvToRgb(color.h, s, v);
ok = true;
format = "hsv";
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s = convertToPercentage(color.s);
l = convertToPercentage(color.l);
rgb = hslToRgb(color.h, s, l);
ok = true;
format = "hsl";
}
if (color.hasOwnProperty("a")) {
a = color.a;
}
}
a = boundAlpha(a);
return {
ok: ok,
format: color.format || format,
r: Math.min(255, Math.max(rgb.r, 0)),
g: Math.min(255, Math.max(rgb.g, 0)),
b: Math.min(255, Math.max(rgb.b, 0)),
a: a
};
}
// Conversion Functions
// --------------------
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
//
// `rgbToRgb`
// Handle bounds / percentage checking to conform to CSS color spec
//
// *Assumes:* r, g, b in [0, 255] or [0, 1]
// *Returns:* { r, g, b } in [0, 255]
function rgbToRgb(r, g, b) {
return {
r: bound01(r, 255) * 255,
g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255
};
}
// `rgbToHsl`
// Converts an RGB color value to HSL.
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
// *Returns:* { h, s, l } in [0,1]
function rgbToHsl(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = Math.max(r, g, b),
min = Math.min(r, g, b);
var h,
s,
l = (max + min) / 2;
if (max == min) {
h = s = 0; // achromatic
} else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
return {
h: h,
s: s,
l: l
};
}
// `hslToRgb`
// Converts an HSL color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
function hslToRgb(h, s, l) {
var r, g, b;
h = bound01(h, 360);
s = bound01(s, 100);
l = bound01(l, 100);
function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
}
if (s === 0) {
r = g = b = l; // achromatic
} else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
}
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}
// `rgbToHsv`
// Converts an RGB color value to HSV
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
// *Returns:* { h, s, v } in [0,1]
function rgbToHsv(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = Math.max(r, g, b),
min = Math.min(r, g, b);
var h,
s,
v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if (max == min) {
h = 0; // achromatic
} else {
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
return {
h: h,
s: s,
v: v
};
}
// `hsvToRgb`
// Converts an HSV color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
function hsvToRgb(h, s, v) {
h = bound01(h, 360) * 6;
s = bound01(s, 100);
v = bound01(v, 100);
var i = Math.floor(h),
f = h - i,
p = v * (1 - s),
q = v * (1 - f * s),
t = v * (1 - (1 - f) * s),
mod = i % 6,
r = [v, q, p, p, t, v][mod],
g = [t, v, v, q, p, p][mod],
b = [p, p, t, v, v, q][mod];
return {
r: r * 255,
g: g * 255,
b: b * 255
};
}
// `rgbToHex`
// Converts an RGB color to hex
// Assumes r, g, and b are contained in the set [0, 255]
// Returns a 3 or 6 character hex
function rgbToHex(r, g, b, allow3Char) {
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
// Return a 3 character hex if possible
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");
}
// `rgbaToHex`
// Converts an RGBA color plus alpha transparency to hex
// Assumes r, g, b are contained in the set [0, 255] and
// a in [0, 1]. Returns a 4 or 8 character rgba hex
function rgbaToHex(r, g, b, a, allow4Char) {
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
// Return a 4 character hex if possible
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");
}
// `rgbaToArgbHex`
// Converts an RGBA color to an ARGB Hex8 string
// Rarely used, but required for "toFilter()"
function rgbaToArgbHex(r, g, b, a) {
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
return hex.join("");
}
// `equals`
// Can be called with any tinycolor input
tinycolor.equals = function (color1, color2) {
if (!color1 || !color2) return false;
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
};
tinycolor.random = function () {
return tinycolor.fromRatio({
r: Math.random(),
g: Math.random(),
b: Math.random()
});
};
// Modification Functions
// ----------------------
// Thanks to less.js for some of the basics here
//
function _desaturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl = tinycolor(color).toHsl();
hsl.s -= amount / 100;
hsl.s = clamp01(hsl.s);
return tinycolor(hsl);
}
function _saturate(color, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl = tinycolor(color).toHsl();
hsl.s += amount / 100;
hsl.s = clamp01(hsl.s);
return tinycolor(hsl);
}
function _greyscale(color) {
return tinycolor(color).desaturate(100);
}
function _lighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl = tinycolor(color).toHsl();
hsl.l += amount / 100;
hsl.l = clamp01(hsl.l);
return tinycolor(hsl);
}
function _brighten(color, amount) {
amount = amount === 0 ? 0 : amount || 10;
var rgb = tinycolor(color).toRgb();
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
return tinycolor(rgb);
}
function _darken(color, amount) {
amount = amount === 0 ? 0 : amount || 10;
var hsl = tinycolor(color).toHsl();
hsl.l -= amount / 100;
hsl.l = clamp01(hsl.l);
return tinycolor(hsl);
}
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
// Values outside of this range will be wrapped into this range.
function _spin(color, amount) {
var hsl = tinycolor(color).toHsl();
var hue = (hsl.h + amount) % 360;
hsl.h = hue < 0 ? 360 + hue : hue;
return tinycolor(hsl);
}
// Combination Functions
// ---------------------
// Thanks to jQuery xColor for some of the ideas behind these
//
function _complement(color) {
var hsl = tinycolor(color).toHsl();
hsl.h = (hsl.h + 180) % 360;
return tinycolor(hsl);
}
function polyad(color, number) {
if (isNaN(number) || number <= 0) {
throw new Error("Argument to polyad must be a positive number");
}
var hsl = tinycolor(color).toHsl();
var result = [tinycolor(color)];
var step = 360 / number;
for (var i = 1; i < number; i++) {
result.push(tinycolor({
h: (hsl.h + i * step) % 360,
s: hsl.s,
l: hsl.l
}));
}
return result;
}
function _splitcomplement(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [tinycolor(color), tinycolor({
h: (h + 72) % 360,
s: hsl.s,
l: hsl.l
}), tinycolor({
h: (h + 216) % 360,
s: hsl.s,
l: hsl.l
})];
}
function _analogous(color, results, slices) {
results = results || 6;
slices = slices || 30;
var hsl = tinycolor(color).toHsl();
var part = 360 / slices;
var ret = [tinycolor(color)];
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
hsl.h = (hsl.h + part) % 360;
ret.push(tinycolor(hsl));
}
return ret;
}
function _monochromatic(color, results) {
results = results || 6;
var hsv = tinycolor(color).toHsv();
var h = hsv.h,
s = hsv.s,
v = hsv.v;
var ret = [];
var modification = 1 / results;
while (results--) {
ret.push(tinycolor({
h: h,
s: s,
v: v
}));
v = (v + modification) % 1;
}
return ret;
}
// Utility Functions
// ---------------------
tinycolor.mix = function (color1, color2, amount) {
amount = amount === 0 ? 0 : amount || 50;
var rgb1 = tinycolor(color1).toRgb();
var rgb2 = tinycolor(color2).toRgb();
var p = amount / 100;
var rgba = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return tinycolor(rgba);
};
// Readability Functions
// ---------------------
// false
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
tinycolor.isReadable = function (color1, color2, wcag2) {
var readability = tinycolor.readability(color1, color2);
var wcag2Parms, out;
out = false;
wcag2Parms = validateWCAG2Parms(wcag2);
switch (wcag2Parms.level + wcag2Parms.size) {
case "AAsmall":
case "AAAlarge":
out = readability >= 4.5;
break;
case "AAlarge":
out = readability >= 3;
break;
case "AAAsmall":
out = readability >= 7;
break;
}
return out;
};
// `mostReadable`
// Given a base color and a list of possible foreground or background
// colors for that base, returns the most readable color.
// Optionally returns Black or White if the most readable color is unreadable.
// *Example*
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
tinycolor.mostReadable = function (baseColor, colorList, args) {
var bestColor = null;
var bestScore = 0;
var readability;
var includeFallbackColors, level, size;
args = args || {};
includeFallbackColors = args.includeFallbackColors;
level = args.level;
size = args.size;
for (var i = 0; i < colorList.length; i++) {
readability = tinycolor.readability(baseColor, colorList[i]);
if (readability > bestScore) {
bestScore = readability;
bestColor = tinycolor(colorList[i]);
}
}
if (tinycolor.isReadable(baseColor, bestColor, {
level: level,
size: size
}) || !includeFallbackColors) {
return bestColor;
} else {
args.includeFallbackColors = false;
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
}
};
// Big List of Colors
// ------------------
//
var names = tinycolor.names = {
aliceblue: "f0f8ff",
antiquewhite: "faebd7",
aqua: "0ff",
aquamarine: "7fffd4",
azure: "f0ffff",
beige: "f5f5dc",
bisque: "ffe4c4",
black: "000",
blanchedalmond: "ffebcd",
blue: "00f",
blueviolet: "8a2be2",
brown: "a52a2a",
burlywood: "deb887",
burntsienna: "ea7e5d",
cadetblue: "5f9ea0",
chartreuse: "7fff00",
chocolate: "d2691e",
coral: "ff7f50",
cornflowerblue: "6495ed",
cornsilk: "fff8dc",
crimson: "dc143c",
cyan: "0ff",
darkblue: "00008b",
darkcyan: "008b8b",
darkgoldenrod: "b8860b",
darkgray: "a9a9a9",
darkgreen: "006400",
darkgrey: "a9a9a9",
darkkhaki: "bdb76b",
darkmagenta: "8b008b",
darkolivegreen: "556b2f",
darkorange: "ff8c00",
darkorchid: "9932cc",
darkred: "8b0000",
darksalmon: "e9967a",
darkseagreen: "8fbc8f",
darkslateblue: "483d8b",
darkslategray: "2f4f4f",
darkslategrey: "2f4f4f",
darkturquoise: "00ced1",
darkviolet: "9400d3",
deeppink: "ff1493",
deepskyblue: "00bfff",
dimgray: "696969",
dimgrey: "696969",
dodgerblue: "1e90ff",
firebrick: "b22222",
floralwhite: "fffaf0",
forestgreen: "228b22",
fuchsia: "f0f",
gainsboro: "dcdcdc",
ghostwhite: "f8f8ff",
gold: "ffd700",
goldenrod: "daa520",
gray: "808080",
green: "008000",
greenyellow: "adff2f",
grey: "808080",
honeydew: "f0fff0",
hotpink: "ff69b4",
indianred: "cd5c5c",
indigo: "4b0082",
ivory: "fffff0",
khaki: "f0e68c",
lavender: "e6e6fa",
lavenderblush: "fff0f5",
lawngreen: "7cfc00",
lemonchiffon: "fffacd",
lightblue: "add8e6",
lightcoral: "f08080",
lightcyan: "e0ffff",
lightgoldenrodyellow: "fafad2",
lightgray: "d3d3d3",
lightgreen: "90ee90",
lightgrey: "d3d3d3",
lightpink: "ffb6c1",
lightsalmon: "ffa07a",
lightseagreen: "20b2aa",
lightskyblue: "87cefa",
lightslategray: "789",
lightslategrey: "789",
lightsteelblue: "b0c4de",
lightyellow: "ffffe0",
lime: "0f0",
limegreen: "32cd32",
linen: "faf0e6",
magenta: "f0f",
maroon: "800000",
mediumaquamarine: "66cdaa",
mediumblue: "0000cd",
mediumorchid: "ba55d3",
mediumpurple: "9370db",
mediumseagreen: "3cb371",
mediumslateblue: "7b68ee",
mediumspringgreen: "00fa9a",
mediumturquoise: "48d1cc",
mediumvioletred: "c71585",
midnightblue: "191970",
mintcream: "f5fffa",
mistyrose: "ffe4e1",
moccasin: "ffe4b5",
navajowhite: "ffdead",
navy: "000080",
oldlace: "fdf5e6",
olive: "808000",
olivedrab: "6b8e23",
orange: "ffa500",
orangered: "ff4500",
orchid: "da70d6",
palegoldenrod: "eee8aa",
palegreen: "98fb98",
paleturquoise: "afeeee",
palevioletred: "db7093",
papayawhip: "ffefd5",
peachpuff: "ffdab9",
peru: "cd853f",
pink: "ffc0cb",
plum: "dda0dd",
powderblue: "b0e0e6",
purple: "800080",
rebeccapurple: "663399",
red: "f00",
rosybrown: "bc8f8f",
royalblue: "4169e1",
saddlebrown: "8b4513",
salmon: "fa8072",
sandybrown: "f4a460",
seagreen: "2e8b57",
seashell: "fff5ee",
sienna: "a0522d",
silver: "c0c0c0",
skyblue: "87ceeb",
slateblue: "6a5acd",
slategray: "708090",
slategrey: "708090",
snow: "fffafa",
springgreen: "00ff7f",
steelblue: "4682b4",
tan: "d2b48c",
teal: "008080",
thistle: "d8bfd8",
tomato: "ff6347",
turquoise: "40e0d0",
violet: "ee82ee",
wheat: "f5deb3",
white: "fff",
whitesmoke: "f5f5f5",
yellow: "ff0",
yellowgreen: "9acd32"
};
// Make it easy to access colors via `hexNames[hex]`
var hexNames = tinycolor.hexNames = flip(names);
// Utilities
// ---------
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
function flip(o) {
var flipped = {};
for (var i in o) {
if (o.hasOwnProperty(i)) {
flipped[o[i]] = i;
}
}
return flipped;
}
// Return a valid alpha value [0,1] with all invalid values being set to 1
function boundAlpha(a) {
a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;
}
// Take input from [0, n] and return it as [0, 1]
function bound01(n, max) {
if (isOnePointZero(n)) n = "100%";
var processPercent = isPercentage(n);
n = Math.min(max, Math.max(0, parseFloat(n)));
// Automatically convert percentage into number
if (processPercent) {
n = parseInt(n * max, 10) / 100;
}
// Handle floating point rounding errors
if (Math.abs(n - max) < 0.000001) {
return 1;
}
// Convert into [0, 1] range if it isn't already
return n % max / parseFloat(max);
}
// Force a number between 0 and 1
function clamp01(val) {
return Math.min(1, Math.max(0, val));
}
// Parse a base-16 hex value into a base-10 integer
function parseIntFromHex(val) {
return parseInt(val, 16);
}
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
//
function isOnePointZero(n) {
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
}
// Check to see if string passed in is a percentage
function isPercentage(n) {
return typeof n === "string" && n.indexOf("%") != -1;
}
// Force a hex value to have 2 characters
function pad2(c) {
return c.length == 1 ? "0" + c : "" + c;
}
// Replace a decimal with it's percentage value
function convertToPercentage(n) {
if (n <= 1) {
n = n * 100 + "%";
}
return n;
}
// Converts a decimal to a hex value
function convertDecimalToHex(d) {
return Math.round(parseFloat(d) * 255).toString(16);
}
// Converts a hex value to a decimal
function convertHexToDecimal(h) {
return parseIntFromHex(h) / 255;
}
var matchers = function () {
//
var CSS_INTEGER = "[-\\+]?\\d+%?";
//
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
// Actual matching.
// Parentheses and commas are optional, but not required.
// Whitespace can take the place of commas or opening paren
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
return {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
}();
// `isValidCSSUnit`
// Take in a single string / number and check to see if it looks like a CSS unit
// (see `matchers` above for definition).
function isValidCSSUnit(color) {
return !!matchers.CSS_UNIT.exec(color);
}
// `stringInputToObject`
// Permissive string parsing. Take in a number of formats, and output an object
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
function stringInputToObject(color) {
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
var named = false;
if (names[color]) {
color = names[color];
named = true;
} else if (color == "transparent") {
return {
r: 0,
g: 0,
b: 0,
a: 0,
format: "name"
};
}
// Try to match string input using regular expressions.
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
// Just return an object and let the conversion functions handle that.
// This way the result will be the same whether the tinycolor is initialized with string or object.
var match;
if (match = matchers.rgb.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3]
};
}
if (match = matchers.rgba.exec(color)) {
return {
r: match[1],
g: match[2],
b: match[3],
a: match[4]
};
}
if (match = matchers.hsl.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3]
};
}
if (match = matchers.hsla.exec(color)) {
return {
h: match[1],
s: match[2],
l: match[3],
a: match[4]
};
}
if (match = matchers.hsv.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3]
};
}
if (match = matchers.hsva.exec(color)) {
return {
h: match[1],
s: match[2],
v: match[3],
a: match[4]
};
}
if (match = matchers.hex8.exec(color)) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
a: convertHexToDecimal(match[4]),
format: named ? "name" : "hex8"
};
}
if (match = matchers.hex6.exec(color)) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
format: named ? "name" : "hex"
};
}
if (match = matchers.hex4.exec(color)) {
return {
r: parseIntFromHex(match[1] + "" + match[1]),
g: parseIntFromHex(match[2] + "" + match[2]),
b: parseIntFromHex(match[3] + "" + match[3]),
a: convertHexToDecimal(match[4] + "" + match[4]),
format: named ? "name" : "hex8"
};
}
if (match = matchers.hex3.exec(color)) {
return {
r: parseIntFromHex(match[1] + "" + match[1]),
g: parseIntFromHex(match[2] + "" + match[2]),
b: parseIntFromHex(match[3] + "" + match[3]),
format: named ? "name" : "hex"
};
}
return false;
}
function validateWCAG2Parms(parms) {
// return valid WCAG2 parms for isReadable.
// If input parms are invalid, return {"level":"AA", "size":"small"}
var level, size;
parms = parms || {
level: "AA",
size: "small"
};
level = (parms.level || "AA").toUpperCase();
size = (parms.size || "small").toLowerCase();
if (level !== "AA" && level !== "AAA") {
level = "AA";
}
if (size !== "small" && size !== "large") {
size = "small";
}
return {
level: level,
size: size
};
}
return tinycolor;
}));
/*!
* angularjs-color-picker v2.7.2
* https://github.com/ruhley/angular-color-picker/
*
* Copyright 2016 ruhley
*
* 2016-12-23 14:00:20
*
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tinycolor2')) :
typeof define === 'function' && define.amd ? define(['tinycolor2'], factory) :
(global.AngularjsColorPicker = factory(global.tinycolor));
}(this, (function (tinycolor) {
'use strict';
tinycolor = 'default' in tinycolor ? tinycolor['default'] : tinycolor;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var set = function set(object, property, value, receiver) {
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent !== null) {
set(parent, property, value, receiver);
}
} else if ("value" in desc && desc.writable) {
desc.value = value;
} else {
var setter = desc.set;
if (setter !== undefined) {
setter.call(receiver, value);
}
}
return value;
};
var AngularColorPickerController = function () {
function AngularColorPickerController(_$scope, _$element, _$document, _$timeout, _ColorPickerOptions) {
classCallCheck(this, AngularColorPickerController);
// set angular injected variables
this.$scope = _$scope;
this.$element = _$element;
this.$document = _$document;
this.$timeout = _$timeout;
this.ColorPickerOptions = _ColorPickerOptions;
this.$scope.init = this.init.bind(this);
this.hue = 0;
this.saturation = undefined;
this.lightness = undefined;
this.opacity = undefined;
}
createClass(AngularColorPickerController, [{
key: 'watchNgModel',
value: function watchNgModel(newValue, oldValue) {
var _this = this;
if (this.colorMouse) {
return;
}
if (newValue !== undefined && oldValue !== undefined && !this.hasOwnProperty('initialNgModel')) {
this.initialNgModel = newValue;
}
// check dirty/pristine state
if (this.hasOwnProperty('initialNgModel')) {
if (newValue === this.initialNgModel) {
if (typeof this.$scope.control[0].$setPristine === 'function') {
this.$scope.control[0].$setPristine();
}
} else {
if (typeof this.$scope.control[0].$setDirty === 'function') {
this.$scope.control[0].$setDirty();
}
}
}
if (newValue !== undefined && newValue !== null && newValue.length > 4) {
var color = tinycolor(newValue);
if (color.isValid()) {
var hsl;
if (this.options.round) {
hsl = color.toHsl();
this.lightness = hsl.l * 100;
} else {
hsl = color.toHsv();
this.lightness = hsl.v * 100;
}
this.hue = hsl.h;
this.saturation = hsl.s * 100;
this.updateModel = false;
if (this.options.alpha) {
this.opacity = hsl.a * 100;
}
this.$timeout(function () {
_this.updateModel = true;
});
this.isValid = true;
} else {
this.isValid = false;
}
this.$scope.control[0].$setValidity(this.$element.attr('name'), this.isValid);
} else {
if (newValue === null || newValue === '') {
this.hue = 0;
this.saturation = undefined;
this.lightness = undefined;
this.opacity = undefined;
}
this.swatchColor = '';
}
}
}, {
key: 'watchSwatchPos',
value: function watchSwatchPos(newValue) {
var _this2 = this;
if (newValue !== undefined) {
this.initConfig();
this.$timeout(function () {
_this2.updateSwatchBackground();
});
}
}
}, {
key: 'setupApi',
value: function setupApi() {
var _this3 = this;
if (!this.api) {
this.api = {};
}
this.api.open = function (event) {
// if already open then don't run show again
if (_this3.is_open) {
return true;
}
_this3.is_open = true;
_this3.hueMouse = false;
_this3.opacityMouse = false;
_this3.colorMouse = false;
// force the sliders to re-caculate their position
_this3.hueUpdate();
_this3.saturationUpdate();
_this3.lightnessUpdate();
_this3.opacityUpdate();
_this3.eventApiDispatch('onOpen', [event]);
};
this.api.close = function (event) {
if (!_this3.options.inline && (_this3.is_open || _this3.$element[0].querySelector('.color-picker-panel').offsetParent !== null)) {
_this3.is_open = false;
_this3.$scope.$applyAsync();
_this3.eventApiDispatch('onClose', [event]);
}
};
this.api.clear = function (event) {
if (_this3.ngModel !== '') {
_this3.ngModel = '';
_this3.eventApiDispatch('onClear', [event]);
}
};
this.api.reset = function (event) {
if (_this3.ngModel !== _this3.initialNgModel) {
_this3.ngModel = _this3.initialNgModel;
_this3.eventApiDispatch('onReset', [event]);
}
};
this.api.getElement = function () {
return _this3.$element;
};
this.api.getScope = function () {
return _this3.$scope;
};
}
}, {
key: 'reInit',
value: function reInit(newValue) {
if (newValue !== undefined) {
this.initConfig();
}
}
}, {
key: 'reInitAndUpdate',
value: function reInitAndUpdate(newValue) {
if (newValue !== undefined) {
this.initConfig();
this.update();
}
}
}, {
key: 'init',
value: function init() {
var _this4 = this;
// browser variables
this.chrome = Boolean(window.chrome);
var _android_version = window.navigator.userAgent.match(/Android\s([0-9\.]*)/i);
this.android_version = _android_version && _android_version.length > 1 ? parseFloat(_android_version[1]) : NaN;
var eventHandlers = {
mouseDown: this.onMouseDown.bind(this),
mouseUp: this.onMouseUp.bind(this),
mouseMove: this.onMouseMove.bind(this),
keyUp: this.onKeyUp.bind(this)
};
// needed variables
this.updateModel = true;
//---------------------------
// watchers
//---------------------------
// ngModel
this.$scope.$watch('AngularColorPickerController.ngModel', this.watchNgModel.bind(this));
// options
this.$scope.$watch('AngularColorPickerController.options.swatchPos', this.watchSwatchPos.bind(this));
this.$scope.$watchGroup(['AngularColorPickerController.options.format', 'AngularColorPickerController.options.alpha', 'AngularColorPickerController.options.case'], this.reInitAndUpdate.bind(this));
this.$scope.$watchGroup(['AngularColorPickerController.options.disabled', 'AngularColorPickerController.options.swatchBootstrap', 'AngularColorPickerController.options.swatchOnly', 'AngularColorPickerController.options.swatch', 'AngularColorPickerController.options.pos', 'AngularColorPickerController.options.inline', 'AngularColorPickerController.options.placeholder', 'AngularColorPickerController.options.round'], this.reInit.bind(this));
// api
this.$scope.$watch('AngularColorPickerController.api', this.setupApi.bind(this));
// internal
this.$scope.$watch('AngularColorPickerController.swatchColor', this.updateSwatchBackground.bind(this));
this.$scope.$watch('AngularColorPickerController.hue', this.hueUpdate.bind(this));
this.$scope.$watch('AngularColorPickerController.saturation', this.saturationUpdate.bind(this));
this.$scope.$watch('AngularColorPickerController.lightness', this.lightnessUpdate.bind(this));
this.$scope.$watch('AngularColorPickerController.opacity', this.opacityUpdate.bind(this));
//---------------------------
// destroy
//---------------------------
this.$scope.$on('$destroy', function () {
// remove mouse events
_this4.$document.off('mousedown', eventHandlers.mouseDown);
_this4.$document.off('mouseup', eventHandlers.mouseUp);
_this4.$document.off('mousemove', eventHandlers.mouseMove);
// remove touch events
_this4.$document.off('touchstart', eventHandlers.mouseDown);
_this4.$document.off('touchend', eventHandlers.mouseUp);
_this4.$document.off('touchmove', eventHandlers.mouseMove);
// remove key events
_this4.$document.off('keyup', eventHandlers.keyUp);
_this4.eventApiDispatch('onDestroy');
});
// set default config settings
this.initConfig();
// setup mouse events
this.$document.on('mousedown', eventHandlers.mouseDown);
this.$document.on('mouseup', eventHandlers.mouseUp);
this.$document.on('mousemove', eventHandlers.mouseMove);
// setup touch events
this.$document.on('touchstart', eventHandlers.mouseDown);
this.$document.on('touchend', eventHandlers.mouseUp);
this.$document.on('touchmove', eventHandlers.mouseMove);
// setup key events
this.$document.on('keyup', eventHandlers.keyUp);
// grid click
this.find('.color-picker-grid').on('click', this.onColorClick.bind(this));
this.find('.color-picker-grid').on('touchend', this.onColorClick.bind(this));
// hue click
this.find('.color-picker-hue').on('click', this.onHueClick.bind(this));
this.find('.color-picker-hue').on('touchend', this.onHueClick.bind(this));
// saturation click
this.find('.color-picker-saturation').on('click', this.onSaturationClick.bind(this));
this.find('.color-picker-saturation').on('touchend', this.onSaturationClick.bind(this));
// lightness click
this.find('.color-picker-lightness').on('click', this.onLightnessClick.bind(this));
this.find('.color-picker-lightness').on('touchend', this.onLightnessClick.bind(this));
// opacity click
this.find('.color-picker-opacity').on('click', this.onOpacityClick.bind(this));
this.find('.color-picker-opacity').on('touchend', this.onOpacityClick.bind(this));
}
}, {
key: 'onMouseDown',
value: function onMouseDown(event) {
this.has_moused_moved = false;
// an element in this picker
if (!this.options.disabled && this.find(event.target).length > 0) {
// mouse event on color grid
if (event.target.classList.contains('color-picker-grid-inner') || event.target.classList.contains('color-picker-picker') || event.target.parentNode.classList.contains('color-picker-picker')) {
this.colorDown(event);
this.$scope.$apply();
// mouse event on hue slider
} else if (event.target.classList.contains('color-picker-hue') || event.target.parentNode.classList.contains('color-picker-hue')) {
this.hueDown(event);
this.$scope.$apply();
// mouse event on saturation slider
} else if (event.target.classList.contains('color-picker-saturation') || event.target.parentNode.classList.contains('color-picker-saturation')) {
this.saturationDown(event);
this.$scope.$apply();
// mouse event on lightness slider
} else if (event.target.classList.contains('color-picker-lightness') || event.target.parentNode.classList.contains('color-picker-lightness')) {
this.lightnessDown(event);
this.$scope.$apply();
// mouse event on opacity slider
} else if (event.target.classList.contains('color-picker-opacity') || event.target.parentNode.classList.contains('color-picker-opacity')) {
this.opacityDown(event);
this.$scope.$apply();
}
}
}
}, {
key: 'onMouseUp',
value: function onMouseUp(event) {
// no current mouse events and not an element in the picker
if (!this.colorMouse && !this.hueMouse && !this.opacityMouse && this.find(event.target).length === 0) {
this.setupApi(); // TODO - there are some weird times when this is needed to call close. Need to figure out why.
if (this.options.hide.click) {
this.api.close(event);
}
this.$scope.$apply();
// mouse event on color grid
} else if (this.colorMouse && this.has_moused_moved) {
this.colorUp(event);
this.$scope.$apply();
this.onChange(event);
// mouse event on hue slider
} else if (this.hueMouse && this.has_moused_moved) {
this.hueUp(event);
this.$scope.$apply();
this.onChange(event);
// mouse event on saturation slider
} else if (this.saturationMouse && this.has_moused_moved) {
this.saturationUp(event);
this.$scope.$apply();
this.onChange(event);
// mouse event on lightness slider
} else if (this.lightnessMouse && this.has_moused_moved) {
this.lightnessUp(event);
this.$scope.$apply();
this.onChange(event);
// mouse event on opacity slider
} else if (this.opacityMouse && this.has_moused_moved) {
this.opacityUp(event);
this.$scope.$apply();
this.onChange(event);
}
}
}, {
key: 'onMouseMove',
value: function onMouseMove(event) {
// mouse event on color grid
if (this.colorMouse) {
this.has_moused_moved = true;
this.colorChange(event);
this.$scope.$apply();
// mouse event on hue slider
} else if (this.hueMouse) {
this.has_moused_moved = true;
this.hueChange(event);
this.$scope.$apply();
// mouse event on saturation slider
} else if (this.saturationMouse) {
this.has_moused_moved = true;
this.saturationChange(event);
this.$scope.$apply();
// mouse event on lightness slider
} else if (this.lightnessMouse) {
this.has_moused_moved = true;
this.lightnessChange(event);
this.$scope.$apply();
// mouse event on opacity slider
} else if (this.opacityMouse) {
this.has_moused_moved = true;
this.opacityChange(event);
this.$scope.$apply();
}
}
}, {
key: 'onKeyUp',
value: function onKeyUp(event) {
// escape key
if (this.options.hide.escape && event.keyCode === 27) {
this.api.close(event);
}
}
}, {
key: 'onColorClick',
value: function onColorClick(event) {
if (!this.options.disabled && !this.has_moused_moved) {
this.colorChange(event);
this.colorUp(event);
this.$scope.$apply();
this.onChange(event);
}
}
}, {
key: 'onHueClick',
value: function onHueClick(event) {
if (!this.options.disabled && !this.has_moused_moved) {
this.hueChange(event);
this.hueUp(event);
this.$scope.$apply();
this.onChange(event);
}
}
}, {
key: 'onSaturationClick',
value: function onSaturationClick(event) {
if (!this.options.disabled && !this.has_moused_moved) {
this.saturationChange(event);
this.saturationUp(event);
this.$scope.$apply();
this.onChange(event);
}
}
}, {
key: 'onLightnessClick',
value: function onLightnessClick(event) {
if (!this.options.disabled && !this.has_moused_moved) {
this.lightnessChange(event);
this.lightnessUp(event);
this.$scope.$apply();
this.onChange(event);
}
}
}, {
key: 'onOpacityClick',
value: function onOpacityClick(event) {
if (!this.options.disabled && !this.has_moused_moved) {
this.opacityChange(event);
this.opacityUp(event);
this.$scope.$apply();
this.onChange(event);
}
}
}, {
key: 'onChange',
value: function onChange(event) {
// don't fire if it hasn't actually changed
if (this.ngModel !== this.onChangeValue) {
this.onChangeValue = this.ngModel;
this.eventApiDispatch('onChange', [event]);
}
}
}, {
key: 'onBlur',
value: function onBlur(event) {
if (this.ngModel !== this.onChangeValue) {
this.updateModel = true;
this.update();
}
this.$scope.control[0].$setTouched();
this.eventApiDispatch('onBlur', [event]);
// if clicking outside the color picker
if (this.options.hide.blur && this.find(event.relatedTarget).length === 0) {
this.api.close(event);
}
}
}, {
key: 'initConfig',
value: function initConfig() {
if (!this.options) {
this.options = {};
}
this.mergeOptions(this.options, this.ColorPickerOptions);
this.is_open = this.options.inline;
if (this.options.round) {
this.options.hue = false;
} else {
this.options.saturation = false;
}
if (this.options.inline) {
this.options.close.show = false;
}
}
}, {
key: 'mergeOptions',
value: function mergeOptions(options, defaultOptions) {
for (var attr in defaultOptions) {
if (defaultOptions.hasOwnProperty(attr)) {
if (!options || !options.hasOwnProperty(attr)) {
options[attr] = defaultOptions[attr];
} else if (_typeof(defaultOptions[attr]) === 'object') {
this.mergeOptions(options[attr], defaultOptions[attr]);
}
}
}
}
}, {
key: 'onSwatchClick',
value: function onSwatchClick($event) {
if (this.options.show.swatch) {
this.api.open($event);
}
}
}, {
key: 'onFocus',
value: function onFocus($event) {
if (this.options.show.focus) {
this.api.open($event);
}
}
}, {
key: 'update',
value: function update() {
if (this.hue === undefined || this.saturation === undefined || this.lightness === undefined) {
return false;
}
var color;
if (this.options.round) {
color = tinycolor({ h: this.hue, s: this.saturation, l: this.lightness });
} else {
color = tinycolor({ h: this.hue, s: this.saturation, v: this.lightness });
}
if (this.options.alpha) {
color.setAlpha(this.opacity / 100);
}
this.swatchColor = color.toHslString();
this.updateSaturationBackground(color);
this.updateLightnessBackground(color);
var colorString;
switch (this.options.format) {
case 'rgb':
colorString = color.toRgbString();
break;
case 'hex':
colorString = color.toHexString();
if (this.options.case === 'lower') {
colorString = colorString.toLowerCase();
} else {
colorString = colorString.toUpperCase();
}
break;
case 'hex8':
colorString = color.toHex8String();
if (this.options.case === 'lower') {
colorString = colorString.toLowerCase();
} else {
colorString = colorString.toUpperCase();
}
break;
case 'hsv':
colorString = color.toHsvString();
break;
default:
colorString = color.toHslString();
break;
}
if (this.updateModel) {
this.ngModel = colorString;
}
}
}, {
key: 'updateSwatchBackground',
value: function updateSwatchBackground() {
var el = angular.element(this.$element[0].querySelector('.color-picker-swatch'));
el.css({
'background-color': this.swatchColor
});
}
}, {
key: 'huePosUpdate',
value: function huePosUpdate() {
var _this5 = this;
this.$timeout(function () {
var container = _this5.$element[0].querySelector('.color-picker-hue');
var el = angular.element(_this5.$element[0].querySelector('.color-picker-hue .color-picker-slider'));
var bounding = container.getBoundingClientRect();
el.css({
'top': bounding.height * _this5.huePos / 100 + 'px'
});
});
}
}, {
key: 'saturationPosUpdate',
value: function saturationPosUpdate() {
var _this6 = this;
this.$timeout(function () {
var container, el, bounding;
if (!_this6.options.round) {
container = _this6.$element[0].querySelector('.color-picker-grid');
el = angular.element(_this6.$element[0].querySelector('.color-picker-grid .color-picker-picker'));
bounding = container.getBoundingClientRect();
el.css({
'left': bounding.width * _this6.saturationPos / 100 + 'px'
});
}
container = _this6.$element[0].querySelector('.color-picker-saturation');
el = angular.element(_this6.$element[0].querySelector('.color-picker-saturation .color-picker-slider'));
bounding = container.getBoundingClientRect();
el.css({
'top': bounding.height * (100 - _this6.saturationPos) / 100 + 'px'
});
});
}
}, {
key: 'lightnessPosUpdate',
value: function lightnessPosUpdate() {
var _this7 = this;
this.$timeout(function () {
var container, el, bounding;
if (!_this7.options.round) {
container = _this7.$element[0].querySelector('.color-picker-grid');
el = angular.element(_this7.$element[0].querySelector('.color-picker-grid .color-picker-picker'));
bounding = container.getBoundingClientRect();
el.css({
'top': bounding.height * _this7.lightnessPos / 100 + 'px'
});
}
container = _this7.$element[0].querySelector('.color-picker-lightness');
el = angular.element(_this7.$element[0].querySelector('.color-picker-lightness .color-picker-slider'));
bounding = container.getBoundingClientRect();
el.css({
'top': bounding.height * _this7.lightnessPos / 100 + 'px'
});
});
}
}, {
key: 'opacityPosUpdate',
value: function opacityPosUpdate() {
var _this8 = this;
this.$timeout(function () {
var container = _this8.$element[0].querySelector('.color-picker-opacity');
var el = angular.element(_this8.$element[0].querySelector('.color-picker-opacity .color-picker-slider'));
var bounding = container.getBoundingClientRect();
el.css({
'top': bounding.height * _this8.opacityPos / 100 + 'px'
});
});
}
}, {
key: 'gridUpdate',
value: function gridUpdate() {
var el = angular.element(this.$element[0].querySelector('.color-picker-grid'));
el.css({
'background-color': this.grid
});
}
//---------------------------
// hue functions
//---------------------------
}, {
key: 'hueDown',
value: function hueDown(event) {
event.stopPropagation();
event.preventDefault();
this.hueMouse = true;
}
}, {
key: 'hueUp',
value: function hueUp(event) {
event.stopPropagation();
event.preventDefault();
this.hueMouse = false;
}
}, {
key: 'hueChange',
value: function hueChange(event) {
event.stopPropagation();
event.preventDefault();
var el = this.find('.color-picker-hue');
var eventPos = this.getEventPos(event);
this.hue = Math.round((1 - (eventPos.pageY - this.offset(el).top) / el.prop('offsetHeight')) * 360);
if (this.hue > 360) {
this.hue = 360;
} else if (this.hue < 0) {
this.hue = 0;
}
}
}, {
key: 'hueUpdate',
value: function hueUpdate() {
if (this.hue !== undefined) {
this.huePos = (1 - this.hue / 360) * 100;
this.grid = tinycolor({ h: this.hue, s: 100, v: 1 }).toHslString();
if (this.huePos < 0) {
this.huePos = 0;
} else if (this.huePos > 100) {
this.huePos = 100;
}
if (this.options.round) {
this.getRoundPos();
this.updateRoundPos();
} else {
this.gridUpdate();
}
this.huePosUpdate();
this.update();
}
}
//---------------------------
// saturation functions
//---------------------------
}, {
key: 'saturationDown',
value: function saturationDown(event) {
event.stopPropagation();
event.preventDefault();
this.saturationMouse = true;
}
}, {
key: 'saturationUp',
value: function saturationUp(event) {
event.stopPropagation();
event.preventDefault();
this.saturationMouse = false;
}
}, {
key: 'saturationChange',
value: function saturationChange(event) {
event.stopPropagation();
event.preventDefault();
var el = this.find('.color-picker-saturation');
var eventPos = this.getEventPos(event);
this.saturation = Math.round((1 - (eventPos.pageY - this.offset(el).top) / el.prop('offsetHeight')) * 100);
if (this.saturation > 100) {
this.saturation = 100;
} else if (this.saturation < 0) {
this.saturation = 0;
}
}
}, {
key: 'saturationUpdate',
value: function saturationUpdate() {
if (this.saturation !== undefined) {
if (this.options.round) {
this.getRoundPos();
this.updateRoundPos();
}
this.saturationPos = this.saturation;
if (this.saturationPos < 0) {
this.saturationPos = 0;
} else if (this.saturationPos > 100) {
this.saturationPos = 100;
}
this.saturationPosUpdate();
this.update();
}
}
}, {
key: 'updateSaturationBackground',
value: function updateSaturationBackground(color) {
var el = this.find('.color-picker-saturation');
var saturated = color.clone().saturate(100);
var desaturated = color.clone().desaturate(100);
el.css({
'background': 'linear-gradient(to bottom, ' + saturated.toHexString() + ' 0%, ' + desaturated.toHexString() + ' 100%)'
});
}
}, {
key: 'updateLightnessBackground',
value: function updateLightnessBackground(color) {
var el = this.find('.color-picker-lightness');
if (this.options.round) {
var hsl = color.toHsl();
hsl.l = 50;
hsl = tinycolor(hsl);
el.css({
'background': 'linear-gradient(to bottom, #FFFFFF 0%, ' + hsl.toHexString() + ' 50%, #000000 100%)'
});
} else {
var hsv = color.toHsv();
hsv.v = 100;
hsv = tinycolor(hsv);
el.css({
'background': 'linear-gradient(to bottom, ' + hsv.toHexString() + ' 0%, #000000 100%)'
});
}
}
//---------------------------
// lightness functions
//---------------------------
}, {
key: 'lightnessDown',
value: function lightnessDown(event) {
event.stopPropagation();
event.preventDefault();
this.lightnessMouse = true;
}
}, {
key: 'lightnessUp',
value: function lightnessUp(event) {
event.stopPropagation();
event.preventDefault();
this.lightnessMouse = false;
}
}, {
key: 'lightnessChange',
value: function lightnessChange(event) {
event.stopPropagation();
event.preventDefault();
var el = this.find('.color-picker-lightness');
var eventPos = this.getEventPos(event);
this.lightness = Math.round((1 - (eventPos.pageY - this.offset(el).top) / el.prop('offsetHeight')) * 100);
if (this.lightness > 100) {
this.lightness = 100;
} else if (this.lightness < 0) {
this.lightness = 0;
}
}
}, {
key: 'lightnessUpdate',
value: function lightnessUpdate() {
if (this.lightness !== undefined) {
this.lightnessPos = 100 - this.lightness;
if (this.lightnessPos < 0) {
this.lightnessPos = 0;
} else if (this.lightnessPos > 100) {
this.lightnessPos = 100;
}
this.lightnessPosUpdate();
this.update();
}
}
//---------------------------
// opacity functions
//---------------------------
}, {
key: 'opacityDown',
value: function opacityDown(event) {
event.stopPropagation();
event.preventDefault();
this.opacityMouse = true;
}
}, {
key: 'opacityUp',
value: function opacityUp(event) {
event.stopPropagation();
event.preventDefault();
this.opacityMouse = false;
}
}, {
key: 'opacityChange',
value: function opacityChange(event) {
event.stopPropagation();
event.preventDefault();
var el = this.find('.color-picker-opacity');
var eventPos = this.getEventPos(event);
this.opacity = (1 - (eventPos.pageY - this.offset(el).top) / el.prop('offsetHeight')) * 100;
if (this.opacity > 100) {
this.opacity = 100;
} else if (this.opacity < 0) {
this.opacity = 0;
}
}
}, {
key: 'opacityUpdate',
value: function opacityUpdate() {
if (this.opacity !== undefined) {
this.opacityPos = (1 - this.opacity / 100) * 100;
if (this.opacityPos < 0) {
this.opacityPos = 0;
} else if (this.opacityPos > 100) {
this.opacityPos = 100;
}
this.opacityPosUpdate();
this.update();
}
}
//---------------------------
// color functions
//---------------------------
}, {
key: 'colorDown',
value: function colorDown(event) {
event.stopPropagation();
event.preventDefault();
this.colorMouse = true;
}
}, {
key: 'colorUp',
value: function colorUp(event) {
event.stopPropagation();
event.preventDefault();
this.colorMouse = false;
}
}, {
key: 'colorChange',
value: function colorChange(event) {
event.stopPropagation();
event.preventDefault();
var el = this.find('.color-picker-grid-inner');
var eventPos = this.getEventPos(event);
var offset = this.offset(el);
if (this.options.round) {
var dx = (eventPos.pageX - offset.left) * 2.0 / el.prop('offsetWidth') - 1.0;
var dy = -((eventPos.pageY - offset.top) * 2.0 / el.prop('offsetHeight')) + 1.0;
var tmpHue = Math.atan2(dy, dx);
var degHue = Math.round(tmpHue * 57.29577951308233); // rad to deg
if (degHue < 0) {
degHue += 360;
}
this.hue = degHue;
var tmpSaturation = Math.sqrt(dx * dx + dy * dy);
if (tmpSaturation > 1) {
tmpSaturation = 1;
} else if (tmpSaturation < 0) {
tmpSaturation = 0;
}
this.saturation = tmpSaturation * 100;
if (this.lightness === undefined) {
this.lightness = 50;
}
} else {
this.saturation = (eventPos.pageX - offset.left) / el.prop('offsetWidth') * 100;
this.lightness = (1 - (eventPos.pageY - offset.top) / el.prop('offsetHeight')) * 100;
if (this.saturation > 100) {
this.saturation = 100;
} else if (this.saturation < 0) {
this.saturation = 0;
}
if (this.lightness > 100) {
this.lightness = 100;
} else if (this.lightness < 0) {
this.lightness = 0;
}
}
}
//---------------------------
// helper functions
//---------------------------
}, {
key: 'getRoundPos',
value: function getRoundPos() {
var angle = this.hue * 0.01745329251994; // deg to rad
var px = Math.cos(angle) * this.saturation;
var py = -Math.sin(angle) * this.saturation;
this.xPos = (px + 100.0) * 0.5;
this.yPos = (py + 100.0) * 0.5;
// because it are using percentages this can be half of 100%
var center = 50;
// distance of pointer from the center of the circle
var distance = Math.pow(center - this.xPos, 2) + Math.pow(center - this.yPos, 2);
// distance of edge of circle from the center of the circle
var radius = Math.pow(center, 2);
// if not inside the circle
if (distance > radius) {
var rads = Math.atan2(this.yPos - center, this.xPos - center);
this.xPos = Math.cos(rads) * center + center;
this.yPos = Math.sin(rads) * center + center;
}
}
}, {
key: 'updateRoundPos',
value: function updateRoundPos() {
var _this9 = this;
this.$timeout(function () {
var container = _this9.$element[0].querySelector('.color-picker-grid');
var el = angular.element(_this9.$element[0].querySelector('.color-picker-grid .color-picker-picker'));
var bounding = container.getBoundingClientRect();
el.css({
left: bounding.width * _this9.xPos / 100 + 'px',
top: bounding.height * _this9.yPos / 100 + 'px'
});
});
}
}, {
key: 'getEventPos',
value: function getEventPos(event) {
// if a touch event
if (event.type.search('touch') === 0) {
// if event modified by angular
if (event.originalEvent && event.originalEvent.changedTouches) {
return event.originalEvent.changedTouches[0];
// if a standard js touch event
} else if (event.changedTouches) {
return event.changedTouches[0];
}
}
// return a non-touch event
return event;
}
}, {
key: 'eventApiDispatch',
value: function eventApiDispatch(name, args) {
if (this.eventApi && typeof this.eventApi[name] === 'function') {
if (!args) {
args = [];
}
args.unshift(this.ngModel);
args.unshift(this.api);
this.eventApi[name].apply(this, args);
}
}
// taken and modified from jQuery's find
}, {
key: 'find',
value: function find(selector) {
var context = this.wrapper ? this.wrapper[0] : this.$element[0],
results = [],
nodeType;
// Same basic safeguard as Sizzle
if (!selector) {
return results;
}
if (typeof selector === 'string') {
// Early return if context is not an element or document
if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) {
return [];
}
results = context.querySelectorAll(selector);
} else {
if (context.contains(selector)) {
results.push(selector);
}
}
return angular.element(results);
}
// taken and modified from jQuery's offset
}, {
key: 'offset',
value: function offset(el) {
var docElem,
win,
rect,
doc,
elem = el[0];
if (!elem) {
return;
}
// Support: IE<=11+
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if (!elem.getClientRects().length) {
return { top: 0, left: 0 };
}
rect = elem.getBoundingClientRect();
// Make sure element is not hidden (display: none)
if (rect.width || rect.height) {
doc = elem.ownerDocument;
win = doc !== null && doc === doc.window ? doc : doc.nodeType === 9 && doc.defaultView;
docElem = doc.documentElement;
// hack for small chrome screens not position the clicks properly when the page is scrolled
if (this.chrome && this.android_version < 6 && screen.width <= 768) {
return {
top: rect.top - docElem.clientTop,
left: rect.left - docElem.clientLeft
};
}
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
}
return rect;
}
}]);
return AngularColorPickerController;
}();
AngularColorPickerController.$inject = ['$scope', '$element', '$document', '$timeout', 'ColorPickerOptions'];
function colorPickerDirective() {
return {
restrict: 'E',
require: ['^ngModel'],
scope: {
ngModel: '=',
options: '=?',
api: '=?',
eventApi: '=?'
},
bindToController: true,
templateUrl: 'template/color-picker/directive.html',
controller: AngularColorPickerController,
controllerAs: 'AngularColorPickerController',
link: function link($scope, element, attrs, control) {
$scope.control = control;
$scope.init();
}
};
}
function template($templateCache) {
$templateCache.put('template/color-picker/directive.html', '' + '
' + ' ' + ' ' + ' ' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + ' ' + ' {{AngularColorPickerController.options.clear.label}}' + ' ' + ' {{AngularColorPickerController.options.reset.label}}' + ' ' + ' {{AngularColorPickerController.options.close.label}}' + ' ' + '
' + '
' + '
');
}
template.$inject = ['$templateCache'];
var AngularColorPickerOptions = function AngularColorPickerOptions() {
classCallCheck(this, AngularColorPickerOptions);
return {
required: false,
disabled: false,
hue: true,
saturation: false,
lightness: false,
alpha: true,
round: false,
case: 'upper',
format: 'hsl',
pos: 'bottom left',
swatch: true,
swatchOnly: false,
swatchPos: 'left',
swatchBootstrap: true,
inline: false,
placeholder: '',
id: undefined,
name: undefined,
show: {
swatch: true,
focus: true
},
hide: {
blur: true,
escape: true,
click: true
},
close: {
show: false,
label: 'Close',
class: ''
},
clear: {
show: false,
label: 'Clear',
class: ''
},
reset: {
show: false,
label: 'Reset',
class: ''
}
};
};
var colorPicker = angular.module('color.picker', []).service('ColorPickerOptions', AngularColorPickerOptions).directive('colorPicker', colorPickerDirective).run(template);
return colorPicker;
})));
var duScrollDefaultEasing = function (e) { "use strict"; return e < .5 ? Math.pow(2 * e, 2) / 2 : 1 - Math.pow(2 * (1 - e), 2) / 2 }, duScroll = angular.module("duScroll", ["duScroll.scrollspy", "duScroll.smoothScroll", "duScroll.scrollContainer", "duScroll.spyContext", "duScroll.scrollHelpers"]).value("duScrollDuration", 350).value("duScrollSpyWait", 100).value("duScrollSpyRefreshInterval", 0).value("duScrollGreedy", !1).value("duScrollOffset", 0).value("duScrollEasing", duScrollDefaultEasing).value("duScrollCancelOnEvents", "scroll mousedown mousewheel touchmove keydown").value("duScrollBottomSpy", !1).value("duScrollActiveClass", "active"); "undefined" != typeof module && module && module.exports && (module.exports = duScroll), angular.module("duScroll.scrollHelpers", ["duScroll.requestAnimation"]).run(["$window", "$q", "cancelAnimation", "requestAnimation", "duScrollEasing", "duScrollDuration", "duScrollOffset", "duScrollCancelOnEvents", function (e, t, n, r, o, l, u, i) { "use strict"; var c = {}, a = function (e) { return "undefined" != typeof HTMLDocument && e instanceof HTMLDocument || e.nodeType && e.nodeType === e.DOCUMENT_NODE }, s = function (e) { return "undefined" != typeof HTMLElement && e instanceof HTMLElement || e.nodeType && e.nodeType === e.ELEMENT_NODE }, d = function (e) { return s(e) || a(e) ? e : e[0] }; c.duScrollTo = function (t, n, r, o) { var l; if (angular.isElement(t) ? l = this.duScrollToElement : angular.isDefined(r) && (l = this.duScrollToAnimated), l) return l.apply(this, arguments); var u = d(this); return a(u) ? e.scrollTo(t, n) : (u.scrollLeft = t, void (u.scrollTop = n)) }; var f, m; c.duScrollToAnimated = function (e, l, u, c) { u && !c && (c = o); var a = this.duScrollLeft(), s = this.duScrollTop(), d = Math.round(e - a), p = Math.round(l - s), S = null, g = 0, v = this, h = function (e) { (!e || g && e.which > 0) && (i && v.unbind(i, h), n(f), m.reject(), f = null) }; if (f && h(), m = t.defer(), 0 === u || !d && !p) return 0 === u && v.duScrollTo(e, l), m.resolve(), m.promise; var y = function (e) { null === S && (S = e), g = e - S; var t = g >= u ? 1 : c(g / u); v.scrollTo(a + Math.ceil(d * t), s + Math.ceil(p * t)), t < 1 ? f = r(y) : (i && v.unbind(i, h), f = null, m.resolve()) }; return v.duScrollTo(a, s), i && v.bind(i, h), f = r(y), m.promise }, c.duScrollToElement = function (e, t, n, r) { var o = d(this); angular.isNumber(t) && !isNaN(t) || (t = u); var l = this.duScrollTop() + d(e).getBoundingClientRect().top - t; return s(o) && (l -= o.getBoundingClientRect().top), this.duScrollTo(0, l, n, r) }, c.duScrollLeft = function (t, n, r) { if (angular.isNumber(t)) return this.duScrollTo(t, this.duScrollTop(), n, r); var o = d(this); return a(o) ? e.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft : o.scrollLeft }, c.duScrollTop = function (t, n, r) { if (angular.isNumber(t)) return this.duScrollTo(this.duScrollLeft(), t, n, r); var o = d(this); return a(o) ? e.scrollY || document.documentElement.scrollTop || document.body.scrollTop : o.scrollTop }, c.duScrollToElementAnimated = function (e, t, n, r) { return this.duScrollToElement(e, t, n || l, r) }, c.duScrollTopAnimated = function (e, t, n) { return this.duScrollTop(e, t || l, n) }, c.duScrollLeftAnimated = function (e, t, n) { return this.duScrollLeft(e, t || l, n) }, angular.forEach(c, function (e, t) { angular.element.prototype[t] = e; var n = t.replace(/^duScroll/, "scroll"); angular.isUndefined(angular.element.prototype[n]) && (angular.element.prototype[n] = e) }) }]), angular.module("duScroll.polyfill", []).factory("polyfill", ["$window", function (e) { "use strict"; var t = ["webkit", "moz", "o", "ms"]; return function (n, r) { if (e[n]) return e[n]; for (var o, l = n.substr(0, 1).toUpperCase() + n.substr(1), u = 0; u < t.length; u++) if (o = t[u] + l, e[o]) return e[o]; return r } }]), angular.module("duScroll.requestAnimation", ["duScroll.polyfill"]).factory("requestAnimation", ["polyfill", "$timeout", function (e, t) { "use strict"; var n = 0, r = function (e, r) { var o = (new Date).getTime(), l = Math.max(0, 16 - (o - n)), u = t(function () { e(o + l) }, l); return n = o + l, u }; return e("requestAnimationFrame", r) }]).factory("cancelAnimation", ["polyfill", "$timeout", function (e, t) { "use strict"; var n = function (e) { t.cancel(e) }; return e("cancelAnimationFrame", n) }]), angular.module("duScroll.spyAPI", ["duScroll.scrollContainerAPI"]).factory("spyAPI", ["$rootScope", "$timeout", "$interval", "$window", "$document", "scrollContainerAPI", "duScrollGreedy", "duScrollSpyWait", "duScrollSpyRefreshInterval", "duScrollBottomSpy", "duScrollActiveClass", function (e, t, n, r, o, l, u, i, c, a, s) { "use strict"; var d = function (n) { var l = !1, c = !1, d = function () { c = !1; var t, l = n.container, i = l[0], d = 0; if ("undefined" != typeof HTMLElement && i instanceof HTMLElement || i.nodeType && i.nodeType === i.ELEMENT_NODE) d = i.getBoundingClientRect().top, t = Math.round(i.scrollTop + i.clientHeight) >= i.scrollHeight; else { var f = o[0].body.scrollHeight || o[0].documentElement.scrollHeight; t = Math.round(r.pageYOffset + r.innerHeight) >= f } var m, p, S, g, v, h, y = a && t ? "bottom" : "top"; for (g = n.spies, p = n.currentlyActive, S = void 0, m = 0; m < g.length; m++) v = g[m], h = v.getTargetPosition(), h && v.$element && (a && t || h.top + v.offset - d < 20 && (u || h.top * -1 + d) < h.height) && (!S || S[y] < h[y]) && (S = { spy: v }, S[y] = h[y]); S && (S = S.spy), p === S || u && !S || (p && p.$element && (p.$element.removeClass(s), e.$broadcast("duScrollspy:becameInactive", p.$element, angular.element(p.getTargetElement()))), S && (S.$element.addClass(s), e.$broadcast("duScrollspy:becameActive", S.$element, angular.element(S.getTargetElement()))), n.currentlyActive = S) }; return i ? function () { l ? c = !0 : (d(), l = t(function () { l = !1, c && d() }, i, !1)) } : d }, f = {}, m = function (e) { var t = e.$id, n = { spies: [] }; return n.handler = d(n), f[t] = n, e.$on("$destroy", function () { p(e) }), t }, p = function (e) { var t = e.$id, r = f[t], o = r.container; r.intervalPromise && n.cancel(r.intervalPromise), o && o.off("scroll", r.handler), delete f[t] }, S = m(e), g = function (e) { return f[e.$id] ? f[e.$id] : e.$parent ? g(e.$parent) : f[S] }, v = function (e) { var t, n, r = e.$scope; if (r) return g(r); for (n in f) if (t = f[n], t.spies.indexOf(e) !== -1) return t }, h = function (e) { for (; e.parentNode;) if (e = e.parentNode, e === document) return !0; return !1 }, y = function (e) { var t = v(e); t && (t.spies.push(e), t.container && h(t.container) || (t.container && t.container.off("scroll", t.handler), t.container = l.getContainer(e.$scope), c && !t.intervalPromise && (t.intervalPromise = n(t.handler, c, 0, !1)), t.container.on("scroll", t.handler).triggerHandler("scroll"))) }, $ = function (t) { var n = v(t); t === n.currentlyActive && (e.$broadcast("duScrollspy:becameInactive", n.currentlyActive.$element), n.currentlyActive = null); var r = n.spies.indexOf(t); r !== -1 && n.spies.splice(r, 1), t.$element = null }; return { addSpy: y, removeSpy: $, createContext: m, destroyContext: p, getContextForScope: g } }]), angular.module("duScroll.scrollContainerAPI", []).factory("scrollContainerAPI", ["$document", function (e) { "use strict"; var t = {}, n = function (e, n) { var r = e.$id; return t[r] = n, r }, r = function (e) { return t[e.$id] ? e.$id : e.$parent ? r(e.$parent) : void 0 }, o = function (n) { var o = r(n); return o ? t[o] : e }, l = function (e) { var n = r(e); n && delete t[n] }; return { getContainerId: r, getContainer: o, setContainer: n, removeContainer: l } }]), angular.module("duScroll.smoothScroll", ["duScroll.scrollHelpers", "duScroll.scrollContainerAPI"]).directive("duSmoothScroll", ["duScrollDuration", "duScrollOffset", "scrollContainerAPI", function (e, t, n) { "use strict"; return { link: function (r, o, l) { o.on("click", function (o) { if (l.href && l.href.indexOf("#") !== -1 || "" !== l.duSmoothScroll) { var u = l.href ? l.href.replace(/.*(?=#[^\s]+$)/, "").substring(1) : l.duSmoothScroll, i = document.getElementById(u) || document.getElementsByName(u)[0]; if (i && i.getBoundingClientRect) { o.stopPropagation && o.stopPropagation(), o.preventDefault && o.preventDefault(); var c = l.offset ? parseInt(l.offset, 10) : t, a = l.duration ? parseInt(l.duration, 10) : e, s = n.getContainer(r); s.duScrollToElement(angular.element(i), isNaN(c) ? 0 : c, isNaN(a) ? 0 : a) } } }) } } }]), angular.module("duScroll.spyContext", ["duScroll.spyAPI"]).directive("duSpyContext", ["spyAPI", function (e) { "use strict"; return { restrict: "A", scope: !0, compile: function (t, n, r) { return { pre: function (t, n, r, o) { e.createContext(t) } } } } }]), angular.module("duScroll.scrollContainer", ["duScroll.scrollContainerAPI"]).directive("duScrollContainer", ["scrollContainerAPI", function (e) { "use strict"; return { restrict: "A", scope: !0, compile: function (t, n, r) { return { pre: function (t, n, r, o) { r.$observe("duScrollContainer", function (r) { angular.isString(r) && (r = document.getElementById(r)), r = angular.isElement(r) ? angular.element(r) : n, e.setContainer(t, r), t.$on("$destroy", function () { e.removeContainer(t) }) }) } } } } }]), angular.module("duScroll.scrollspy", ["duScroll.spyAPI"]).directive("duScrollspy", ["spyAPI", "duScrollOffset", "$timeout", "$rootScope", function (e, t, n, r) { "use strict"; var o = function (e, t, n, r) { angular.isElement(e) ? this.target = e : angular.isString(e) && (this.targetId = e), this.$scope = t, this.$element = n, this.offset = r }; return o.prototype.getTargetElement = function () { return !this.target && this.targetId && (this.target = document.getElementById(this.targetId) || document.getElementsByName(this.targetId)[0]), this.target }, o.prototype.getTargetPosition = function () { var e = this.getTargetElement(); if (e) return e.getBoundingClientRect() }, o.prototype.flushTargetCache = function () { this.targetId && (this.target = void 0) }, { link: function (l, u, i) { var c, a = i.ngHref || i.href; if (a && a.indexOf("#") !== -1 ? c = a.replace(/.*(?=#[^\s]+$)/, "").substring(1) : i.duScrollspy ? c = i.duScrollspy : i.duSmoothScroll && (c = i.duSmoothScroll), c) { var s = n(function () { var n = new o(c, l, u, (-(i.offset ? parseInt(i.offset, 10) : t))); e.addSpy(n), l.$on("$locationChangeSuccess", n.flushTargetCache.bind(n)); var a = r.$on("$stateChangeSuccess", n.flushTargetCache.bind(n)); l.$on("$destroy", function () { e.removeSpy(n), a() }) }, 0, !1); l.$on("$destroy", function () { n.cancel(s) }) } } } }]);
angular.module("duParallax", ["duScroll", "duParallax.directive", "duParallax.helper"]).value("duParallaxTouchEvents", !0), angular.module("duParallax.helper", []).factory("parallaxHelper", function () { function r(r, a, o, n) { return function (t) { var e = r * ((n || 0) + t.elemY); return angular.isNumber(a) && e > a ? a : angular.isNumber(o) && o > e ? o : e } } return { createAnimator: r, background: r(-.3, 150, -30, 50) } }), angular.module("duParallax.directive", ["duScroll"]).directive("duParallax", ["$rootScope", "$window", "$document", "duParallaxTouchEvents", function (r, a, o, n) { for (var t, e = angular.element("
")[0], l = "transform WebkitTransform MozTransform OTransform".split(" "), u = 0; u < l.length; u++) if (void 0 !== e.style[l[u]]) { t = l[u]; break } if (!(!t || !n && "ontouchstart" in window)) { var i = function (r) { return r.x || r.y ? "translate3d(" + Math.round(r.x) + "px, " + Math.round(r.y) + "px, 0)" : "" }, c = function (r) { return r.rotation ? " rotate(" + (angular.isNumber(r.rotation) ? Math.round(r.rotation) + "deg" : r.rotation) + ")" : "" }, d = function (r, a) { a.style[t] = i(r) + c(r), a.style.opacity = r.opacity, r.custom && angular.extend(a.style, r.custom) }; return { scope: { y: "=", x: "=", rotation: "=", opacity: "=", custom: "=" }, link: function (r, n) { var t, e = n[0], l = !1, u = function () { var n = o.scrollTop(), i = e.getBoundingClientRect(); l || (l = !0, angular.element(a).on("load", function () { var r, a = 0, o = 10, n = i.top; do r = n, u(), n = e.getBoundingClientRect().top, a++; while (o > a && r !== n) })); var c = { scrollY: n, elemX: i.left, elemY: i.top }, s = { x: 0, y: 0, rotation: 0, opacity: 1, custom: void 0 }; for (var f in s) angular.isFunction(r[f]) ? s[f] = r[f](c) : r[f] && (s[f] = r[f]); var m = angular.isUndefined(t); if (!m) for (f in s) if (s[f] !== t[f]) { m = !0; break } m && (d(s, e), t = s) }; o.on("scroll touchmove", u).triggerHandler("scroll"), r.$on("$destroy", function () { o.off("scroll touchmove", u) }) } } } }]);
!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'Previous ',nextArrow:'Next ',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i(' ').text(t+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},i.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.focussed=!1,n.interrupted=!1,n.hidden="hidden",n.paused=!0,n.positionProp=null,n.respondTo=null,n.rowCount=1,n.shouldClick=!0,n.$slider=i(t),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.visibilityChange="visibilitychange",n.windowWidth=0,n.windowTimer=null,s=i(t).data("slick")||{},n.options=i.extend({},n.defaults,o,s),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,void 0!==document.mozHidden?(n.hidden="mozHidden",n.visibilityChange="mozvisibilitychange"):void 0!==document.webkitHidden&&(n.hidden="webkitHidden",n.visibilityChange="webkitvisibilitychange"),n.autoPlay=i.proxy(n.autoPlay,n),n.autoPlayClear=i.proxy(n.autoPlayClear,n),n.autoPlayIterator=i.proxy(n.autoPlayIterator,n),n.changeSlide=i.proxy(n.changeSlide,n),n.clickHandler=i.proxy(n.clickHandler,n),n.selectHandler=i.proxy(n.selectHandler,n),n.setPosition=i.proxy(n.setPosition,n),n.swipeHandler=i.proxy(n.swipeHandler,n),n.dragHandler=i.proxy(n.dragHandler,n),n.keyHandler=i.proxy(n.keyHandler,n),n.instanceUid=e++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.registerBreakpoints(),n.init(!0)}}()).prototype.activateADA=function(){this.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},e.prototype.addSlide=e.prototype.slickAdd=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(t<0||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):!0===o?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("data-slick-index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.animate({height:e},i.options.speed)}},e.prototype.animateSlide=function(e,t){var o={},s=this;s.animateHeight(),!0===s.options.rtl&&!1===s.options.vertical&&(e=-e),!1===s.transformsEnabled?!1===s.options.vertical?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.animate({top:e},s.options.speed,s.options.easing,t):!1===s.cssTransitions?(!0===s.options.rtl&&(s.currentLeft=-s.currentLeft),i({animStart:s.currentLeft}).animate({animStart:e},{duration:s.options.speed,easing:s.options.easing,step:function(i){i=Math.ceil(i),!1===s.options.vertical?(o[s.animType]="translate("+i+"px, 0px)",s.$slideTrack.css(o)):(o[s.animType]="translate(0px,"+i+"px)",s.$slideTrack.css(o))},complete:function(){t&&t.call()}})):(s.applyTransition(),e=Math.ceil(e),!1===s.options.vertical?o[s.animType]="translate3d("+e+"px, 0px, 0px)":o[s.animType]="translate3d(0px,"+e+"px, 0px)",s.$slideTrack.css(o),t&&setTimeout(function(){s.disableTransition(),t.call()},s.options.speed))},e.prototype.getNavTarget=function(){var e=this,t=e.options.asNavFor;return t&&null!==t&&(t=i(t).not(e.$slider)),t},e.prototype.asNavFor=function(e){var t=this.getNavTarget();null!==t&&"object"==typeof t&&t.each(function(){var t=i(this).slick("getSlick");t.unslicked||t.slideHandler(e,!0)})},e.prototype.applyTransition=function(i){var e=this,t={};!1===e.options.fade?t[e.transitionType]=e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:t[e.transitionType]="opacity "+e.options.speed+"ms "+e.options.cssEase,!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.autoPlay=function(){var i=this;i.autoPlayClear(),i.slideCount>i.options.slidesToShow&&(i.autoPlayTimer=setInterval(i.autoPlayIterator,i.options.autoplaySpeed))},e.prototype.autoPlayClear=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer)},e.prototype.autoPlayIterator=function(){var i=this,e=i.currentSlide+i.options.slidesToScroll;i.paused||i.interrupted||i.focussed||(!1===i.options.infinite&&(1===i.direction&&i.currentSlide+1===i.slideCount-1?i.direction=0:0===i.direction&&(e=i.currentSlide-i.options.slidesToScroll,i.currentSlide-1==0&&(i.direction=1))),i.slideHandler(e))},e.prototype.buildArrows=function(){var e=this;!0===e.options.arrows&&(e.$prevArrow=i(e.options.prevArrow).addClass("slick-arrow"),e.$nextArrow=i(e.options.nextArrow).addClass("slick-arrow"),e.slideCount>e.options.slidesToShow?(e.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.prependTo(e.options.appendArrows),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.appendTo(e.options.appendArrows),!0!==e.options.infinite&&e.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):e.$prevArrow.add(e.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},e.prototype.buildDots=function(){var e,t,o=this;if(!0===o.options.dots){for(o.$slider.addClass("slick-dotted"),t=i("").addClass(o.options.dotsClass),e=0;e<=o.getDotCount();e+=1)t.append(i(" ").append(o.options.customPaging.call(this,o,e)));o.$dots=t.appendTo(o.options.appendDots),o.$dots.find("li").first().addClass("slick-active")}},e.prototype.buildOut=function(){var e=this;e.$slides=e.$slider.children(e.options.slide+":not(.slick-cloned)").addClass("slick-slide"),e.slideCount=e.$slides.length,e.$slides.each(function(e,t){i(t).attr("data-slick-index",e).data("originalStyling",i(t).attr("style")||"")}),e.$slider.addClass("slick-slider"),e.$slideTrack=0===e.slideCount?i('
').appendTo(e.$slider):e.$slides.wrapAll('
').parent(),e.$list=e.$slideTrack.wrap('
').parent(),e.$slideTrack.css("opacity",0),!0!==e.options.centerMode&&!0!==e.options.swipeToSlide||(e.options.slidesToScroll=1),i("img[data-lazy]",e.$slider).not("[src]").addClass("slick-loading"),e.setupInfinite(),e.buildArrows(),e.buildDots(),e.updateDots(),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),!0===e.options.draggable&&e.$list.addClass("draggable")},e.prototype.buildRows=function(){var i,e,t,o,s,n,r,l=this;if(o=document.createDocumentFragment(),n=l.$slider.children(),l.options.rows>1){for(r=l.options.slidesPerRow*l.options.rows,s=Math.ceil(n.length/r),i=0;ir.breakpoints[o]&&(s=r.breakpoints[o]));null!==s?null!==r.activeBreakpoint?(s!==r.activeBreakpoint||t)&&(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):(r.activeBreakpoint=s,"unslick"===r.breakpointSettings[s]?r.unslick(s):(r.options=i.extend({},r.originalSettings,r.breakpointSettings[s]),!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e)),l=s):null!==r.activeBreakpoint&&(r.activeBreakpoint=null,r.options=r.originalSettings,!0===e&&(r.currentSlide=r.options.initialSlide),r.refresh(e),l=s),e||!1===l||r.$slider.trigger("breakpoint",[r,l])}},e.prototype.changeSlide=function(e,t){var o,s,n,r=this,l=i(e.currentTarget);switch(l.is("a")&&e.preventDefault(),l.is("li")||(l=l.closest("li")),n=r.slideCount%r.options.slidesToScroll!=0,o=n?0:(r.slideCount-r.currentSlide)%r.options.slidesToScroll,e.data.message){case"previous":s=0===o?r.options.slidesToScroll:r.options.slidesToShow-o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide-s,!1,t);break;case"next":s=0===o?r.options.slidesToScroll:o,r.slideCount>r.options.slidesToShow&&r.slideHandler(r.currentSlide+s,!1,t);break;case"index":var d=0===e.data.index?0:e.data.index||l.index()*r.options.slidesToScroll;r.slideHandler(r.checkNavigable(d),!1,t),l.children().trigger("focus");break;default:return}},e.prototype.checkNavigable=function(i){var e,t;if(e=this.getNavigableIndexes(),t=0,i>e[e.length-1])i=e[e.length-1];else for(var o in e){if(ie.options.slidesToShow&&(e.$prevArrow&&e.$prevArrow.off("click.slick",e.changeSlide),e.$nextArrow&&e.$nextArrow.off("click.slick",e.changeSlide),!0===e.options.accessibility&&(e.$prevArrow&&e.$prevArrow.off("keydown.slick",e.keyHandler),e.$nextArrow&&e.$nextArrow.off("keydown.slick",e.keyHandler))),e.$list.off("touchstart.slick mousedown.slick",e.swipeHandler),e.$list.off("touchmove.slick mousemove.slick",e.swipeHandler),e.$list.off("touchend.slick mouseup.slick",e.swipeHandler),e.$list.off("touchcancel.slick mouseleave.slick",e.swipeHandler),e.$list.off("click.slick",e.clickHandler),i(document).off(e.visibilityChange,e.visibility),e.cleanUpSlideEvents(),!0===e.options.accessibility&&e.$list.off("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().off("click.slick",e.selectHandler),i(window).off("orientationchange.slick.slick-"+e.instanceUid,e.orientationChange),i(window).off("resize.slick.slick-"+e.instanceUid,e.resize),i("[draggable!=true]",e.$slideTrack).off("dragstart",e.preventDefault),i(window).off("load.slick.slick-"+e.instanceUid,e.setPosition)},e.prototype.cleanUpSlideEvents=function(){var e=this;e.$list.off("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.off("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.cleanUpRows=function(){var i,e=this;e.options.rows>1&&((i=e.$slides.children().children()).removeAttr("style"),e.$slider.empty().append(i))},e.prototype.clickHandler=function(i){!1===this.shouldClick&&(i.stopImmediatePropagation(),i.stopPropagation(),i.preventDefault())},e.prototype.destroy=function(e){var t=this;t.autoPlayClear(),t.touchObject={},t.cleanUpEvents(),i(".slick-cloned",t.$slider).detach(),t.$dots&&t.$dots.remove(),t.$prevArrow&&t.$prevArrow.length&&(t.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.prevArrow)&&t.$prevArrow.remove()),t.$nextArrow&&t.$nextArrow.length&&(t.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),t.htmlExpr.test(t.options.nextArrow)&&t.$nextArrow.remove()),t.$slides&&(t.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){i(this).attr("style",i(this).data("originalStyling"))}),t.$slideTrack.children(this.options.slide).detach(),t.$slideTrack.detach(),t.$list.detach(),t.$slider.append(t.$slides)),t.cleanUpRows(),t.$slider.removeClass("slick-slider"),t.$slider.removeClass("slick-initialized"),t.$slider.removeClass("slick-dotted"),t.unslicked=!0,e||t.$slider.trigger("destroy",[t])},e.prototype.disableTransition=function(i){var e=this,t={};t[e.transitionType]="",!1===e.options.fade?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.fadeSlide=function(i,e){var t=this;!1===t.cssTransitions?(t.$slides.eq(i).css({zIndex:t.options.zIndex}),t.$slides.eq(i).animate({opacity:1},t.options.speed,t.options.easing,e)):(t.applyTransition(i),t.$slides.eq(i).css({opacity:1,zIndex:t.options.zIndex}),e&&setTimeout(function(){t.disableTransition(i),e.call()},t.options.speed))},e.prototype.fadeSlideOut=function(i){var e=this;!1===e.cssTransitions?e.$slides.eq(i).animate({opacity:0,zIndex:e.options.zIndex-2},e.options.speed,e.options.easing):(e.applyTransition(i),e.$slides.eq(i).css({opacity:0,zIndex:e.options.zIndex-2}))},e.prototype.filterSlides=e.prototype.slickFilter=function(i){var e=this;null!==i&&(e.$slidesCache=e.$slides,e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(i).appendTo(e.$slideTrack),e.reinit())},e.prototype.focusHandler=function(){var e=this;e.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick","*",function(t){t.stopImmediatePropagation();var o=i(this);setTimeout(function(){e.options.pauseOnFocus&&(e.focussed=o.is(":focus"),e.autoPlay())},0)})},e.prototype.getCurrent=e.prototype.slickCurrentSlide=function(){return this.currentSlide},e.prototype.getDotCount=function(){var i=this,e=0,t=0,o=0;if(!0===i.options.infinite)if(i.slideCount<=i.options.slidesToShow)++o;else for(;en.options.slidesToShow&&(n.slideOffset=n.slideWidth*n.options.slidesToShow*-1,s=-1,!0===n.options.vertical&&!0===n.options.centerMode&&(2===n.options.slidesToShow?s=-1.5:1===n.options.slidesToShow&&(s=-2)),r=t*n.options.slidesToShow*s),n.slideCount%n.options.slidesToScroll!=0&&i+n.options.slidesToScroll>n.slideCount&&n.slideCount>n.options.slidesToShow&&(i>n.slideCount?(n.slideOffset=(n.options.slidesToShow-(i-n.slideCount))*n.slideWidth*-1,r=(n.options.slidesToShow-(i-n.slideCount))*t*-1):(n.slideOffset=n.slideCount%n.options.slidesToScroll*n.slideWidth*-1,r=n.slideCount%n.options.slidesToScroll*t*-1))):i+n.options.slidesToShow>n.slideCount&&(n.slideOffset=(i+n.options.slidesToShow-n.slideCount)*n.slideWidth,r=(i+n.options.slidesToShow-n.slideCount)*t),n.slideCount<=n.options.slidesToShow&&(n.slideOffset=0,r=0),!0===n.options.centerMode&&n.slideCount<=n.options.slidesToShow?n.slideOffset=n.slideWidth*Math.floor(n.options.slidesToShow)/2-n.slideWidth*n.slideCount/2:!0===n.options.centerMode&&!0===n.options.infinite?n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)-n.slideWidth:!0===n.options.centerMode&&(n.slideOffset=0,n.slideOffset+=n.slideWidth*Math.floor(n.options.slidesToShow/2)),e=!1===n.options.vertical?i*n.slideWidth*-1+n.slideOffset:i*t*-1+r,!0===n.options.variableWidth&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,!0===n.options.centerMode&&(o=n.slideCount<=n.options.slidesToShow||!1===n.options.infinite?n.$slideTrack.children(".slick-slide").eq(i):n.$slideTrack.children(".slick-slide").eq(i+n.options.slidesToShow+1),e=!0===n.options.rtl?o[0]?-1*(n.$slideTrack.width()-o[0].offsetLeft-o.width()):0:o[0]?-1*o[0].offsetLeft:0,e+=(n.$list.width()-o.outerWidth())/2)),e},e.prototype.getOption=e.prototype.slickGetOption=function(i){return this.options[i]},e.prototype.getNavigableIndexes=function(){var i,e=this,t=0,o=0,s=[];for(!1===e.options.infinite?i=e.slideCount:(t=-1*e.options.slidesToScroll,o=-1*e.options.slidesToScroll,i=2*e.slideCount);t-1*o.swipeLeft)return e=n,!1}),Math.abs(i(e).attr("data-slick-index")-o.currentSlide)||1):o.options.slidesToScroll},e.prototype.goTo=e.prototype.slickGoTo=function(i,e){this.changeSlide({data:{message:"index",index:parseInt(i)}},e)},e.prototype.init=function(e){var t=this;i(t.$slider).hasClass("slick-initialized")||(i(t.$slider).addClass("slick-initialized"),t.buildRows(),t.buildOut(),t.setProps(),t.startLoad(),t.loadSlider(),t.initializeEvents(),t.updateArrows(),t.updateDots(),t.checkResponsive(!0),t.focusHandler()),e&&t.$slider.trigger("init",[t]),!0===t.options.accessibility&&t.initADA(),t.options.autoplay&&(t.paused=!1,t.autoPlay())},e.prototype.initADA=function(){var e=this,t=Math.ceil(e.slideCount/e.options.slidesToShow),o=e.getNavigableIndexes().filter(function(i){return i>=0&&ii.options.slidesToShow&&(i.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},i.changeSlide),i.$nextArrow.off("click.slick").on("click.slick",{message:"next"},i.changeSlide),!0===i.options.accessibility&&(i.$prevArrow.on("keydown.slick",i.keyHandler),i.$nextArrow.on("keydown.slick",i.keyHandler)))},e.prototype.initDotEvents=function(){var e=this;!0===e.options.dots&&(i("li",e.$dots).on("click.slick",{message:"index"},e.changeSlide),!0===e.options.accessibility&&e.$dots.on("keydown.slick",e.keyHandler)),!0===e.options.dots&&!0===e.options.pauseOnDotsHover&&i("li",e.$dots).on("mouseenter.slick",i.proxy(e.interrupt,e,!0)).on("mouseleave.slick",i.proxy(e.interrupt,e,!1))},e.prototype.initSlideEvents=function(){var e=this;e.options.pauseOnHover&&(e.$list.on("mouseenter.slick",i.proxy(e.interrupt,e,!0)),e.$list.on("mouseleave.slick",i.proxy(e.interrupt,e,!1)))},e.prototype.initializeEvents=function(){var e=this;e.initArrowEvents(),e.initDotEvents(),e.initSlideEvents(),e.$list.on("touchstart.slick mousedown.slick",{action:"start"},e.swipeHandler),e.$list.on("touchmove.slick mousemove.slick",{action:"move"},e.swipeHandler),e.$list.on("touchend.slick mouseup.slick",{action:"end"},e.swipeHandler),e.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},e.swipeHandler),e.$list.on("click.slick",e.clickHandler),i(document).on(e.visibilityChange,i.proxy(e.visibility,e)),!0===e.options.accessibility&&e.$list.on("keydown.slick",e.keyHandler),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),i(window).on("orientationchange.slick.slick-"+e.instanceUid,i.proxy(e.orientationChange,e)),i(window).on("resize.slick.slick-"+e.instanceUid,i.proxy(e.resize,e)),i("[draggable!=true]",e.$slideTrack).on("dragstart",e.preventDefault),i(window).on("load.slick.slick-"+e.instanceUid,e.setPosition),i(e.setPosition)},e.prototype.initUI=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.show(),i.$nextArrow.show()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.show()},e.prototype.keyHandler=function(i){var e=this;i.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===i.keyCode&&!0===e.options.accessibility?e.changeSlide({data:{message:!0===e.options.rtl?"next":"previous"}}):39===i.keyCode&&!0===e.options.accessibility&&e.changeSlide({data:{message:!0===e.options.rtl?"previous":"next"}}))},e.prototype.lazyLoad=function(){function e(e){i("img[data-lazy]",e).each(function(){var e=i(this),t=i(this).attr("data-lazy"),o=i(this).attr("data-srcset"),s=i(this).attr("data-sizes")||n.$slider.attr("data-sizes"),r=document.createElement("img");r.onload=function(){e.animate({opacity:0},100,function(){o&&(e.attr("srcset",o),s&&e.attr("sizes",s)),e.attr("src",t).animate({opacity:1},200,function(){e.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading")}),n.$slider.trigger("lazyLoaded",[n,e,t])})},r.onerror=function(){e.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),n.$slider.trigger("lazyLoadError",[n,e,t])},r.src=t})}var t,o,s,n=this;if(!0===n.options.centerMode?!0===n.options.infinite?s=(o=n.currentSlide+(n.options.slidesToShow/2+1))+n.options.slidesToShow+2:(o=Math.max(0,n.currentSlide-(n.options.slidesToShow/2+1)),s=n.options.slidesToShow/2+1+2+n.currentSlide):(o=n.options.infinite?n.options.slidesToShow+n.currentSlide:n.currentSlide,s=Math.ceil(o+n.options.slidesToShow),!0===n.options.fade&&(o>0&&o--,s<=n.slideCount&&s++)),t=n.$slider.find(".slick-slide").slice(o,s),"anticipated"===n.options.lazyLoad)for(var r=o-1,l=s,d=n.$slider.find(".slick-slide"),a=0;a=n.slideCount-n.options.slidesToShow?e(n.$slider.find(".slick-cloned").slice(0,n.options.slidesToShow)):0===n.currentSlide&&e(n.$slider.find(".slick-cloned").slice(-1*n.options.slidesToShow))},e.prototype.loadSlider=function(){var i=this;i.setPosition(),i.$slideTrack.css({opacity:1}),i.$slider.removeClass("slick-loading"),i.initUI(),"progressive"===i.options.lazyLoad&&i.progressiveLazyLoad()},e.prototype.next=e.prototype.slickNext=function(){this.changeSlide({data:{message:"next"}})},e.prototype.orientationChange=function(){var i=this;i.checkResponsive(),i.setPosition()},e.prototype.pause=e.prototype.slickPause=function(){var i=this;i.autoPlayClear(),i.paused=!0},e.prototype.play=e.prototype.slickPlay=function(){var i=this;i.autoPlay(),i.options.autoplay=!0,i.paused=!1,i.focussed=!1,i.interrupted=!1},e.prototype.postSlide=function(e){var t=this;t.unslicked||(t.$slider.trigger("afterChange",[t,e]),t.animating=!1,t.slideCount>t.options.slidesToShow&&t.setPosition(),t.swipeLeft=null,t.options.autoplay&&t.autoPlay(),!0===t.options.accessibility&&(t.initADA(),t.options.focusOnChange&&i(t.$slides.get(t.currentSlide)).attr("tabindex",0).focus()))},e.prototype.prev=e.prototype.slickPrev=function(){this.changeSlide({data:{message:"previous"}})},e.prototype.preventDefault=function(i){i.preventDefault()},e.prototype.progressiveLazyLoad=function(e){e=e||1;var t,o,s,n,r,l=this,d=i("img[data-lazy]",l.$slider);d.length?(t=d.first(),o=t.attr("data-lazy"),s=t.attr("data-srcset"),n=t.attr("data-sizes")||l.$slider.attr("data-sizes"),(r=document.createElement("img")).onload=function(){s&&(t.attr("srcset",s),n&&t.attr("sizes",n)),t.attr("src",o).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading"),!0===l.options.adaptiveHeight&&l.setPosition(),l.$slider.trigger("lazyLoaded",[l,t,o]),l.progressiveLazyLoad()},r.onerror=function(){e<3?setTimeout(function(){l.progressiveLazyLoad(e+1)},500):(t.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),l.$slider.trigger("lazyLoadError",[l,t,o]),l.progressiveLazyLoad())},r.src=o):l.$slider.trigger("allImagesLoaded",[l])},e.prototype.refresh=function(e){var t,o,s=this;o=s.slideCount-s.options.slidesToShow,!s.options.infinite&&s.currentSlide>o&&(s.currentSlide=o),s.slideCount<=s.options.slidesToShow&&(s.currentSlide=0),t=s.currentSlide,s.destroy(!0),i.extend(s,s.initials,{currentSlide:t}),s.init(),e||s.changeSlide({data:{message:"index",index:t}},!1)},e.prototype.registerBreakpoints=function(){var e,t,o,s=this,n=s.options.responsive||null;if("array"===i.type(n)&&n.length){s.respondTo=s.options.respondTo||"window";for(e in n)if(o=s.breakpoints.length-1,n.hasOwnProperty(e)){for(t=n[e].breakpoint;o>=0;)s.breakpoints[o]&&s.breakpoints[o]===t&&s.breakpoints.splice(o,1),o--;s.breakpoints.push(t),s.breakpointSettings[t]=n[e].settings}s.breakpoints.sort(function(i,e){return s.options.mobileFirst?i-e:e-i})}},e.prototype.reinit=function(){var e=this;e.$slides=e.$slideTrack.children(e.options.slide).addClass("slick-slide"),e.slideCount=e.$slides.length,e.currentSlide>=e.slideCount&&0!==e.currentSlide&&(e.currentSlide=e.currentSlide-e.options.slidesToScroll),e.slideCount<=e.options.slidesToShow&&(e.currentSlide=0),e.registerBreakpoints(),e.setProps(),e.setupInfinite(),e.buildArrows(),e.updateArrows(),e.initArrowEvents(),e.buildDots(),e.updateDots(),e.initDotEvents(),e.cleanUpSlideEvents(),e.initSlideEvents(),e.checkResponsive(!1,!0),!0===e.options.focusOnSelect&&i(e.$slideTrack).children().on("click.slick",e.selectHandler),e.setSlideClasses("number"==typeof e.currentSlide?e.currentSlide:0),e.setPosition(),e.focusHandler(),e.paused=!e.options.autoplay,e.autoPlay(),e.$slider.trigger("reInit",[e])},e.prototype.resize=function(){var e=this;i(window).width()!==e.windowWidth&&(clearTimeout(e.windowDelay),e.windowDelay=window.setTimeout(function(){e.windowWidth=i(window).width(),e.checkResponsive(),e.unslicked||e.setPosition()},50))},e.prototype.removeSlide=e.prototype.slickRemove=function(i,e,t){var o=this;if(i="boolean"==typeof i?!0===(e=i)?0:o.slideCount-1:!0===e?--i:i,o.slideCount<1||i<0||i>o.slideCount-1)return!1;o.unload(),!0===t?o.$slideTrack.children().remove():o.$slideTrack.children(this.options.slide).eq(i).remove(),o.$slides=o.$slideTrack.children(this.options.slide),o.$slideTrack.children(this.options.slide).detach(),o.$slideTrack.append(o.$slides),o.$slidesCache=o.$slides,o.reinit()},e.prototype.setCSS=function(i){var e,t,o=this,s={};!0===o.options.rtl&&(i=-i),e="left"==o.positionProp?Math.ceil(i)+"px":"0px",t="top"==o.positionProp?Math.ceil(i)+"px":"0px",s[o.positionProp]=i,!1===o.transformsEnabled?o.$slideTrack.css(s):(s={},!1===o.cssTransitions?(s[o.animType]="translate("+e+", "+t+")",o.$slideTrack.css(s)):(s[o.animType]="translate3d("+e+", "+t+", 0px)",o.$slideTrack.css(s)))},e.prototype.setDimensions=function(){var i=this;!1===i.options.vertical?!0===i.options.centerMode&&i.$list.css({padding:"0px "+i.options.centerPadding}):(i.$list.height(i.$slides.first().outerHeight(!0)*i.options.slidesToShow),!0===i.options.centerMode&&i.$list.css({padding:i.options.centerPadding+" 0px"})),i.listWidth=i.$list.width(),i.listHeight=i.$list.height(),!1===i.options.vertical&&!1===i.options.variableWidth?(i.slideWidth=Math.ceil(i.listWidth/i.options.slidesToShow),i.$slideTrack.width(Math.ceil(i.slideWidth*i.$slideTrack.children(".slick-slide").length))):!0===i.options.variableWidth?i.$slideTrack.width(5e3*i.slideCount):(i.slideWidth=Math.ceil(i.listWidth),i.$slideTrack.height(Math.ceil(i.$slides.first().outerHeight(!0)*i.$slideTrack.children(".slick-slide").length)));var e=i.$slides.first().outerWidth(!0)-i.$slides.first().width();!1===i.options.variableWidth&&i.$slideTrack.children(".slick-slide").width(i.slideWidth-e)},e.prototype.setFade=function(){var e,t=this;t.$slides.each(function(o,s){e=t.slideWidth*o*-1,!0===t.options.rtl?i(s).css({position:"relative",right:e,top:0,zIndex:t.options.zIndex-2,opacity:0}):i(s).css({position:"relative",left:e,top:0,zIndex:t.options.zIndex-2,opacity:0})}),t.$slides.eq(t.currentSlide).css({zIndex:t.options.zIndex-1,opacity:1})},e.prototype.setHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.css("height",e)}},e.prototype.setOption=e.prototype.slickSetOption=function(){var e,t,o,s,n,r=this,l=!1;if("object"===i.type(arguments[0])?(o=arguments[0],l=arguments[1],n="multiple"):"string"===i.type(arguments[0])&&(o=arguments[0],s=arguments[1],l=arguments[2],"responsive"===arguments[0]&&"array"===i.type(arguments[1])?n="responsive":void 0!==arguments[1]&&(n="single")),"single"===n)r.options[o]=s;else if("multiple"===n)i.each(o,function(i,e){r.options[i]=e});else if("responsive"===n)for(t in s)if("array"!==i.type(r.options.responsive))r.options.responsive=[s[t]];else{for(e=r.options.responsive.length-1;e>=0;)r.options.responsive[e].breakpoint===s[t].breakpoint&&r.options.responsive.splice(e,1),e--;r.options.responsive.push(s[t])}l&&(r.unload(),r.reinit())},e.prototype.setPosition=function(){var i=this;i.setDimensions(),i.setHeight(),!1===i.options.fade?i.setCSS(i.getLeft(i.currentSlide)):i.setFade(),i.$slider.trigger("setPosition",[i])},e.prototype.setProps=function(){var i=this,e=document.body.style;i.positionProp=!0===i.options.vertical?"top":"left","top"===i.positionProp?i.$slider.addClass("slick-vertical"):i.$slider.removeClass("slick-vertical"),void 0===e.WebkitTransition&&void 0===e.MozTransition&&void 0===e.msTransition||!0===i.options.useCSS&&(i.cssTransitions=!0),i.options.fade&&("number"==typeof i.options.zIndex?i.options.zIndex<3&&(i.options.zIndex=3):i.options.zIndex=i.defaults.zIndex),void 0!==e.OTransform&&(i.animType="OTransform",i.transformType="-o-transform",i.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.MozTransform&&(i.animType="MozTransform",i.transformType="-moz-transform",i.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(i.animType=!1)),void 0!==e.webkitTransform&&(i.animType="webkitTransform",i.transformType="-webkit-transform",i.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.msTransform&&(i.animType="msTransform",i.transformType="-ms-transform",i.transitionType="msTransition",void 0===e.msTransform&&(i.animType=!1)),void 0!==e.transform&&!1!==i.animType&&(i.animType="transform",i.transformType="transform",i.transitionType="transition"),i.transformsEnabled=i.options.useTransform&&null!==i.animType&&!1!==i.animType},e.prototype.setSlideClasses=function(i){var e,t,o,s,n=this;if(t=n.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),n.$slides.eq(i).addClass("slick-current"),!0===n.options.centerMode){var r=n.options.slidesToShow%2==0?1:0;e=Math.floor(n.options.slidesToShow/2),!0===n.options.infinite&&(i>=e&&i<=n.slideCount-1-e?n.$slides.slice(i-e+r,i+e+1).addClass("slick-active").attr("aria-hidden","false"):(o=n.options.slidesToShow+i,t.slice(o-e+1+r,o+e+2).addClass("slick-active").attr("aria-hidden","false")),0===i?t.eq(t.length-1-n.options.slidesToShow).addClass("slick-center"):i===n.slideCount-1&&t.eq(n.options.slidesToShow).addClass("slick-center")),n.$slides.eq(i).addClass("slick-center")}else i>=0&&i<=n.slideCount-n.options.slidesToShow?n.$slides.slice(i,i+n.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):t.length<=n.options.slidesToShow?t.addClass("slick-active").attr("aria-hidden","false"):(s=n.slideCount%n.options.slidesToShow,o=!0===n.options.infinite?n.options.slidesToShow+i:i,n.options.slidesToShow==n.options.slidesToScroll&&n.slideCount-is.options.slidesToShow)){for(o=!0===s.options.centerMode?s.options.slidesToShow+1:s.options.slidesToShow,e=s.slideCount;e>s.slideCount-o;e-=1)t=e-1,i(s.$slides[t]).clone(!0).attr("id","").attr("data-slick-index",t-s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned");for(e=0;ea.getDotCount()*a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else if(!1===a.options.infinite&&!0===a.options.centerMode&&(i<0||i>a.slideCount-a.options.slidesToScroll))!1===a.options.fade&&(o=a.currentSlide,!0!==t?a.animateSlide(r,function(){a.postSlide(o)}):a.postSlide(o));else{if(a.options.autoplay&&clearInterval(a.autoPlayTimer),s=o<0?a.slideCount%a.options.slidesToScroll!=0?a.slideCount-a.slideCount%a.options.slidesToScroll:a.slideCount+o:o>=a.slideCount?a.slideCount%a.options.slidesToScroll!=0?0:o-a.slideCount:o,a.animating=!0,a.$slider.trigger("beforeChange",[a,a.currentSlide,s]),n=a.currentSlide,a.currentSlide=s,a.setSlideClasses(a.currentSlide),a.options.asNavFor&&(l=(l=a.getNavTarget()).slick("getSlick")).slideCount<=l.options.slidesToShow&&l.setSlideClasses(a.currentSlide),a.updateDots(),a.updateArrows(),!0===a.options.fade)return!0!==t?(a.fadeSlideOut(n),a.fadeSlide(s,function(){a.postSlide(s)})):a.postSlide(s),void a.animateHeight();!0!==t?a.animateSlide(d,function(){a.postSlide(s)}):a.postSlide(s)}},e.prototype.startLoad=function(){var i=this;!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.hide(),i.$nextArrow.hide()),!0===i.options.dots&&i.slideCount>i.options.slidesToShow&&i.$dots.hide(),i.$slider.addClass("slick-loading")},e.prototype.swipeDirection=function(){var i,e,t,o,s=this;return i=s.touchObject.startX-s.touchObject.curX,e=s.touchObject.startY-s.touchObject.curY,t=Math.atan2(e,i),(o=Math.round(180*t/Math.PI))<0&&(o=360-Math.abs(o)),o<=45&&o>=0?!1===s.options.rtl?"left":"right":o<=360&&o>=315?!1===s.options.rtl?"left":"right":o>=135&&o<=225?!1===s.options.rtl?"right":"left":!0===s.options.verticalSwiping?o>=35&&o<=135?"down":"up":"vertical"},e.prototype.swipeEnd=function(i){var e,t,o=this;if(o.dragging=!1,o.swiping=!1,o.scrolling)return o.scrolling=!1,!1;if(o.interrupted=!1,o.shouldClick=!(o.touchObject.swipeLength>10),void 0===o.touchObject.curX)return!1;if(!0===o.touchObject.edgeHit&&o.$slider.trigger("edge",[o,o.swipeDirection()]),o.touchObject.swipeLength>=o.touchObject.minSwipe){switch(t=o.swipeDirection()){case"left":case"down":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide+o.getSlideCount()):o.currentSlide+o.getSlideCount(),o.currentDirection=0;break;case"right":case"up":e=o.options.swipeToSlide?o.checkNavigable(o.currentSlide-o.getSlideCount()):o.currentSlide-o.getSlideCount(),o.currentDirection=1}"vertical"!=t&&(o.slideHandler(e),o.touchObject={},o.$slider.trigger("swipe",[o,t]))}else o.touchObject.startX!==o.touchObject.curX&&(o.slideHandler(o.currentSlide),o.touchObject={})},e.prototype.swipeHandler=function(i){var e=this;if(!(!1===e.options.swipe||"ontouchend"in document&&!1===e.options.swipe||!1===e.options.draggable&&-1!==i.type.indexOf("mouse")))switch(e.touchObject.fingerCount=i.originalEvent&&void 0!==i.originalEvent.touches?i.originalEvent.touches.length:1,e.touchObject.minSwipe=e.listWidth/e.options.touchThreshold,!0===e.options.verticalSwiping&&(e.touchObject.minSwipe=e.listHeight/e.options.touchThreshold),i.data.action){case"start":e.swipeStart(i);break;case"move":e.swipeMove(i);break;case"end":e.swipeEnd(i)}},e.prototype.swipeMove=function(i){var e,t,o,s,n,r,l=this;return n=void 0!==i.originalEvent?i.originalEvent.touches:null,!(!l.dragging||l.scrolling||n&&1!==n.length)&&(e=l.getLeft(l.currentSlide),l.touchObject.curX=void 0!==n?n[0].pageX:i.clientX,l.touchObject.curY=void 0!==n?n[0].pageY:i.clientY,l.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(l.touchObject.curX-l.touchObject.startX,2))),r=Math.round(Math.sqrt(Math.pow(l.touchObject.curY-l.touchObject.startY,2))),!l.options.verticalSwiping&&!l.swiping&&r>4?(l.scrolling=!0,!1):(!0===l.options.verticalSwiping&&(l.touchObject.swipeLength=r),t=l.swipeDirection(),void 0!==i.originalEvent&&l.touchObject.swipeLength>4&&(l.swiping=!0,i.preventDefault()),s=(!1===l.options.rtl?1:-1)*(l.touchObject.curX>l.touchObject.startX?1:-1),!0===l.options.verticalSwiping&&(s=l.touchObject.curY>l.touchObject.startY?1:-1),o=l.touchObject.swipeLength,l.touchObject.edgeHit=!1,!1===l.options.infinite&&(0===l.currentSlide&&"right"===t||l.currentSlide>=l.getDotCount()&&"left"===t)&&(o=l.touchObject.swipeLength*l.options.edgeFriction,l.touchObject.edgeHit=!0),!1===l.options.vertical?l.swipeLeft=e+o*s:l.swipeLeft=e+o*(l.$list.height()/l.listWidth)*s,!0===l.options.verticalSwiping&&(l.swipeLeft=e+o*s),!0!==l.options.fade&&!1!==l.options.touchMove&&(!0===l.animating?(l.swipeLeft=null,!1):void l.setCSS(l.swipeLeft))))},e.prototype.swipeStart=function(i){var e,t=this;if(t.interrupted=!0,1!==t.touchObject.fingerCount||t.slideCount<=t.options.slidesToShow)return t.touchObject={},!1;void 0!==i.originalEvent&&void 0!==i.originalEvent.touches&&(e=i.originalEvent.touches[0]),t.touchObject.startX=t.touchObject.curX=void 0!==e?e.pageX:i.clientX,t.touchObject.startY=t.touchObject.curY=void 0!==e?e.pageY:i.clientY,t.dragging=!0},e.prototype.unfilterSlides=e.prototype.slickUnfilter=function(){var i=this;null!==i.$slidesCache&&(i.unload(),i.$slideTrack.children(this.options.slide).detach(),i.$slidesCache.appendTo(i.$slideTrack),i.reinit())},e.prototype.unload=function(){var e=this;i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.remove(),e.$nextArrow&&e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.remove(),e.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")},e.prototype.unslick=function(i){var e=this;e.$slider.trigger("unslick",[e,i]),e.destroy()},e.prototype.updateArrows=function(){var i=this;Math.floor(i.options.slidesToShow/2),!0===i.options.arrows&&i.slideCount>i.options.slidesToShow&&!i.options.infinite&&(i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===i.currentSlide?(i.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-i.options.slidesToShow&&!1===i.options.centerMode?(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):i.currentSlide>=i.slideCount-1&&!0===i.options.centerMode&&(i.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),i.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},e.prototype.updateDots=function(){var i=this;null!==i.$dots&&(i.$dots.find("li").removeClass("slick-active").end(),i.$dots.find("li").eq(Math.floor(i.currentSlide/i.options.slidesToScroll)).addClass("slick-active"))},e.prototype.visibility=function(){var i=this;i.options.autoplay&&(document[i.hidden]?i.interrupted=!0:i.interrupted=!1)},i.fn.slick=function(){var i,t,o=this,s=arguments[0],n=Array.prototype.slice.call(arguments,1),r=o.length;for(i=0;i
* https://github.com/devmark/angular-slick-carousel
* Version: 3.1.7 - 2016-08-04T06:17:55.528Z
* License: MIT
*/
"use strict";angular.module("slickCarousel",[]).constant("slickCarouselConfig",{method:{},event:{}}).directive("slick",["$timeout","slickCarouselConfig",function(e,n){var i,t;return i=["slickGoTo","slickNext","slickPrev","slickPause","slickPlay","slickAdd","slickRemove","slickFilter","slickUnfilter","unslick"],t=["afterChange","beforeChange","breakpoint","destroy","edge","init","reInit","setPosition","swipe","lazyLoaded","lazyLoadError"],{scope:{settings:"=",enabled:"@",accessibility:"@",adaptiveHeight:"@",autoplay:"@",autoplaySpeed:"@",arrows:"@",asNavFor:"@",appendArrows:"@",prevArrow:"@",nextArrow:"@",centerMode:"@",centerPadding:"@",cssEase:"@",customPaging:"&",dots:"@",draggable:"@",fade:"@",focusOnSelect:"@",easing:"@",edgeFriction:"@",infinite:"@",initialSlide:"@",lazyLoad:"@",mobileFirst:"@",pauseOnHover:"@",pauseOnDotsHover:"@",respondTo:"@",responsive:"=?",rows:"@",slide:"@",slidesPerRow:"@",slidesToShow:"@",slidesToScroll:"@",speed:"@",swipe:"@",swipeToSlide:"@",touchMove:"@",touchThreshold:"@",useCSS:"@",variableWidth:"@",vertical:"@",verticalSwiping:"@",rtl:"@"},restrict:"AE",link:function(t,o,a){angular.element(o).css("display","none");var r,s,l,d,u,c;return s=function(){r=angular.extend(angular.copy(n),{enabled:"false"!==t.enabled,accessibility:"false"!==t.accessibility,adaptiveHeight:"true"===t.adaptiveHeight,autoplay:"true"===t.autoplay,autoplaySpeed:null!=t.autoplaySpeed?parseInt(t.autoplaySpeed,10):3e3,arrows:"false"!==t.arrows,asNavFor:t.asNavFor?t.asNavFor:void 0,appendArrows:angular.element(t.appendArrows?t.appendArrows:o),prevArrow:t.prevArrow?angular.element(t.prevArrow):void 0,nextArrow:t.nextArrow?angular.element(t.nextArrow):void 0,centerMode:"true"===t.centerMode,centerPadding:t.centerPadding||"50px",cssEase:t.cssEase||"ease",customPaging:a.customPaging?function(e,n){return t.customPaging({slick:e,index:n})}:void 0,dots:"true"===t.dots,draggable:"false"!==t.draggable,fade:"true"===t.fade,focusOnSelect:"true"===t.focusOnSelect,easing:t.easing||"linear",edgeFriction:t.edgeFriction||.15,infinite:"false"!==t.infinite,initialSlide:parseInt(t.initialSlide)||0,lazyLoad:t.lazyLoad||"ondemand",mobileFirst:"true"===t.mobileFirst,pauseOnHover:"false"!==t.pauseOnHover,pauseOnDotsHover:"true"===t.pauseOnDotsHover,respondTo:null!=t.respondTo?t.respondTo:"window",responsive:t.responsive||void 0,rows:null!=t.rows?parseInt(t.rows,10):1,slide:t.slide||"",slidesPerRow:null!=t.slidesPerRow?parseInt(t.slidesPerRow,10):1,slidesToShow:null!=t.slidesToShow?parseInt(t.slidesToShow,10):1,slidesToScroll:null!=t.slidesToScroll?parseInt(t.slidesToScroll,10):1,speed:null!=t.speed?parseInt(t.speed,10):300,swipe:"false"!==t.swipe,swipeToSlide:"true"===t.swipeToSlide,touchMove:"false"!==t.touchMove,touchThreshold:t.touchThreshold?parseInt(t.touchThreshold,10):5,useCSS:"false"!==t.useCSS,variableWidth:"true"===t.variableWidth,vertical:"true"===t.vertical,verticalSwiping:"true"===t.verticalSwiping,rtl:"true"===t.rtl},t.settings)},l=function(){var e=angular.element(o);return e.hasClass("slick-initialized")&&(e.remove("slick-list"),e.slick("unslick")),e},d=function(){s();var n=angular.element(o);if(angular.element(o).hasClass("slick-initialized")){if(r.enabled)return n.slick("getSlick");l()}else{if(!r.enabled)return;n.on("init",function(e,n){return"undefined"!=typeof r.event.init&&r.event.init(e,n),"undefined"!=typeof c?n.slideHandler(c):void 0}),e(function(){angular.element(o).css("display","block"),n.not(".slick-initialized").slick(r)})}t.internalControl=r.method||{},i.forEach(function(e){t.internalControl[e]=function(){var i;i=Array.prototype.slice.call(arguments),i.unshift(e),n.slick.apply(o,i)}}),n.on("afterChange",function(n,i,o){c=o,"undefined"!=typeof r.event.afterChange&&e(function(){t.$apply(function(){r.event.afterChange(n,i,o)})})}),n.on("beforeChange",function(n,i,o,a){"undefined"!=typeof r.event.beforeChange&&e(function(){e(function(){t.$apply(function(){r.event.beforeChange(n,i,o,a)})})})}),n.on("reInit",function(n,i){"undefined"!=typeof r.event.reInit&&e(function(){t.$apply(function(){r.event.reInit(n,i)})})}),"undefined"!=typeof r.event.breakpoint&&n.on("breakpoint",function(n,i,o){e(function(){t.$apply(function(){r.event.breakpoint(n,i,o)})})}),"undefined"!=typeof r.event.destroy&&n.on("destroy",function(n,i){e(function(){t.$apply(function(){r.event.destroy(n,i)})})}),"undefined"!=typeof r.event.edge&&n.on("edge",function(n,i,o){e(function(){t.$apply(function(){r.event.edge(n,i,o)})})}),"undefined"!=typeof r.event.setPosition&&n.on("setPosition",function(n,i){e(function(){t.$apply(function(){r.event.setPosition(n,i)})})}),"undefined"!=typeof r.event.swipe&&n.on("swipe",function(n,i,o){e(function(){t.$apply(function(){r.event.swipe(n,i,o)})})}),"undefined"!=typeof r.event.lazyLoaded&&n.on("lazyLoaded",function(n,i,o,a){e(function(){t.$apply(function(){r.event.lazyLoaded(n,i,o,a)})})}),"undefined"!=typeof r.event.lazyLoadError&&n.on("lazyLoadError",function(n,i,o,a){e(function(){t.$apply(function(){r.event.lazyLoadError(n,i,o,a)})})})},u=function(){l(),d()},o.one("$destroy",function(){l()}),t.$watch("settings",function(e,n){return null!==e?u():void 0},!0)}}}]);
/*! angularjs-slider - v6.1.1 - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - 2017-03-29 */
!function(a,b){"use strict";if("function"==typeof define&&define.amd)define(["angular"],b);else if("object"==typeof module&&module.exports){var c=angular||require("angular");c&&c.module||"undefined"==typeof angular||(c=angular),module.exports=b(c)}else b(a.angular)}(this,function(a){"use strict";var b=a.module("rzModule",[]).factory("RzSliderOptions",function(){var b={floor:0,ceil:null,step:1,precision:0,minRange:null,maxRange:null,pushRange:!1,minLimit:null,maxLimit:null,id:null,translate:null,getLegend:null,stepsArray:null,bindIndexForStepsArray:!1,draggableRange:!1,draggableRangeOnly:!1,showSelectionBar:!1,showSelectionBarEnd:!1,showSelectionBarFromValue:null,hidePointerLabels:!1,hideLimitLabels:!1,autoHideLimitLabels:!0,readOnly:!1,disabled:!1,interval:350,showTicks:!1,showTicksValues:!1,ticksArray:null,ticksTooltip:null,ticksValuesTooltip:null,vertical:!1,getSelectionBarColor:null,getTickColor:null,getPointerColor:null,keyboardSupport:!0,scale:1,enforceStep:!0,enforceRange:!1,noSwitching:!1,onlyBindHandles:!1,onStart:null,onChange:null,onEnd:null,rightToLeft:!1,boundPointerLabels:!0,mergeRangeLabelsIfSame:!1,customTemplateScope:null,logScale:!1,customValueToPosition:null,customPositionToValue:null,selectionBarGradient:null,ariaLabel:null,ariaLabelledBy:null,ariaLabelHigh:null,ariaLabelledByHigh:null},c={},d={};return d.options=function(b){a.extend(c,b)},d.getOptions=function(d){return a.extend({},b,c,d)},d}).factory("rzThrottle",["$timeout",function(a){return function(b,c,d){var e,f,g,h=Date.now||function(){return(new Date).getTime()},i=null,j=0;d=d||{};var k=function(){j=h(),i=null,g=b.apply(e,f),e=f=null};return function(){var l=h(),m=c-(l-j);return e=this,f=arguments,0>=m?(a.cancel(i),i=null,j=l,g=b.apply(e,f),e=f=null):i||d.trailing===!1||(i=a(k,m)),g}}}]).factory("RzSlider",["$timeout","$document","$window","$compile","RzSliderOptions","rzThrottle",function(b,c,d,e,f,g){var h=function(a,b){this.scope=a,this.lowValue=0,this.highValue=0,this.sliderElem=b,this.range=void 0!==this.scope.rzSliderModel&&void 0!==this.scope.rzSliderHigh,this.dragging={active:!1,value:0,difference:0,position:0,lowLimit:0,highLimit:0},this.positionProperty="left",this.dimensionProperty="width",this.handleHalfDim=0,this.maxPos=0,this.precision=0,this.step=1,this.tracking="",this.minValue=0,this.maxValue=0,this.valueRange=0,this.intermediateTicks=!1,this.initHasRun=!1,this.firstKeyDown=!1,this.internalChange=!1,this.cmbLabelShown=!1,this.currentFocusElement=null,this.fullBar=null,this.selBar=null,this.minH=null,this.maxH=null,this.flrLab=null,this.ceilLab=null,this.minLab=null,this.maxLab=null,this.cmbLab=null,this.ticks=null,this.init()};return h.prototype={init:function(){var b,c,e=this,f=function(){e.calcViewDimensions()};this.applyOptions(),this.syncLowValue(),this.range&&this.syncHighValue(),this.initElemHandles(),this.manageElementsStyle(),this.setDisabledState(),this.calcViewDimensions(),this.setMinAndMax(),this.addAccessibility(),this.updateCeilLab(),this.updateFloorLab(),this.initHandles(),this.manageEventsBindings(),this.scope.$on("reCalcViewDimensions",f),a.element(d).on("resize",f),this.initHasRun=!0,b=g(function(){e.onLowHandleChange()},e.options.interval),c=g(function(){e.onHighHandleChange()},e.options.interval),this.scope.$on("rzSliderForceRender",function(){e.resetLabelsValue(),b(),e.range&&c(),e.resetSlider()}),this.scope.$watch("rzSliderOptions()",function(a,b){a!==b&&(e.applyOptions(),e.syncLowValue(),e.range&&e.syncHighValue(),e.resetSlider())},!0),this.scope.$watch("rzSliderModel",function(a,c){e.internalChange||a!==c&&b()}),this.scope.$watch("rzSliderHigh",function(a,b){e.internalChange||a!==b&&(null!=a&&c(),(e.range&&null==a||!e.range&&null!=a)&&(e.applyOptions(),e.resetSlider()))}),this.scope.$on("$destroy",function(){e.unbindEvents(),a.element(d).off("resize",f),e.currentFocusElement=null})},findStepIndex:function(b){for(var c=0,d=0;d0&&0===b.rzsd)&&(f=!0,b.rzsv=e),g||b.html(e),this.scope[c+"Label"]=e,f&&this.getDimension(b)},setMinAndMax:function(){if(this.step=+this.options.step,this.precision=+this.options.precision,this.minValue=this.options.floor,this.options.logScale&&0===this.minValue)throw Error("Can't use floor=0 with logarithmic scale");this.options.enforceStep&&(this.lowValue=this.roundStep(this.lowValue),this.range&&(this.highValue=this.roundStep(this.highValue))),null!=this.options.ceil?this.maxValue=this.options.ceil:this.maxValue=this.options.ceil=this.range?this.highValue:this.lowValue,this.options.enforceRange&&(this.lowValue=this.sanitizeValue(this.lowValue),this.range&&(this.highValue=this.sanitizeValue(this.highValue))),this.applyLowValue(),this.range&&this.applyHighValue(),this.valueRange=this.maxValue-this.minValue},addAccessibility:function(){this.minH.attr("role","slider"),this.updateAriaAttributes(),!this.options.keyboardSupport||this.options.readOnly||this.options.disabled?this.minH.attr("tabindex",""):this.minH.attr("tabindex","0"),this.options.vertical&&this.minH.attr("aria-orientation","vertical"),this.options.ariaLabel?this.minH.attr("aria-label",this.options.ariaLabel):this.options.ariaLabelledBy&&this.minH.attr("aria-labelledby",this.options.ariaLabelledBy),this.range&&(this.maxH.attr("role","slider"),!this.options.keyboardSupport||this.options.readOnly||this.options.disabled?this.maxH.attr("tabindex",""):this.maxH.attr("tabindex","0"),this.options.vertical&&this.maxH.attr("aria-orientation","vertical"),this.options.ariaLabelHigh?this.maxH.attr("aria-label",this.options.ariaLabelHigh):this.options.ariaLabelledByHigh&&this.maxH.attr("aria-labelledby",this.options.ariaLabelledByHigh))},updateAriaAttributes:function(){this.minH.attr({"aria-valuenow":this.scope.rzSliderModel,"aria-valuetext":this.customTrFn(this.scope.rzSliderModel,this.options.id,"model"),"aria-valuemin":this.minValue,"aria-valuemax":this.maxValue}),this.range&&this.maxH.attr({"aria-valuenow":this.scope.rzSliderHigh,"aria-valuetext":this.customTrFn(this.scope.rzSliderHigh,this.options.id,"high"),"aria-valuemin":this.minValue,"aria-valuemax":this.maxValue})},calcViewDimensions:function(){var a=this.getDimension(this.minH);if(this.handleHalfDim=a/2,this.barDimension=this.getDimension(this.fullBar),this.maxPos=this.barDimension-a,this.getDimension(this.sliderElem),this.sliderElem.rzsp=this.sliderElem[0].getBoundingClientRect()[this.positionProperty],this.initHasRun){this.updateFloorLab(),this.updateCeilLab(),this.initHandles();var c=this;b(function(){c.updateTicksScale()})}},updateTicksScale:function(){if(this.options.showTicks){var a=this.options.ticksArray||this.getTicksArray(),b=this.options.vertical?"translateY":"translateX",c=this;this.options.rightToLeft&&a.reverse(),this.scope.ticks=a.map(function(a){var d=c.valueToPosition(a);c.options.vertical&&(d=c.maxPos-d);var e=b+"("+Math.round(d)+"px)",f={selected:c.isTickSelected(a),style:{"-webkit-transform":e,"-moz-transform":e,"-o-transform":e,"-ms-transform":e,transform:e}};if(f.selected&&c.options.getSelectionBarColor&&(f.style["background-color"]=c.getSelectionBarColor()),!f.selected&&c.options.getTickColor&&(f.style["background-color"]=c.getTickColor(a)),c.options.ticksTooltip&&(f.tooltip=c.options.ticksTooltip(a),f.tooltipPlacement=c.options.vertical?"right":"top"),c.options.showTicksValues&&(f.value=c.getDisplayValue(a,"tick-value"),c.options.ticksValuesTooltip&&(f.valueTooltip=c.options.ticksValuesTooltip(a),f.valueTooltipPlacement=c.options.vertical?"right":"top")),c.getLegend){var g=c.getLegend(a,c.options.id);g&&(f.legend=g)}return f})}},getTicksArray:function(){var a=this.step,b=[];this.intermediateTicks&&(a=this.options.showTicks);for(var c=this.minValue;c<=this.maxValue;c+=a)b.push(c);return b},isTickSelected:function(a){if(!this.range)if(null!==this.options.showSelectionBarFromValue){var b=this.options.showSelectionBarFromValue;if(this.lowValue>b&&a>=b&&a<=this.lowValue)return!0;if(this.lowValue=a&&a>=this.lowValue)return!0}else if(this.options.showSelectionBarEnd){if(a>=this.lowValue)return!0}else if(this.options.showSelectionBar&&a<=this.lowValue)return!0;return this.range&&a>=this.lowValue&&a<=this.highValue?!0:!1},updateFloorLab:function(){this.translateFn(this.minValue,this.flrLab,"floor"),this.getDimension(this.flrLab);var a=this.options.rightToLeft?this.barDimension-this.flrLab.rzsd:0;this.setPosition(this.flrLab,a)},updateCeilLab:function(){this.translateFn(this.maxValue,this.ceilLab,"ceil"),this.getDimension(this.ceilLab);var a=this.options.rightToLeft?0:this.barDimension-this.ceilLab.rzsd;this.setPosition(this.ceilLab,a)},updateHandles:function(a,b){"lowValue"===a?this.updateLowHandle(b):this.updateHighHandle(b),this.updateSelectionBar(),this.updateTicksScale(),this.range&&this.updateCmbLabel()},getHandleLabelPos:function(a,b){var c=this[a].rzsd,d=b-c/2+this.handleHalfDim,e=this.barDimension-c;return this.options.boundPointerLabels?this.options.rightToLeft&&"minLab"===a||!this.options.rightToLeft&&"maxLab"===a?Math.min(d,e):Math.min(Math.max(d,0),e):d},updateLowHandle:function(a){if(this.setPosition(this.minH,a),this.translateFn(this.lowValue,this.minLab,"model"),this.setPosition(this.minLab,this.getHandleLabelPos("minLab",a)),this.options.getPointerColor){var b=this.getPointerColor("min");this.scope.minPointerStyle={backgroundColor:b}}this.options.autoHideLimitLabels&&this.shFloorCeil()},updateHighHandle:function(a){if(this.setPosition(this.maxH,a),this.translateFn(this.highValue,this.maxLab,"high"),this.setPosition(this.maxLab,this.getHandleLabelPos("maxLab",a)),this.options.getPointerColor){var b=this.getPointerColor("max");this.scope.maxPointerStyle={backgroundColor:b}}this.options.autoHideLimitLabels&&this.shFloorCeil()},shFloorCeil:function(){if(!this.options.hidePointerLabels){var a=!1,b=!1,c=this.isLabelBelowFloorLab(this.minLab),d=this.isLabelAboveCeilLab(this.minLab),e=this.isLabelAboveCeilLab(this.maxLab),f=this.isLabelBelowFloorLab(this.cmbLab),g=this.isLabelAboveCeilLab(this.cmbLab);if(c?(a=!0,this.hideEl(this.flrLab)):(a=!1,this.showEl(this.flrLab)),d?(b=!0,this.hideEl(this.ceilLab)):(b=!1,this.showEl(this.ceilLab)),this.range){var h=this.cmbLabelShown?g:e,i=this.cmbLabelShown?f:c;h?this.hideEl(this.ceilLab):b||this.showEl(this.ceilLab),i?this.hideEl(this.flrLab):a||this.showEl(this.flrLab)}}},isLabelBelowFloorLab:function(a){var b=this.options.rightToLeft,c=a.rzsp,d=a.rzsd,e=this.flrLab.rzsp,f=this.flrLab.rzsd;return b?c+d>=e-2:e+f+2>=c},isLabelAboveCeilLab:function(a){var b=this.options.rightToLeft,c=a.rzsp,d=a.rzsd,e=this.ceilLab.rzsp,f=this.ceilLab.rzsd;return b?e+f+2>=c:c+d>=e-2},updateSelectionBar:function(){var a=0,b=0,c=this.options.rightToLeft?!this.options.showSelectionBarEnd:this.options.showSelectionBarEnd,d=this.options.rightToLeft?this.maxH.rzsp+this.handleHalfDim:this.minH.rzsp+this.handleHalfDim;if(this.range)b=Math.abs(this.maxH.rzsp-this.minH.rzsp),a=d;else if(null!==this.options.showSelectionBarFromValue){var e=this.options.showSelectionBarFromValue,f=this.valueToPosition(e),g=this.options.rightToLeft?this.lowValue<=e:this.lowValue>e;g?(b=this.minH.rzsp-f,a=f+this.handleHalfDim):(b=f-this.minH.rzsp,a=this.minH.rzsp+this.handleHalfDim)}else c?(b=Math.abs(this.maxPos-this.minH.rzsp)+this.handleHalfDim,a=this.minH.rzsp+this.handleHalfDim):(b=Math.abs(this.maxH.rzsp-this.minH.rzsp)+this.handleHalfDim,a=0);if(this.setDimension(this.selBar,b),this.setPosition(this.selBar,a),this.options.getSelectionBarColor){var h=this.getSelectionBarColor();this.scope.barStyle={backgroundColor:h}}else if(this.options.selectionBarGradient){var i=null!==this.options.showSelectionBarFromValue?this.valueToPosition(this.options.showSelectionBarFromValue):0,j=i-a>0^c,k=this.options.vertical?j?"bottom":"top":j?"left":"right";this.scope.barStyle={backgroundImage:"linear-gradient(to "+k+", "+this.options.selectionBarGradient.from+" 0%,"+this.options.selectionBarGradient.to+" 100%)"},this.options.vertical?(this.scope.barStyle.backgroundPosition="center "+(i+b+a+(j?-this.handleHalfDim:0))+"px",this.scope.barStyle.backgroundSize="100% "+(this.barDimension-this.handleHalfDim)+"px"):(this.scope.barStyle.backgroundPosition=i-a+(j?this.handleHalfDim:0)+"px center",this.scope.barStyle.backgroundSize=this.barDimension-this.handleHalfDim+"px 100%")}},getSelectionBarColor:function(){return this.range?this.options.getSelectionBarColor(this.scope.rzSliderModel,this.scope.rzSliderHigh):this.options.getSelectionBarColor(this.scope.rzSliderModel)},getPointerColor:function(a){return"max"===a?this.options.getPointerColor(this.scope.rzSliderHigh,a):this.options.getPointerColor(this.scope.rzSliderModel,a)},getTickColor:function(a){return this.options.getTickColor(a)},updateCmbLabel:function(){var a=null;if(a=this.options.rightToLeft?this.minLab.rzsp-this.minLab.rzsd-10<=this.maxLab.rzsp:this.minLab.rzsp+this.minLab.rzsd+10>=this.maxLab.rzsp){var b=this.getDisplayValue(this.lowValue,"model"),c=this.getDisplayValue(this.highValue,"high"),d="";d=this.options.mergeRangeLabelsIfSame&&b===c?b:this.options.rightToLeft?c+" - "+b:b+" - "+c,this.translateFn(d,this.cmbLab,"cmb",!1);var e=this.options.boundPointerLabels?Math.min(Math.max(this.selBar.rzsp+this.selBar.rzsd/2-this.cmbLab.rzsd/2,0),this.barDimension-this.cmbLab.rzsd):this.selBar.rzsp+this.selBar.rzsd/2-this.cmbLab.rzsd/2;this.setPosition(this.cmbLab,e),this.cmbLabelShown=!0,this.hideEl(this.minLab),this.hideEl(this.maxLab),this.showEl(this.cmbLab)}else this.cmbLabelShown=!1,this.updateHighHandle(this.valueToPosition(this.highValue)),this.updateLowHandle(this.valueToPosition(this.lowValue)),this.showEl(this.maxLab),this.showEl(this.minLab),this.hideEl(this.cmbLab);this.options.autoHideLimitLabels&&this.shFloorCeil()},getDisplayValue:function(a,b){return this.options.stepsArray&&!this.options.bindIndexForStepsArray&&(a=this.getStepValue(a)),this.customTrFn(a,this.options.id,b)},roundStep:function(a,b){var c=b?b:this.step,d=parseFloat((a-this.minValue)/c).toPrecision(12);d=Math.round(+d)*c;var e=(this.minValue+d).toFixed(this.precision);return+e},hideEl:function(a){return a.css({visibility:"hidden"})},showEl:function(a){return a.rzAlwaysHide?a:a.css({visibility:"visible"})},setPosition:function(a,b){a.rzsp=b;var c={};return c[this.positionProperty]=Math.round(b)+"px",a.css(c),b},getDimension:function(a){var b=a[0].getBoundingClientRect();return this.options.vertical?a.rzsd=(b.bottom-b.top)*this.options.scale:a.rzsd=(b.right-b.left)*this.options.scale,a.rzsd},setDimension:function(a,b){a.rzsd=b;var c={};return c[this.dimensionProperty]=Math.round(b)+"px",a.css(c),b},sanitizeValue:function(a){return Math.min(Math.max(a,this.minValue),this.maxValue)},valueToPosition:function(a){var b=this.linearValueToPosition;this.options.customValueToPosition?b=this.options.customValueToPosition:this.options.logScale&&(b=this.logValueToPosition),a=this.sanitizeValue(a);var c=b(a,this.minValue,this.maxValue)||0;return this.options.rightToLeft&&(c=1-c),c*this.maxPos},linearValueToPosition:function(a,b,c){var d=c-b;return(a-b)/d},logValueToPosition:function(a,b,c){a=Math.log(a),b=Math.log(b),c=Math.log(c);var d=c-b;return(a-b)/d},positionToValue:function(a){var b=a/this.maxPos;this.options.rightToLeft&&(b=1-b);var c=this.linearPositionToValue;return this.options.customPositionToValue?c=this.options.customPositionToValue:this.options.logScale&&(c=this.logPositionToValue),c(b,this.minValue,this.maxValue)||0},linearPositionToValue:function(a,b,c){return a*(c-b)+b},logPositionToValue:function(a,b,c){b=Math.log(b),c=Math.log(c);var d=a*(c-b)+b;return Math.exp(d)},getEventXY:function(a){var b=this.options.vertical?"clientY":"clientX";return void 0!==a[b]?a[b]:void 0===a.originalEvent?a.touches[0][b]:a.originalEvent.touches[0][b]},getEventPosition:function(a){var b=this.sliderElem.rzsp,c=0;return c=this.options.vertical?-this.getEventXY(a)+b:this.getEventXY(a)-b,c*this.options.scale-this.handleHalfDim},getEventNames:function(a){var b={moveEvent:"",endEvent:""};return a.touches||void 0!==a.originalEvent&&a.originalEvent.touches?(b.moveEvent="touchmove",b.endEvent="touchend"):(b.moveEvent="mousemove",b.endEvent="mouseup"),b},getNearestHandle:function(a){if(!this.range)return this.minH;var b=this.getEventPosition(a),c=Math.abs(b-this.minH.rzsp),d=Math.abs(b-this.maxH.rzsp);return d>c?this.minH:c>d?this.maxH:this.options.rightToLeft?b>this.minH.rzsp?this.minH:this.maxH:b=f?e=h:f>=this.maxPos?e=g:(e=this.positionToValue(f),e=d&&a.isNumber(this.options.showTicks)?this.roundStep(e,this.options.showTicks):this.roundStep(e)),this.positionTrackingHandle(e)},onEnd:function(a,b){var d=this.getEventNames(b).moveEvent;this.options.keyboardSupport||(this.minH.removeClass("rz-active"),this.maxH.removeClass("rz-active"),this.tracking=""),this.dragging.active=!1,c.off(d,a),this.callOnEnd()},onTickClick:function(a,b){this.onMove(a,b,!0)},onPointerFocus:function(b,c){this.tracking=c,b.one("blur",a.bind(this,this.onPointerBlur,b)),b.on("keydown",a.bind(this,this.onKeyboardEvent)),b.on("keyup",a.bind(this,this.onKeyUp)),this.firstKeyDown=!0,b.addClass("rz-active"),this.currentFocusElement={pointer:b,ref:c}},onKeyUp:function(){this.firstKeyDown=!0,this.callOnEnd()},onPointerBlur:function(a){a.off("keydown"),a.off("keyup"),this.tracking="",a.removeClass("rz-active"),this.currentFocusElement=null},getKeyActions:function(a){var b=a+this.step,c=a-this.step,d=a+this.valueRange/10,e=a-this.valueRange/10,f={UP:b,DOWN:c,LEFT:c,RIGHT:b,PAGEUP:d,PAGEDOWN:e,HOME:this.minValue,END:this.maxValue};return this.options.rightToLeft&&(f.LEFT=b,f.RIGHT=c,this.options.vertical&&(f.UP=c,f.DOWN=b)),f},onKeyboardEvent:function(a){var c=this[this.tracking],d=a.keyCode||a.which,e={38:"UP",40:"DOWN",37:"LEFT",39:"RIGHT",33:"PAGEUP",34:"PAGEDOWN",36:"HOME",35:"END"},f=this.getKeyActions(c),g=e[d],h=f[g];if(null!=h&&""!==this.tracking){a.preventDefault(),this.firstKeyDown&&(this.firstKeyDown=!1,this.callOnStart());var i=this;b(function(){var a=i.roundStep(i.sanitizeValue(h));if(i.options.draggableRangeOnly){var b,c,d=i.highValue-i.lowValue;"lowValue"===i.tracking?(b=a,c=a+d,c>i.maxValue&&(c=i.maxValue,b=c-d)):(c=a,b=a-d,b=k,h=k>=this.maxPos-e,g){if(0===i.rzsp)return;c=this.getValue("min",k,!0,!1),d=this.getValue("max",k,!0,!1)}else if(h){if(j.rzsp===this.maxPos)return;d=this.getValue("max",k,!0,!0),c=this.getValue("min",k,!0,!0)}else c=this.getValue("min",k,!1),d=this.getValue("max",k,!1);this.positionTrackingBar(c,d)},positionTrackingBar:function(a,b){null!=this.options.minLimit&&athis.options.maxLimit&&(b=this.options.maxLimit,a=b-this.dragging.difference),this.lowValue=a,this.highValue=b,this.applyLowValue(),this.range&&this.applyHighValue(),this.applyModel(!0),this.updateHandles("lowValue",this.valueToPosition(a)),this.updateHandles("highValue",this.valueToPosition(b))},positionTrackingHandle:function(a){var b=!1;a=this.applyMinMaxLimit(a),this.range&&(this.options.pushRange?(a=this.applyPushRange(a),b=!0):(this.options.noSwitching&&("lowValue"===this.tracking&&a>this.highValue?a=this.applyMinMaxRange(this.highValue):"highValue"===this.tracking&&athis.highValue?(this.lowValue=this.highValue,this.applyLowValue(),this.applyModel(),this.updateHandles(this.tracking,this.maxH.rzsp),this.updateAriaAttributes(),this.tracking="highValue",this.minH.removeClass("rz-active"),this.maxH.addClass("rz-active"),this.options.keyboardSupport&&this.focusElement(this.maxH),b=!0):"highValue"===this.tracking&&athis.options.maxLimit?this.options.maxLimit:a},applyMinMaxRange:function(a){var b="lowValue"===this.tracking?this.highValue:this.lowValue,c=Math.abs(a-b);return null!=this.options.minRange&&cthis.options.maxRange?"lowValue"===this.tracking?this.highValue-this.options.maxRange:this.lowValue+this.options.maxRange:a},applyPushRange:function(a){var b="lowValue"===this.tracking?this.highValue-a:a-this.lowValue,c=null!==this.options.minRange?this.options.minRange:this.options.step,d=this.options.maxRange;return c>b?("lowValue"===this.tracking?(this.highValue=Math.min(a+c,this.maxValue),a=this.highValue-c,this.applyHighValue(),this.updateHandles("highValue",this.valueToPosition(this.highValue))):(this.lowValue=Math.max(a-c,this.minValue),a=this.lowValue+c,this.applyLowValue(),this.updateHandles("lowValue",this.valueToPosition(this.lowValue))),this.updateAriaAttributes()):null!==d&&b>d&&("lowValue"===this.tracking?(this.highValue=a+d,this.applyHighValue(),this.updateHandles("highValue",this.valueToPosition(this.highValue))):(this.lowValue=a-d,this.applyLowValue(),this.updateHandles("lowValue",this.valueToPosition(this.lowValue))),this.updateAriaAttributes()),a},applyModel:function(a){this.internalChange=!0,this.scope.$apply(),a&&this.callOnChange(),this.internalChange=!1},callOnStart:function(){if(this.options.onStart){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onStart(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b);
})}},callOnChange:function(){if(this.options.onChange){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onChange(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}},callOnEnd:function(){if(this.options.onEnd){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onEnd(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}this.scope.$emit("slideEnded")}},h}]).directive("rzslider",["RzSlider",function(a){return{restrict:"AE",replace:!0,scope:{rzSliderModel:"=?",rzSliderHigh:"=?",rzSliderOptions:"&?",rzSliderTplUrl:"@"},templateUrl:function(a,b){return b.rzSliderTplUrl||"rzSliderTpl.html"},link:function(b,c){b.slider=new a(b,c)}}}]);return b.run(["$templateCache",function(a){a.put("rzSliderTpl.html",' {{ t.value }} {{ t.legend }} ')}]),b.name});
//! api-check version 7.5.5 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò)
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):"object"==typeof exports?exports.apiCheck=r():e.apiCheck=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var o=t(3),i=n(o);r["default"]=i["default"],e.exports=r["default"]},function(e,r){function t(e,r){var t=[],o=[];return r=r||function(e,r){return"[Circular "+n(r,t,o)+"]"},function(n,i){var a=i;return"object"==typeof i&&i&&(-1!==t.indexOf(i)?a=r(n,i):(t.push(i),o.push(n))),e&&(a=e(n,a)),a}}function n(e,r,t){var n=r.indexOf(e),o=[t[n]];for(n--;n>=0;n--)r[n][o[0]]===e&&(e=r[n],o.unshift(t[n]));return"~"+o.join(".")}function o(e,r,n,o){return JSON.stringify(e,t(r,o),n)}e.exports=o,o.getSerialize=t},function(e,r,t){"use strict";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e){var r=i(e),t=void 0;if("array"===r)t=[];else{if("object"!==r)return e;t={}}return f(e,function(e,r){t[r]=e}),t}function i(e){return Array.isArray(e)?"array":e instanceof RegExp?"object":typeof e}function a(e,r){var t=void 0,n=r&&r["short"];return t=n&&e.shortType?e.shortType:!n&&"object"==typeof e.type||"function"===e.type?u(e,r):u(e,r)||e.displayName||e.name}function u(e,r){var t=e.type;if("function"==typeof t){var o=t.__apiCheckData,i=t(r);t=n({__apiCheckData:o},o.type,i)}return t}function p(e){return e?Array.isArray(e)?e:[e]:[]}function f(e,r,t){return Array.isArray(e)?s(e,r,t):c(e,r,t)}function c(e,r,t){var n=void 0,o=Object.prototype.hasOwnProperty;for(var i in e)if(o.call(e,i)&&(n=r.call(t,e[i],i,e),n===!1))return n;return!0}function s(e,r,t){for(var n=void 0,o=e.length,i=0;o>i;i++)if(n=r.call(t,e[i],i,e),n===!1)return n;return!0}function l(e){return e instanceof Error}function y(e,r,t){e=p(e);var n=e.slice(),o=n.pop();return 1===n.length&&(r=" "),n.join(r)+(""+(n.length?r+t:"")+o)}function h(e,r,t){"function"==typeof t&&(t=t({"short":!0}));var n="object"!=typeof t?t:A(t);return new Error(d(e,r)+" must be "+v(n))}function d(e,r){var t=v(e||"value"),n=r?" at "+v(r):"";return""+t+n}function v(e){return"`"+e+"`"}function g(e){return"undefined"==typeof e}function b(e,r,t){return t&&(e=_(),e.isNoop=!0),"string"==typeof e.type&&(e.shortType=e.type),f(r,function(r,t){return e[t]=r}),e.displayName||(e.displayName="apiCheck "+v(e.shortType||e.type||e.name)+" type checker"),e.notRequired||(e=m(e,t)),e.notNullable||k(e,t),e.notOptional||O(e,t),e}function m(e,r){var t=r?_():function(r,t,n,o){if(g(r)&&!e.isOptional){var i=n?" in "+v(n):"",u=a(e,{"short":!0}),p="object"!=typeof u?u:A(u);return new Error("Required "+v(t)+" not specified"+i+". Must be "+v(p))}return e(r,t,n,o)};return j(e,t),t.originalChecker=e,t}function O(e,r){var t=r?_():function(r,t,n,o){return g(r)?void 0:e(r,t,n,o)};j(e,t),t.isOptional=!0,t.displayName=e.displayName+" (optional)",t.originalChecker=e,e.optional=t,C(e,e.optional)}function k(e,r){var t=r?_():function(r,t,n,o){return null!==r?e(r,t,n,o):void 0};j(e,t),t.isNullable=!0,t.displayName=e.displayName+" (nullable)",t.originalChecker=e,e.nullable=t,C(e,e.nullable),e.notOptional||O(e.nullable,r)}function C(e,r){if("object"==typeof r.type)r.type=o(r.type);else{if("function"!=typeof r.type)return void(r.type+=" (optional)");r.type=function(){return e.type.apply(e,arguments)}}r.type.__apiCheckData=o(e.type.__apiCheckData)||{},r.type.__apiCheckData.optional=!0}function j(e,r){f(Object.keys(e),function(t){return r[t]=e[t]})}function x(){}function _(){return function(){}}var A=t(1),T={addOptional:O,getRequiredVersion:m,setupChecker:b,addNullable:k};e.exports={each:f,copy:o,typeOf:i,arrayify:p,getCheckerDisplay:a,isError:l,list:y,getError:h,nAtL:d,t:v,undef:g,checkerHelpers:T,noop:x}},function(e,r,t){"use strict";function n(){function r(n,i,a){if(r.config.disabled||e.exports.globalConfig.disabled)return{apiTypes:{},argTypes:{},passed:!0,message:"",failed:!1};t(arguments),Array.isArray(n)?i=Array.prototype.slice.call(i):(n=[n],i=[i]);var u=p(n,i);u.length||(u=o(n,i));var f=c(n,i);return f.args=i,u.length?(f.message=r.getErrorMessage(n,i,u,a),f.failed=!0,f.passed=!1):(f.message="",f.failed=!1,f.passed=!0),f}function t(e){var t=e[0],n=e[1],i=Array.isArray(n)||n&&"object"==typeof n&&"number"==typeof n.length;if(Array.isArray(t)&&!i)throw new Error(a(t,[n],["If an array is provided for the api, an array must be provided for the args as well."],{prefix:"apiCheck"}));var u=o(C.checkApiCheckApi,e);if(u.length){var p=r.getErrorMessage(C.checkApiCheckApi,e,u,{prefix:"apiCheck"});r.handleErrorMessage(p,!0)}}function n(e){return function(t,n,o){var i=r(t,n,o);return r.handleErrorMessage(i.message,e),i}}function i(e,r){if(r&&e)throw new Error(e);e&&console.warn(e)}function a(e,t){function n(){var e=p.onlyPrefix;return e||(e=((f.prefix||"")+" "+(p.prefix||"")).trim()),e}function o(){var e=p.onlySuffix;return e||(e=((p.suffix||"")+" "+(f.suffix||"")).trim()),e}function i(){var e=p.url;return e||(e=f.docsBaseUrl&&p.urlSuffix&&(""+f.docsBaseUrl+p.urlSuffix).trim()),e}var a=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],p=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],f=r.config.output||{},c=n(),s=o(),l=i(),y="apiCheck failed! "+a.join(", "),h="\n\n"+u(e,t);return(c+" "+y+" "+s+" "+(l||"")+h).trim()}function u(e,r){function t(e){h(e,function(r,n){-1===f.indexOf(r)&&(f.push(r),"object"==typeof r?t(e):"function"==typeof r&&(e[n]=r.displayName||r.name||"anonymous function"))})}function n(e){return e&&e.length?(e&&1===e.length&&(e=e[0]),l(e,null,2)):"nothing"}function o(){var e="\n",t=!0;r&&1===r.length&&(t="object"==typeof r[0]&&null!==r[0]?!!Object.keys(r[0]).length:!1);var n="type"+(t?"s":""),o=e+e;return"You passed:"+e+s+o+("With the "+n+":"+e+u+o)+("The API calls for:"+e+a)}var i=c(e,r),a=i.apiTypes,u=i.argTypes,p=Array.prototype.slice.call(r||[]),f=[];t(p);var s=n(p);return u=n(u),a=n(a),o()}function c(t,n){t=g(t),n=g(n);var o=t.map(function(t,o){var i=e.exports.globalConfig.hasOwnProperty("verbose");return b(t,{terse:i?!e.exports.globalConfig.verbose:!r.config.verbose,obj:n[o],addHelpers:!0})}),i=n.map(function(e){return f(e,[])});return{argTypes:i,apiTypes:o}}var s=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],d=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];j&&arguments.length&&j["throw"](C.getApiCheckInstanceCheckers,arguments,{prefix:"creating an apiCheck instance"});var v={"throw":n(!0),warn:n(!1),getErrorMessage:a,handleErrorMessage:i,config:{output:s.output||{prefix:"",suffix:"",docsBaseUrl:""},verbose:s.verbose||!1,disabled:s.disabled||!1},utils:y};h(v,function(e,t){return r[t]=e});var m=r.disabled||e.exports.globalConfig.disabled;return h(k.getCheckers(m),function(e,t){return r[t]=e}),h(d,function(e,t){return r[t]=e}),r}function o(e,r){for(var t=[],n=!1,o=0,i=0,u=void 0,p=void 0,f=void 0,c=void 0,s=void 0,l=void 0,y=void 0;(p=e[o++])&&i=e.length,y=o>1&&e[o-1].isOptional,l&&c||l&&!c&&!p.isOptional&&!y?(n=!0,t.push(a(f,p,u))):l&&p.isOptional?i--:t.push(v(s)+" passed");return n?t:[]}function i(e,r,t){var n=k.shape({type:k.string,optional:k.bool}),o=k.func.withProperties({__apiCheckData:n}),a=k.shape({__apiCheckData:n}),u=k.oneOfType([o,a])(e,r,t);return d(u)?u:"function"==typeof e||e.hasOwnProperty(e.__apiCheckData.type)?void 0:O(r,t,i.type)}function a(e,r,t){var n=u(r,t);return n=n?" - "+n:"",e.message+n}function u(e,r){var t=e.help;return t?("function"==typeof t&&(t=t(r)),t):""}function p(e,r){var t=e.filter(function(e){return!e.isOptional});return r.lengthe||e>t?y(o,i,n):void 0},{type:n},e)}function E(r){var t="lessThan["+r+"]";return b(function(e,n,o){return"number"!=typeof e||e>r?y(n,o,t):void 0},{type:t},e)}function D(r){var t="greaterThan["+r+"]";return b(function(e,n,o){return"number"!=typeof e||r>e?y(n,o,t):void 0},{type:t},e)}function N(){var r="empty object";return b(function(e,t,n){return"object"!==a(e)||null===e||Object.keys(e).length?y(t,n,r):void 0},{type:r},e)}return{array:r("Array"),bool:r("Boolean"),number:r("Number"),string:r("String"),func:t(),object:n(),emptyObject:N(),instanceOf:i,oneOf:v,oneOfType:O,arrayOf:k,objectOf:C,typeOrArrayOf:j,range:w,lessThan:E,greaterThan:D,shape:x(),args:_(),any:A(),"null":T()}}var o=t(1),i=t(2),a=i.typeOf,u=i.each,p=i.copy,f=i.getCheckerDisplay,c=i.isError,s=i.arrayify,l=i.list,y=i.getError,h=i.nAtL,d=i.t,v=i.checkerHelpers,g=i.undef,b=v.setupChecker,m=e.exports=n();e.exports.getCheckers=n}])});
//# sourceMappingURL=api-check.min.js.map
/*! angular-formly v8.4.1 | MIT | built with ♥ by Astrism , Kent C. Dodds (ó ì_í)=óò=(ì_í ò) */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("api-check"),require("angular")):"function"==typeof define&&define.amd?define(["api-check","angular"],t):"object"==typeof exports?exports.ngFormly=t(require("api-check"),require("angular")):e.ngFormly=t(e.apiCheck,e.angular)}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(10),i=n(r);t["default"]=i["default"],e.exports=t["default"]},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(19);n.version||(n=window.angular),t["default"]=n,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){return i(e,".")||i(e,"[")&&i(e,"]")}function i(e,t){return!(!e||!e.indexOf)&&e.indexOf(t)!==-1}function a(e,t,o,n,r){return v["default"].isFunction(t)?t(n,o,e,r):e.$eval(t,v["default"].extend({$viewValue:n,$modelValue:o},r))}function l(e,t,o){if(t.id)return t.id;var n=t.type;return!n&&t.template?n="template":!n&&t.templateUrl&&(n="templateUrl"),[e,n,t.key,o].join("_")}function f(e){return v["default"].forEach(arguments,function(t,o){o&&v["default"].forEach(t,function(t,o){v["default"].isDefined(e[o])?s(e[o],t)&&f(e[o],t):e[o]=v["default"].copy(t)})}),e}function s(e,t){return v["default"].isObject(e)&&v["default"].isObject(t)&&Object.getPrototypeOf(e)===Object.getPrototypeOf(t)}function u(e,t){if(e.prop||(e=v["default"].element(e)),e.prop("nodeName")===t.toUpperCase())return e;for(var o=e.children(),n=0;o&&n=t.length&&e.substring(0,t.length)===t)}function y(e,t){return!(!v["default"].isString(e)||!v["default"].isString(t))&&(e.length>=t.length&&e.indexOf(t)!==-1)}Object.defineProperty(t,"__esModule",{value:!0});var h=o(1),v=n(h);t["default"]={containsSelector:r,containsSpecialChar:i,formlyEval:a,getFieldId:l,reverseDeepMerge:f,findByNodeName:u,arrayify:p,extendFunction:d,extendArray:c,startsWith:m,contains:y},e.exports=t["default"]},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]="https://github.com/formly-js/angular-formly/blob/8.4.1/other/ERRORS_AND_WARNINGS.md#",e.exports=t["default"]},function(t,o){t.exports=e},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){return{restrict:"A",require:"ngModel",link:function(t,o,n,r){function i(e,t,o){l(t,o),t=a["default"].isObject(t)?t.expression:t,p?f(t,o,e):s(t,o,e)}function l(o,n){var i=o.message;i&&(u.validation.messages[n]=function(){return e.formlyEval(t,i,r.$modelValue,r.$viewValue)})}function f(o,n,i){var a=i?"$asyncValidators":"$validators";r[a][n]=function(n,r){return e.formlyEval(t,o,n,r)}}function s(o,n,i){var a=void 0;r.$parsers.unshift(function(l){var f=e.formlyEval(t,o,r.$modelValue,l);return i?(r.$pending=r.$pending||{},r.$pending[n]=!0,a=f,f.then(function(){a===f&&r.$setValidity(n,!0)})["catch"](function(){a===f&&r.$setValidity(n,!1)})["finally"](function(){var e=r.$pending||{};1===Object.keys(e).length?delete r.$pending:delete r.$pending[n]})):r.$setValidity(n,f),l})}var u=t.options;u.validation.messages=u.validation.messages||{},a["default"].forEach(u.validation.messages,function(o,n){u.validation.messages[n]=function(){return e.formlyEval(t,o,r.$modelValue,r.$viewValue)}});var p=r.hasOwnProperty("$validators")&&!n.hasOwnProperty("useParsers");a["default"].forEach(u.validators,a["default"].bind(null,i,!1)),a["default"].forEach(u.asyncValidators,a["default"].bind(null,i,!0))}}}r.$inject=["formlyUtil"],Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t1){var n=t.shift();e[n]=e[n]||isNaN(t[0])?{}:[],m(e[n],t,o)}else e[t[0]]=o}function y(t,o,r){if((t||0===t)&&o)if(p(t))o[t]=r;else if(f.extras.parseKeyArrays&&c(t))m(e.model,t,r);else{var i=n(e.options.key).assign;i&&i(e.model,r)}}function h(e,t){if((e||0===e)&&t)return p(e)?t[e]:n(e)(t)}function v(t){d.reverseDeepMerge(t,{originalModel:t.model,extras:{},data:{},templateOptions:{},validation:{}}),e.to=e.options.templateOptions,e.formOptions=e.formOptions||{}}function b(){if(s["default"].isFunction(f.extras.getFieldId))e.id=f.extras.getFieldId(e.options,e.model,e);else{var t=e.form&&e.form.$name||e.formId;e.id=d.getFieldId(t,e.options,e.index)}e.options.id=e.id,e.name=e.options.name||e.options.id,e.options.name=e.name}function O(){s["default"].isDefined(e.options.defaultValue)&&!s["default"].isDefined(h(e.options.key,e.model))&&y(e.options.key,e.model,e.options.defaultValue)}function x(){e.options.initialValue=e.model&&h(e.options.key,e.model)}function E(e,t){t&&$(e,t.defaultOptions);var o=j(e.optionsTypes).reverse();s["default"].forEach(o,function(t){$(e,f.getType(t,!0,e).defaultOptions)})}function $(t,o){o&&(s["default"].isFunction(o)&&(o=o(t,e)),d.reverseDeepMerge(t,o))}function w(e,t){var o=e.key||t||0;s["default"].extend(e,{key:o,value:e.value||u,runExpressions:a,resetModel:k,updateInitialValue:C})}function k(){y(e.options.key,e.model,e.options.initialValue),e.options.formControl&&(s["default"].isArray(e.options.formControl)?s["default"].forEach(e.options.formControl,function(e){M(e,!0)}):M(e.options.formControl)),e.form&&(e.form.$setUntouched&&e.form.$setUntouched(),e.form.$setPristine())}function M(t,o){o||t.$setViewValue(h(e.options.key,e.model)),t.$render(),t.$setUntouched&&t.$setUntouched(),t.$setPristine(),e.$root.$$phase||e.$digest()}function C(){e.options.initialValue=h(e.options.key,e.model)}function F(e){e.validation.messages=e.validation.messages||{},s["default"].forEach(i.messages,function(t,o){e.validation.messages[o]||(e.validation.messages[o]=function(e,o,n){return d.formlyEval(n,t,o,e)})})}function T(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];s["default"].forEach([o.controller,t.controller],function(t){t&&r(t,{$scope:e})})}function _(){e.options.options=e.options.options||{},e.options.options.formState=e.formState,e.to=e.options.templateOptions}if(e.options.fieldGroup)return void _();var W=g(e.options);v(e.options),E(e.options,W),w(e.options,e.index),A(e.options),b(),O(),x(),a(),l(),F(e.options),T(e,e.options,W)}function h(e,n,u,p){function c(){k(e.options),n.addClass("formly-field-group");var t="";e.options.elementAttributes&&(t=Object.keys(e.options.elementAttributes).map(function(t){return t+'="'+e.options.elementAttributes[t]+'"'}).join(" "));var o="model";e.options.form=e.form,e.options.key&&(o="model['"+e.options.key+"']"),x('\n \n \n ").then(E(e.options,e.formOptions)).then($)}function y(){e.options.elementAttributes&&n.attr(e.options.elementAttributes)}function h(){e.options.className&&n.addClass(e.options.className),e.options.type&&n.addClass("formly-field-"+e.options.type)}function $(t){return n.html(v(t)),o(n.contents())(e),t}function w(t){function o(t){var o=/\{\{(.*?)}}/,r=o.exec(t);r&&(t=i(t)(e)),n(t)}function n(t){e.$watch('form["'+t+'"]',function(t){t&&(_>1?(e.options.formControl||(e.options.formControl=[]),e.options.formControl.push(t)):e.options.formControl=t,e.fc=e.options.formControl,y(),u(),p(),c())})}function u(){y=e.$watch(function(){var t=f.extras.errorExistsAndShouldBeVisibleExpression,o=e.options,n=j(e.fc);return!!n.some(function(e){return e.$invalid})&&("boolean"==typeof o.validation.show?o.validation.show:t?n.some(function(o){return d.formlyEval(e,t,o.$modelValue,o.$viewValue)}):n.some(function(e){var t=s["default"].isUndefined(e.$touched)&&e.$dirty;return e.$touched||t}))},function(t){e.options.validation.errorExistsAndShouldBeVisible=t,e.showError=t})}function p(){m("parsers")}function c(){m("formatters");var t=e.fc,o=e.form.$pristine;e.options.formatters&&!function(){var n=t.$modelValue;t.$formatters.forEach(function(e){n=e(n)}),t.$setViewValue(n),t.$render(),t.$setPristine(),o&&e.form.$setPristine()}()}function m(t){function o(r){if(!r)return[];s["default"].isString(r)&&(r=f.getType(r,!0,e.options));var i=[];return r["extends"]&&(i=d.extendArray(i,o(r["extends"]))),i=d.extendArray(i,l(r,t,[])),i=d.extendArray(i,n(a(r)))}function n(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=[];return s["default"].forEach(s["default"].copy(j(e)).reverse(),function(e){t=d.extendArray(t,o(e))}),t}function i(t){function o(o){var n=e.options.value();return d.formlyEval(e,t,n,o)}return o[u]=t,o}var u="originalParser";"formatters"===t&&(u="originalFormatter");var p=o(C);p=d.extendArray(p,n(e.options.optionsTypes)),p=d.extendArray(p,e.options[t]),s["default"].forEach(p,function(e,t){p[t]=i(e)});var c=e.fc;s["default"].isArray(c)||(c=[c]),s["default"].forEach(c,function(e){var o;e["$"+t]=(o=e["$"+t]).concat.apply(o,r(p))})}var y=s["default"].noop;if(!e.options.noFormControl){var h=s["default"].element(""+t+"
"),v=h[0].querySelectorAll("[ng-model],[data-ng-model]");v.length&&s["default"].forEach(v,function(e){_++,o(e.getAttribute("name"))})}}function A(){C&&C.link&&C.link.apply(T,F),e.options.link&&e.options.link.apply(T,F)}function M(o){return function(n){var r=t.when(n);return s["default"].forEach(o,function(o){r=r.then(function(n){return t.when(o(n,e.options,e)).then(function(e){return s["default"].isString(e)?e:v(e)})})}),r}}if(e.options.fieldGroup)return void c();!p&&e.options.model&&e.$watch("options.model",function(){return e.options.runExpressions()},!0),y(),h();var C=g(e.options),F=arguments,T=this,_=0,W=b(e.options,e.formOptions);O(e.options).then(M(W.preWrapper)).then(E(e.options,e.formOptions)).then(M(W.postWrapper)).then($).then(w).then(A)["catch"](function(t){m("there-was-a-problem-setting-the-template-for-this-field","There was a problem setting the template for this field ",e.options,t)})}function v(e){var t=s["default"].element(" ");return t.append(e).html()}function g(e){return e.type&&f.getType(e.type)}function b(e,t){function o(e){var t=e||{},o=t.preWrapper,i=void 0===o?[]:o,a=t.postWrapper,l=void 0===a?[]:a;n=n.concat(i),r=r.concat(l)}var n=[],r=[];return o(e.templateManipulators),o(t.templateManipulators),o(f.templateManipulators),{preWrapper:n,postWrapper:r}}function O(e){function t(t,o){return s["default"].isDefined(e[t])?e[t]:o&&s["default"].isDefined(o[t])?o[t]:void 0}var o=f.getType(e.type,!0,e),n=t("template",o),r=t("templateUrl",o);if(s["default"].isUndefined(n)&&!r)throw c.getFieldError("type-type-has-no-template","Type '"+e.type+"' has no template. On element:",e);return x(r||n,s["default"].isUndefined(n),e)}function x(o,r,i){var a=void 0;if(a=s["default"].isFunction(o)?t.when(o(i)):t.when(o),!r)return a;var l=function(){var t={cache:n};return{v:a.then(function(o){return e.get(o,t)}).then(function(e){return e.data})["catch"](function(e){m("problem-loading-template-for-templateurl","Problem loading template for "+o,e)})}}();return"object"==typeof l?l.v:void 0}function E(e,o){var n=w(e,o);return function(o){if(!n.length)return t.when(o);n.forEach(function(t){c.checkWrapper(t,e),M(t,e)});var r=n.map(function(e){return x(e.template||e.templateUrl,!e.template)});return t.all(r).then(function(e){e.forEach(function(e,t){c.checkWrapperTemplate(e,n[t])}),e.reverse();var t=e.shift();return e.forEach(function(e){t=$(t,e)}),$(t,o)})}}function $(e,t){var o=s["default"].element(" ");o.append(e);var n=o.find("formly-transclude");return n.length||(n=d.findByNodeName(o,"formly-transclude")),n.replaceWith(t),o.html()}function w(e,t){var o=e.wrapper;if(null===o)return[];o=o?j(o).map(f.getWrapper):j(f.getWrapperByType(e.type));var n=f.getType(e.type,!0,e);if(n&&n.wrapper){var r=j(n.wrapper).map(f.getWrapper);o=o.concat(r)}if(t.wrapper){var i=j(t.wrapper).map(f.getWrapper);o=o.concat(i)}var a=f.getWrapper();return a&&o.push(a),o}function A(e){u["throw"](u.formlyFieldOptions,e,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"});var t=e.type&&f.getType(e.type);t&&M(t,e,!0),e.expressionProperties&&e.expressionProperties.hide&&m("dont-use-expressionproperties.hide-use-hideexpression-instead","You have specified `hide` in `expressionProperties`. Use `hideExpression` instead",e)}function k(e){u["throw"](u.fieldGroup,e,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"})}function M(e,t,o){var n=e.apiCheck,r=e.apiCheckInstance,i=e.apiCheckFunction,a=e.apiCheckOptions;C(n,r,i,a,t),o&&t.type&&s["default"].forEach(f.getTypeHeritage(t.type),function(e){C(e.apiCheck,e.apiCheckInstance,e.apiCheckFunction,e.apiCheckOptions,t)})}function C(e,t,o,n,r){if(e){var i=t||f.extras.apiCheckInstance||u;if(!i.config.disabled&&!p["default"].globalConfig.disabled){var a=o||"warn",l=e(i);s["default"].forEach(l,function(e,t){var o=i.shape(e),l=s["default"].extend({prefix:"formly-field type "+r.type+" for property "+t,url:u.config.output.docsBaseUrl+"formly-field-type-apicheck-failed"},n);i[a](o,r[t],l)})}}}y.$inject=["$scope","$timeout","$parse","$controller","formlyValidationMessages"];var j=d.arrayify;return{restrict:"AE",transclude:!0,require:"?^formlyForm",scope:{options:"=",model:"=",originalModel:"=?",formId:"@",index:"=?",fields:"=?",formState:"=?",formOptions:"=?",form:"=?"},controller:y,link:h}}function a(e){return l(e,"optionsTypes",[])}function l(e,t,o){return e.defaultOptions&&e.defaultOptions[t]||o}i.$inject=["$http","$q","$compile","$templateCache","$interpolate","formlyConfig","formlyApiCheck","formlyUtil","formlyUsability","formlyWarn"],Object.defineProperty(t,"__esModule",{value:!0});var f=o(1),s=n(f),u=o(4),p=n(u);t["default"]=i,e.exports=t["default"]},function(e,t){"use strict";function o(e,t){return{restrict:"A",link:function(o,n,r){var i=null,a=n[0],l=t[0];r.$observe("formlyFocus",function(t){"true"===t?e(function(){i=l.activeElement,a.focus()},~~r.focusWait):"false"===t&&l.activeElement===a&&(a.blur(),r.hasOwnProperty("refocus")&&i&&i.focus())})}}}o.$inject=["$timeout","$document"],Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t2?o-2:0),r=2;r\n <"+h+' formly-field\n ng-repeat="field in fields '+p()+'"\n '+u()+'="!field.hide"\n class="formly-field"\n options="field"\n model="field.model || model"\n original-model="model"\n fields="fields"\n form="theFormlyForm"\n form-id="'+d()+'"\n form-state="options.formState"\n form-options="options"\n index="$index">\n '+h+'>\n
\n '+y+">\n "}function l(e,r,i){function a(){var a=i.name;if(e.formId=a,e.theFormlyForm=e[a],i.form){var l=o(i.form),f=l.assign,s=l(e.$parent);s?(e.theFormlyForm=s,e[a]&&e.theFormlyForm.$removeControl(e[a]),r.removeData("$formController")):f(e.$parent,e[a])}e.theFormlyForm||n.disableWarnings||t("formly-form-has-no-formcontroller","Your formly-form does not have a `form` property. Many functions of the form (like validation) may not work",r,e)}function l(){var t=n.extras.removeChromeAutoComplete===!0,o=e.options&&e.options.removeChromeAutoComplete===!1,i=e.options&&e.options.removeChromeAutoComplete===!0;if(t&&!o||i){var a=document.createElement("input");a.setAttribute("autocomplete","address-level4"),a.setAttribute("hidden","true"),r[0].appendChild(a)}}a(),l()}function f(e){return e?e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):""}var s=1;return{restrict:"AE",template:i,replace:!0,transclude:!0,scope:{fields:"=",model:"=",form:"=?",options:"=?"},controller:"FormlyFormController",link:l}}r.$inject=["formlyUsability","formlyWarn","$parse","formlyConfig","$interpolate"],Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),i=n(r),a=o(11),l=n(a),f=o(3),s=n(f),u=o(13),p=n(u),d=o(12),c=n(d),m=o(14),y=n(m),h=o(17),v=n(h),g=o(18),b=n(g),O=o(5),x=n(O),E=o(6),$=n(E),w=o(7),A=n(w),k=o(9),M=n(k),C=o(8),j=n(C),F=o(16),T=n(F),_=o(15),W=n(_),S="formly";t["default"]=S;var P=i["default"].module(S,[]);P.constant("formlyApiCheck",l["default"]),P.constant("formlyErrorAndWarningsUrlPrefix",s["default"]),P.constant("formlyVersion","8.4.1"),P.provider("formlyUsability",p["default"]),P.provider("formlyConfig",c["default"]),P.factory("formlyValidationMessages",y["default"]),P.factory("formlyUtil",v["default"]),P.factory("formlyWarn",b["default"]),P.directive("formlyCustomValidation",x["default"]),P.directive("formlyField",$["default"]),P.directive("formlyFocus",A["default"]),P.directive("formlyForm",M["default"]),P.controller("FormlyFormController",j["default"]),P.run(T["default"]),P.run(W["default"]),e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function o(o,r,i,a){var l=a&&a.hasOwnProperty(r),f=e.some(function(e){return a&&a.hasOwnProperty(e)});return f||l?l?t(o,r,i,a):void 0:s.utils.getError(r,i,n)}a["default"].isArray(e)||(e=[e]);var n="specified if these are not specified: `"+e.join(", ")+"` (otherwise it's optional)";return o.type=n,s.utils.checkerHelpers.setupChecker(o)}Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i),l=o(4),f=n(l),s=(0,f["default"])({output:{prefix:"angular-formly:",docsBaseUrl:o(3)}}),u=s.oneOfType([s.string,s.func]),p=s.typeOrArrayOf(s.string).nullable,d=s.func,c=s.shape.onlyIf("apiCheck",s.func.withProperties({warn:s.func,"throw":s.func,shape:s.func})),m=s.shape.onlyIf("apiCheck",s.oneOf(["throw","warn"])),y=s.shape({name:r("types",s.string).optional,template:s.shape.ifNot("templateUrl",s.string).optional,templateUrl:s.shape.ifNot("template",s.string).optional,types:s.typeOrArrayOf(s.string).optional,overwriteOk:s.bool.optional,apiCheck:d.optional,apiCheckInstance:c.optional,apiCheckFunction:m.optional,apiCheckOptions:s.object.optional}).strict,h=s.objectOf(s.oneOfType([u,s.shape({expression:u,message:u.optional}).strict])),v=s.oneOfType([s.string,s.object]),g=s.shape({preWrapper:s.arrayOf(s.func).nullable.optional,postWrapper:s.arrayOf(s.func).nullable.optional}).strict.nullable,b=s.objectOf(s.oneOfType([u,s.shape({expression:u,message:u.optional}).strict])),O=s.typeOrArrayOf(s.shape({expression:u.optional,listener:u.optional,runFieldExpressions:s.bool.optional})),x={$$hashKey:s.any.optional,type:s.shape.ifNot(["template","templateUrl"],s.string).optional,template:s.shape.ifNot(["type","templateUrl"],s.oneOfType([s.string,s.func])).optional,templateUrl:s.shape.ifNot(["type","template"],s.oneOfType([s.string,s.func])).optional,key:s.oneOfType([s.string,s.number]).optional,model:v.optional,originalModel:v.optional,className:s.string.optional,id:s.string.optional,name:s.string.optional,expressionProperties:h.optional,extras:s.shape({validateOnModelChange:s.bool.optional,skipNgModelAttrsManipulator:s.oneOfType([s.string,s.bool]).optional}).strict.optional,data:s.object.optional,templateOptions:s.object.optional,wrapper:p.optional,modelOptions:s.shape({updateOn:s.string.optional,debounce:s.oneOfType([s.objectOf(s.number),s.number]).optional,allowInvalid:s.bool.optional,getterSetter:s.bool.optional,timezone:s.string.optional}).optional,watcher:O.optional,validators:b.optional,asyncValidators:b.optional,parsers:s.arrayOf(u).optional,formatters:s.arrayOf(u).optional,noFormControl:s.bool.optional,hide:s.bool.optional,hideExpression:u.optional,ngModelElAttrs:s.objectOf(s.string).optional,ngModelAttrs:s.objectOf(s.shape({statement:s.shape.ifNot(["value","attribute","bound","boolean"],s.any).optional,value:s.shape.ifNot("statement",s.any).optional,attribute:s.shape.ifNot("statement",s.any).optional,bound:s.shape.ifNot("statement",s.any).optional,"boolean":s.shape.ifNot("statement",s.any).optional}).strict).optional,elementAttributes:s.objectOf(s.string).optional,optionsTypes:s.typeOrArrayOf(s.string).optional,link:s.func.optional,controller:s.oneOfType([s.string,s.func,s.array]).optional,validation:s.shape({show:s.bool.nullable.optional,messages:s.objectOf(u).optional,errorExistsAndShouldBeVisible:s.bool.optional}).optional,formControl:s.typeOrArrayOf(s.object).optional,value:s.func.optional,runExpressions:s.func.optional,templateManipulators:g.optional,resetModel:s.func.optional,updateInitialValue:s.func.optional,initialValue:s.any.optional,defaultValue:s.any.optional},E=s.shape(x).strict,$=s.shape({formState:s.object.optional,resetModel:s.func.optional,updateInitialValue:s.func.optional,removeChromeAutoComplete:s.bool.optional,parseKeyArrays:s.bool.optional,templateManipulators:g.optional,manualModelWatcher:s.oneOfType([s.bool,s.func]).optional,watchAllExpressions:s.bool.optional,wrapper:p.optional,fieldTransform:s.oneOfType([s.func,s.array]).optional,data:s.object.optional}).strict,w=s.shape({$$hashKey:s.any.optional,key:s.oneOfType([s.string,s.number]).optional,fieldGroup:s.arrayOf(s.oneOfType([E,s.object])),className:s.string.optional,options:$.optional,templateOptions:s.object.optional,wrapper:p.optional,watcher:O.optional,hide:s.bool.optional,hideExpression:u.optional,data:s.object.optional,model:v.optional,form:s.object.optional,elementAttributes:s.objectOf(s.string).optional}).strict,A=a["default"].copy(x);A.key=s.string.optional;var k=s.shape({name:s.string,template:s.shape.ifNot("templateUrl",s.oneOfType([s.string,s.func])).optional,templateUrl:s.shape.ifNot("template",s.oneOfType([s.string,s.func])).optional,controller:s.oneOfType([s.func,s.string,s.array]).optional,link:s.func.optional,defaultOptions:s.oneOfType([s.func,s.shape(A)]).optional,"extends":s.string.optional,wrapper:p.optional,data:s.object.optional,apiCheck:d.optional,apiCheckInstance:c.optional,apiCheckFunction:m.optional,apiCheckOptions:s.object.optional,overwriteOk:s.bool.optional}).strict;a["default"].extend(s,{formlyTypeOptions:k,formlyFieldOptions:E,formlyExpression:u,formlyWrapperType:y,fieldGroup:w,formOptionsApi:$}),t["default"]=s,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t" in it: '+e+"\nAdditional information: "+JSON.stringify(t))}var f=this;a["default"].extend(this,{getFormlyError:n,getFieldError:o,checkWrapper:i,checkWrapperTemplate:l,getErrorMessage:r,$get:function(){return f}})}r.$inject=["formlyApiCheck","formlyErrorAndWarningsUrlPrefix"],Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,e.exports=t["default"]},function(e,t){"use strict";function o(){function e(e,t,r,i,a){n.messages[e]=o(t,r,i,a)}function t(e,t){n.messages[e]=function(){return t}}function o(e,t,o,n){return function(r,i,a){return"undefined"!=typeof a.options.templateOptions[e]?t+" "+a.options.templateOptions[e]+" "+o:n}}var n={addTemplateOptionValueMessage:e,addStringMessage:t,messages:{}};return n}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){e&&e.documentMode<9&&!function(){var t=e.get(0),o=["formly-field","formly-form"];a["default"].forEach(o,function(e){t.createElement(e)})}()}r.$inject=["$document"],Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function o(e,o,r){function i(){(a["default"].isDefined(o.validators)||a["default"].isDefined(o.validation.messages))&&u(g,"formly-custom-validation","")}function l(){d(o.key)&&p(g,"ng-model","model."+o.key)}function c(){a["default"].isDefined(o.modelOptions)&&(u(g,"ng-model-options","options.modelOptions"),o.modelOptions.getterSetter&&p(g,"ng-model","options.value"))}function m(){if(o.templateOptions||o.expressionProperties){var e=o.templateOptions||{},n=o.expressionProperties||{},r=f();a["default"].extend(r,o.ngModelAttrs),a["default"].forEach(r,function(r,i){var l=void 0,f=void 0,p="options.templateOptions['"+i+"']",d=e[i],c=s(n,i),m=a["default"].isDefined(d),y=a["default"].isDefined(c);if(r.value)f=r.value,l=i;else if(r.statement&&m)if(f=r.statement,a["default"].isString(e[i]))l="$eval("+p+")";else{if(!a["default"].isFunction(e[i]))throw new Error("options.templateOptions."+i+" must be a string or function: "+JSON.stringify(o));l=p+"(model[options.key], options, this, $event)"}else r.bound&&y?(f=r.bound,l=p):(r.attribute||r["boolean"])&&y?(f=r.attribute||r["boolean"],l=""+t.startSymbol()+p+t.endSymbol()):r.attribute&&m?(f=r.attribute,l=d):r["boolean"]?m&&!y&&d&&(f=r["boolean"],l=!0):r.bound&&m&&(f=r.bound,l=p);a["default"].isDefined(f)&&a["default"].isDefined(l)&&u(g,f,l)})}}function y(){a["default"].forEach(o.ngModelElAttrs,function(e,t){p(g,t,e)})}var h=document.createElement("div"),v=o.extras&&o.extras.skipNgModelAttrsManipulator;if(v===!0)return e;h.innerHTML=e;var g=n(h,v);return g&&g.length?(u(g,"id",r.id),u(g,"name",r.name||r.id),i(),l(),c(),m(),y(),h.innerHTML):e}function n(e,t){var o=a["default"].isString(t)?":not("+t+")":"",n=":not([formly-skip-ng-model-attrs-manipulator])",i="[ng-model]"+o+n+", [data-ng-model]"+o+n;try{return e.querySelectorAll(i)}catch(l){return r(e,t)}}function r(e,t){var o=e.querySelectorAll("[ng-model], [data-ng-model]"),n=[];n.item=function(e){return this[e]};for(var r=0;ro;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,a=o.length;a>r;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if("undefined"!=typeof o)r(n,e("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n0)for(;c-1){for(;p=0&&$log.warn('sending sms text with "%" sign is not supported');var a,t=encodeURIComponent(o.socialshareText.replace("%","")),s=o.socialshareTo||"";o.socialshareUrl&&(t+=encodeURIComponent(o.socialshareUrl)),a="sms:"+s+"?&body="+t,i.attr("href",a),i.attr("target","_blank")},x=function(e,o,i){var a="viber://forward?text="+encodeURIComponent(o.socialshareText)+encodeURIComponent(o.socialshareUrl||e.location.href);i.attr("href",a),i.attr("target","_top")},y=function(e,o){var i="https://telegram.me/share/url?url="+encodeURIComponent(o.socialshareUrl||e.location.href);o.socialshareText&&(i+="&text="+encodeURIComponent(o.socialshareText)),e.open(i,"Telegram","toolbar=0,status=0,resizable=yes,width="+o.socialsharePopupWidth+",height="+o.socialsharePopupHeight+",top="+(e.innerHeight-o.socialsharePopupHeight)/2+",left="+(e.innerWidth-o.socialsharePopupWidth)/2)},S=function(e,o){var i="https://web.skype.com/share?source=button&url="+encodeURIComponent(o.socialshareUrl||e.location.href);o.socialshareText&&(i+="&text="+encodeURIComponent(o.socialshareText)),e.open(i,"Skype","toolbar=0,status=0,resizable=yes,width="+o.socialsharePopupWidth+",height="+o.socialsharePopupHeight+",top="+(e.innerHeight-o.socialsharePopupHeight)/2+",left="+(e.innerWidth-o.socialsharePopupWidth)/2)},T=function(e,o){var i="http://service.weibo.com/share/share.php?url="+encodeURIComponent(o.socialshareUrl||e.location.href);o.socialshareText&&(i+="&title="+encodeURIComponent(o.socialshareText)),e.open(i,"Weibo","toolbar=0,status=0,resizable=yes,width="+o.socialsharePopupWidth+",height="+o.socialsharePopupHeight+",top="+(e.innerHeight-o.socialsharePopupHeight)/2+",left="+(e.innerWidth-o.socialsharePopupWidth)/2)},z=["$window","$log",function(e,o){this.emailShare=r,this.facebookShare=s,this.twitterShare=c,this.stumbleuponShare=l,this.pinterestShare=u,this.googleShare=p,this.bufferShare=U,this.hackernewsShare=k,this.okShare=b,this.deliciousShare=w,this.pocketShare=H,this.vkShare=m,this.flipboardShare=P,this.xingShare=v,this.diggShare=g,this.linkedinShare=d,this.wordpressShare=W,this.telegramShare=y,this.redditShare=n,this.evernoteShare=R,this.tumblrShare=f,this.skypeShare=S,this.smsShare=I,this.weiboShare=T,this.share=function(i){switch(i.provider){case"email":this.emailShare(e,i.attrs);break;case"sms":this.smsShare(e,o,i.attrs);break;case"facebook":this.facebookShare(e,i.attrs);break;case"twitter":this.twitterShare(e,i.attrs);break;case"pinterest":this.pinterestShare(e,i.attrs);break;case"ok":this.okShare(e,i.attrs);break;case"vk":this.vkShare(e,i.attrs);break;case"delicious":this.deliciousShare(e,i.attrs);break;case"digg":this.diggShare(e,i.attrs);break;case"google":this.googleShare(e,i.attrs);break;case"reddit":this.redditShare(e,i.attrs);break;case"hackernews":this.hackernewsShare(e,i.attrs);break;case"skype":this.skypeShare(e,i.attrs);break;case"evernote":this.evernoteShare(e,i.attrs);break;case"pocket":this.pocketShare(e,i.attrs);break;case"tumblr":this.tumblrShare(e,i.attrs);break;case"telegram":this.telegramShare(e,i.attrs);break;case"xing":this.xingShare(e,i.attrs);break;case"buffer":this.bufferShare(e,i.attrs);break;case"stumbleupon":this.stumbleuponShare(e,i.attrs);break;case"linkedin":this.linkedinShare(e,i.attrs);break;case"wordpress":this.wordpressShare(e,i.attrs);break;case"flipboard":this.flipboardShare(e,i.attrs);break;case"weibo":this.weiboShare(e,i.attrs);break;default:return}}}],_=["$window","socialshareConf","Socialshare","$log",function(e,o,i){var t=function(t,s,r){for(var h,c=0,p=(function(){return!(r.socialshareProvider in D)||void D[r.socialshareProvider](e,r,s)});c '
});
formlyConfig.setType({
name: 'textarea',
templateUrl: viewPath + "textarea.html"
});
formlyConfig.setType({
name: 'checkbox',
templateUrl: viewPath + "checkbox.html"
});
formlyConfig.setType({
name: 'checkboxlist',
controller: "checkboxlistController",
templateUrl: viewPath + "checkboxlist.html"
});
formlyConfig.setType({
name: 'radiobuttonlist',
templateUrl: viewPath + "radiobuttonlist.html"
});
formlyConfig.setType({
name: 'slider',
templateUrl: viewPath + "slider.html"
});
formlyConfig.setType({
name: 'recaptcha',
templateUrl: viewPath + "recaptcha.html",
controller: "reCaptchaController"
});
formlyConfig.setType({
name: 'phonecountrycode',
templateUrl: viewPath + "phonecountrycode.html",
controller: "phoneController"
});
formlyConfig.setType({
name: 'video',
templateUrl: viewPath + "video.html"
});
formlyConfig.setType({
name: 'fileupload',
templateUrl: viewPath + "fileupload.html",
controller: "fileUploadController"
});
bizFormlyService.Initializing.then(ConfigPluginTypes)
function ConfigPluginTypes() {
if (!bizFormlyService.Plugins.length) {
bizFormlyService.Initialized.resolve(bizFormlyService.Plugins);
return;
}
var pluginInitialized = 0;
var pluginsInitializations = bizFormlyService.Plugins.length - bizFormlyService.Plugins.GetItemsByValue('PluginJavascriptSrc', null).length;
for (var i = 0; i < bizFormlyService.Plugins.length; i++) {
window.addEventListener("FORMS_PLUGIN_" + bizFormlyService.Plugins[i].Key + "_INIT", function (data) {
var plugin = bizFormlyService.Plugins.GetItemByValue("Key", data.detail.Key);
var types = plugin.Types || [];
for (var y = 0; y < types.length; y++) {
var type = {
name: types[y].Name || undefined,
controller: window[types[y].Controller] || undefined
};
if (types[y].Template) type.template = types[y].Template;
if (types[y].TemplateUrl) type.templateUrl = siteRootPath + types[y].TemplateUrl;
formlyConfig.setType(type);
}
for (var y = 0; y < plugin.FieldTypes.length; y++) {
plugin.FieldTypes[y].PluginKey = plugin.Key;
}
pluginInitialized += 1;
if (pluginInitialized == pluginsInitializations) {
bizFormlyService.Initialized.resolve(bizFormlyService.Plugins);
}
}, false);
if (bizFormlyService.Plugins[i].PluginJavascriptSrc) {
//LOAD JAVASCRIPT
LoadJs(siteRootPath + bizFormlyService.Plugins[i].PluginJavascriptSrc);
}
}
}
};
function checkboxlistController($scope, bizFormlyService, bizCoreService) {
$scope.Init = Init;
$scope.SelectOption = SelectOption;
function SelectOption(option) {
if ($scope.formState.disabled || option.Settings.Disabled)
return;
option.Selected = !option.Selected;
if (!$scope.model[$scope.options.key])
$scope.model[$scope.options.key] = [];
if (option.Selected) {
$scope.model[$scope.options.key].push(option.Id);
if ($scope.to.allowedselections && $scope.to.allowedselections < $scope.model[$scope.options.key].length) {
var first = $scope.options.data.options.GetItemByValue('Id', $scope.model[$scope.options.key][0]);
if (first)
first.Selected = false;
$scope.model[$scope.options.key].splice(0, 1);
}
}
else
$scope.model[$scope.options.key].splice($scope.model[$scope.options.key].indexOf(option.Id), 1);
}
function Init() {
$scope.model[$scope.options.key] = [];
for (var i = 0; i < $scope.options.data.options.length; i++) {
var option = $scope.options.data.options[i];
if (option.Settings.Preselected) {
option.Selected = true;
$scope.model[$scope.options.key].push(option.Id);
}
}
}
}
function phoneController($scope, bizFormlyService, bizCoreService, $rootScope) {
$scope.GetCountries = GetCountries;
$scope.SetCountryCode = SetCountryCode;
$scope.SelectedCountryChange = SelectedCountryChange;
function SelectedCountryChange(newValue, oldValue) {
if (!newValue || !oldValue)
return;
var currentCountryCode = "+" + newValue.PhoneCountryCode;
var oldCountryCode = "+" + oldValue.PhoneCountryCode;
$scope.model[$scope.options.key] = currentCountryCode + $scope.model[$scope.options.key].substring(oldCountryCode.length, $scope.model[$scope.options.key].length);
}
function SetCountryCode() {
var countryCode = '+' + $scope.SelectedCountry.PhoneCountryCode;
if (!$scope.model[$scope.options.key]) {
$scope.model[$scope.options.key] = countryCode;
return;
}
if ($scope.model[$scope.options.key].substr(0, countryCode.length) != countryCode) {
if ($scope.model[$scope.options.key][0] != '+')
$scope.model[$scope.options.key] = countryCode + $scope.model[$scope.options.key];
else
$scope.model[$scope.options.key] = countryCode + $scope.model[$scope.options.key].substring(countryCode.length, $scope.model[$scope.options.key].length);
}
}
function GetCountries() {
bizCoreService.GetAllActiveCountries().then(GetAllActiveCountriesCallback);
function GetAllActiveCountriesCallback(response) {
$scope.Countries = BizPartCoreHelpers.getResponseValue(response, []);
$scope.SelectedCountry = $scope.Countries.GetItemByValue('CountryCode', $rootScope.LoggedInUser.CurrentCulture.substr($rootScope.LoggedInUser.CurrentCulture.length - 2)) ? $scope.Countries.GetItemByValue('CountryCode', $rootScope.LoggedInUser.CurrentCulture.substr($rootScope.LoggedInUser.CurrentCulture.length - 2)) : $scope.Countries[0];
//$scope.SelectedCountry = $scope.Countries[0];
for (var i = 0; i < $scope.Countries.length; i++)
$scope.Countries[i].Image = "/Images/StatFlags/" + $scope.Countries[i].CountryCode + ".png";
$scope.SetCountryCode();
}
}
$scope.GetCountries();
}
function reCaptchaController($scope, bizFormlyService) {
$scope.CaptchaSuccess = CaptchaSuccess;
function CaptchaSuccess(response) {
$scope.options.formControl.$setValidity("captchaResponse", false);
bizFormlyService.IsCaptchaValid(response).then(IsCaptchaValidCallback);
function IsCaptchaValidCallback(response) {
$scope.options.formControl.$setValidity("captchaResponse", BizPartCoreHelpers.getResponseValue(response));
}
}
}
function fileUploadController($scope) {
$scope.SetFile = SetFile;
function SetFile(files) {
if (!files.length)
return;
if (!$scope.files) {
$scope.files = {};
}
//causes illegal invokation, seems to be an issue with file upload and formly, might be fixed with: https://embed.plnkr.co/plunk/d2ooYR
$scope.model[$scope.options.key] = files[0];
console.log($scope.model[$scope.options.key]);
}
}
function bizFormlyService($http, backendfield, frontendfield, bizApiControllerUrls, bizContainerService, $q) {
this.Editing = false;
this.Plugins = [];
var startedInitialize = false;
var initializing = $q.defer();
this.Initializing = initializing.promise;
this.Initialized = $q.defer();
this.Initialize = function () {
if (!startedInitialize) {
this.GetPlugins().then(GetPluginsSuccess);
startedInitialize = true;
}
var service = this;
return this.Initialized.promise;
function GetPluginsSuccess(response) {
service.Plugins = BizPartCoreHelpers.getResponseValue(response, []);
initializing.resolve(service.Plugins);
}
}
this.ListenerActions = {
show: function (field, match, model) {
field.hide = !match;
if (!match)
model[field.key] = "";
},
hide: function (field, match, model) {
field.hide = match;
if (match)
model[field.key] = "";
}
}
this.DataTypes = [{
Name: "None",
Value: undefined
}, {
Name: "Email",
Value: "email"
}, {
Name: "Username",
Value: "username"
}, {
Name: "Company",
Value: "company"
}, {
Name: "Password",
Value: "password"
}, {
Name: "First name",
Value: "firstname"
}, {
Name: "Last name",
Value: "lastname"
}, {
Name: "Phone number",
Value: "phone"
}, {
Name: "Newsletter",
Value: "newsletter"
}];
this.FieldTypes = [{
Name: "Text",
Type: "input",
TypeKey: "input",
Plugins: ["BASE"],
Features: {
Placeholder: true,
DataType: true
},
Settings: [{
Name: "Content validation",
Key: "type",
Type: "select",
Values: [{
Name: "None",
Value: undefined
}, {
Name: "Email",
Value: "email"
}, {
Name: "Password",
Value: "password"
}, {
Name: "Number",
Value: "number"
}]
}]
}, {
Name: "Textarea",
Type: "textarea",
TypeKey: "textarea",
Plugins: ["BASE"],
Features: {
Placeholder: true,
DataType: true
},
Settings: []
}, {
Name: "Checkbox",
Type: "checkbox",
TypeKey: "checkbox",
Plugins: ["BASE"],
Features: {
DataType: true
},
Settings: [{
Name: "Description",
Key: "description",
Type: "text",
CultureDependent: true
}, {
Name: "Show description as info-icon",
Key: "infoicon",
Type: "checkbox"
}]
}, {
Name: "Checkbox list",
Type: "checkboxlist",
TypeKey: "checkboxlist",
Plugins: ["BASE"],
Features: {
DataType: true
},
Options: {
Enabled: true,
Images: true
},
Defaults: [{
Key: "optionsinrow",
Value: false
}],
Settings: [{
Name: "Allowed number of selections",
Key: "allowedselections",
Type: "number"
}, {
Name: "Option alignment",
Key: "optionsinrow",
Type: "radio",
Values: [{
Name: "Column",
Value: false
}, {
Name: "Row",
Value: true
}]
}]
},
{
Name: "Radiobutton list",
Type: "radiobuttonlist",
TypeKey: "radiobuttonlist",
Plugins: ["BASE"],
Features: {
DataType: true
},
Options: {
Enabled: true,
Description: true
},
Defaults: [{
Key: "optionsinrow",
Value: false
}],
Settings: [{
Name: "Option alignment",
Key: "optionsinrow",
Type: "radio",
Values: [{
Name: "Column",
Value: false
}, {
Name: "Row",
Value: true
}]
}]
},
{
Name: "Slider",
Type: "slider",
TypeKey: "slider",
Features: {
DataType: true
},
Plugins: ["BASE"],
Settings: [{
Name: "Minimum",
Key: "min",
Type: "number"
}, {
Name: "Maximum",
Key: "max",
Type: "number"
}, {
Name: "Step",
Key: "step",
Type: "number"
}, {
Name: "Unit",
Key: "unit",
Type: "text"
}],
Defaults: [{
Key: "min",
Value: 0
}, {
Key: "max",
Value: 10
}, {
Key: "step",
Value: 1
}]
}, {
Name: "ReCaptcha",
Type: "recaptcha",
TypeKey: "recaptcha",
Plugins: ["BASE"],
Settings: []
}, {
Name: "Phone w/ country code",
Type: "phonecountrycode",
TypeKey: "phonecountrycode",
Plugins: ["BASE"],
Features: {
DataType: true
},
Features: {
Placeholder: true,
},
Settings: []
}, {
Name: "Label",
Type: "label",
TypeKey: "label",
Plugins: ["BASE"]
}, {
Name: "Video",
Type: "video",
TypeKey: "video",
Plugins: ["BASE"],
Settings: [{
Name: "Video file",
Key: "video",
Type: "mediabank",
TypeOptions: {
FileType: 1
},
CultureDependent: true
}]
}, {
Name: "File upload",
Type: "fileupload",
TypeKey: "fileupload",
Plugins: ["BASE"],
Settings: []
}];
this.FieldWidthClasses = [{
Name: "100%",
Value: "",
}, {
Name: "50%",
Value: "fw50",
}, {
Name: "33%",
Value: "fw33",
}, {
Name: "25%",
Value: "fw25",
}, {
Name: "20%",
Value: "fw20",
}];
var getUserServicePath = function () {
return siteRootPath + (bizApiControllerUrls["FormsUser"] || 'Modules/BizContainer/Forms/WS/BizFormsUserService.asmx/')
}
this.IsCaptchaValid = function (encodedResponse) {
return $http.get(getUserServicePath() + "IsCaptchaValid", {
params: {
encodedResponse: encodedResponse
}
});
};
this.GetPlugins = function () {
return bizContainerService.MakeGetRequestWithUrl(getUserServicePath() + "GetPlugins", {});
};
this.GetFieldTypes = function (pluginKey) {
var plugin = this.Plugins.GetItemByValue('Key', pluginKey);
if (!plugin)
return [];
var commonFieldTypes = [];
for (var i = 0; i < this.FieldTypes.length; i++) {
if (plugin.UseBaseFields || this.FieldTypes[i].Plugins && this.FieldTypes[i].Plugins.indexOf(pluginKey) > -1)
commonFieldTypes.push(this.FieldTypes[i]);
}
if (plugin.FieldTypes) {
return plugin.FieldTypes.concat(commonFieldTypes);
}
else {
return commonFieldTypes;
}
}
this.GetFieldsForBackend = function (fields) {
var backendFields = [];
for (var i = 0; i < fields.length; i++) {
backendFields.push(new backendfield(fields[i]));
}
return backendFields;
}
this.GetFieldsForFrontend = function (fields) {
var frontendFields = [];
fields = fields.sort(function (a, b) {
return a.Order - b.Order;
});
for (var i = 0; i < fields.length; i++) {
frontendFields.push(new frontendfield(fields[i]));
}
return frontendFields;
}
this.CreateFormSubmission = function (form, objectKey, objectId) {
var submission = {
FormId: form.Id,
ObjectKey: objectKey,
ObjectId: objectId,
Values: []
}
for (var key in form.Model) {
var field = form.BackendFields.GetItemByValue('Key', key);
if (!field || form.Model[key] === undefined)
continue;
var value = {
FormFieldKey: key,
FormFieldId: field.Id,
FormFieldCustomSettings: field.CustomSettings,
Value: form.Model[key].toString()
}
submission.Values.push(value);
}
return submission;
}
this.GetFormForSave = function (form) {
var saveform = {
Id: form.Id,
CreatedDateUtc: moment(form.CreatedDateUtc).format(),
ExpiresDateUtc: moment(form.ExpiresDateUtc).format(),
PublishDateUtc: moment(form.PublishDateUtc).format(),
UpdatedDateUtc: moment(form.UpdatedDateUtc).format(),
Plugin: undefined,
BackendFields: undefined,
Fields: this.GetFieldsForBackend(form.Fields),
ContainerModuleGuid: form.ContainerModuleGuid,
PluginAssemblyName: form.PluginAssemblyName,
PluginClassName: form.PluginClassName,
PluginSettings: form.PluginSettings,
NameTranslations: form.NameTranslations,
Name: form.Name,
FieldGroups: form.FieldGroups,
WizardSteps: form.WizardSteps,
Settings: form.Settings,
EmailRecipients: form.EmailRecipients,
SendConfirmEmail: form.SendConfirmEmail,
SubmissionCount: form.SubmissionCount,
CurrentUserSubmissionCount: form.CurrentUserSubmissionCount,
GiveXp: form.GiveXp,
GiveVirtualCurrency: form.GiveVirtualCurrency
};
if (!saveform.FieldGroups)
saveform.FieldGroups = [];
for (var i = 0; i < saveform.FieldGroups.length; i++) {
saveform.FieldGroups[i].Settings = JSON.stringify(saveform.FieldGroups[i].Settings);
saveform.FieldGroups[i].Order = i;
}
if (!saveform.WizardSteps)
saveform.WizardSteps = [];
for (var i = 0; i < saveform.WizardSteps.length; i++) {
saveform.WizardSteps[i].Settings = JSON.stringify(saveform.WizardSteps[i].Settings);
saveform.WizardSteps[i].Order = i;
}
return saveform;
}
this.OnFormSubmissionSuccess = function (submission, form) {
if (!form.Plugin)
return;
var plugin = this.Plugins.GetItemByValue("Key", form.Plugin.Key);
if (!plugin || !plugin.OnFormSubmissionSuccess)
return;
plugin.OnFormSubmissionSuccess(submission, form);
}
}
function backendField() {
var backendfield = function (field) {
this.Id = field.id;
this.Key = field.key;
this.Type = field.type;
this.Order = field.templateOptions.order;
this.Width = field.className;
this.IsMandatory = field.templateOptions.required;
this.Placeholder = field.templateOptions.placeholder;
this.FormFieldGroupKey = field.data.groupKey;
this.FormWizardStepKey = field.data.wizardStepKey;
this.Options = field.data.options;
if (this.Options) {
for (var i = 0; i < this.Options.length; i++) {
this.Options[i].Settings = JSON.stringify(this.Options[i].Settings);
if (this.Options[i].Image)
this.Options[i].Image = JSON.stringify(this.Options[i].Image);
var images = this.Options[i].Translations.GetItemsByValue('Type', 5);
for (var j = 0; j < images.length; j++) {
images[j].Value = JSON.stringify(images[j].Value);
}
}
}
field.data.options = undefined;
if (field.data.translations) {
this.NameTranslations = field.data.translations.GetItemsByValue('Type', 1);
this.PlaceholderTranslations = field.data.translations.GetItemsByValue('Type', 2);
field.data.translations = undefined;
}
this.CustomSettings = JSON.stringify({
TemplateOptions: field.templateOptions,
Data: field.data
});
}
return backendfield;
}
function frontendField() {
function getName(field) {
var maxLength = 50;
if (field.Name == null) {
return '';
}
else if (field.Name.length > maxLength) {
return field.Name.substring(0, maxLength) + "...";
}
else {
return field.Name;
}
}
var frontendfield = function (field) {
this.id = field.Id.toString();
this.key = field.Key;
this.name = getName(field);
this.type = field.Type;
this.className = field.Width || "";
var customSettings = JSON.parse(field.CustomSettings);
this.templateOptions = customSettings.TemplateOptions || {};
this.templateOptions.label = field.Name;
this.templateOptions.friendlyLabel = field.Name ? field.Name.replace(/\##(?:.|\n)*?\##/gmi, '') : "";
this.templateOptions.placeholder = field.Placeholder;
this.templateOptions.order = field.Order;
this.data = customSettings.Data || {};
this.data.groupKey = field.FormFieldGroupKey;
this.data.wizardStepKey = field.FormWizardStepKey;
this.data.options = field.Options;
if (this.data.options) {
for (var i = 0; i < this.data.options.length; i++) {
if (this.data.options[i].Settings)
this.data.options[i].Settings = JSON.parse(this.data.options[i].Settings);
else
this.data.options[i].Settings = {}
if (this.data.options[i].Image)
this.data.options[i].Image = JSON.parse(this.data.options[i].Image);
var images = this.data.options[i].Translations.GetItemsByValue('Type', 5);
for (var j = 0; j < images.length; j++) {
if (!images[j].Value)
continue;
images[j].Value = JSON.parse(images[j].Value);
}
}
}
this.data.translations = field.NameTranslations.concat(field.PlaceholderTranslations);
}
return frontendfield;
}
function formFieldFactory(bizFormlyService) {
var formField = function (type, cultureId, plugin) {
if (!type)
type = bizFormlyService.GetFieldTypes("BASE")[0];
this.id = "0";
this.key = Math.random().toString(36).substr(2, 10);
this.type = type.Type || "";
var name = "New " + (plugin && plugin.FieldName ? plugin.FieldName.toLowerCase() : "field");
this.data = {
typeKey: type.TypeKey,
translations: [{
CultureId: cultureId,
Type: 1,
Value: name
}],
groupKey: ""
};
if (type.Options && type.Options.Enabled) {
this.data.options = [{
Translations: [{
CultureId: cultureId,
Type: 1,
Value: "First option"
}]
}];
}
this.className = "";
this.templateOptions = {
required: type.IsMandatory,
label: name,
placeholder: ""
}
}
return formField;
}
})(window.angular);
(function (angular) {
angular.module('bizFormly').directive('bizFormEdit', bizFormEditDirective);
bizFormEditDirective.$inject = ["bizFormlyService", "formfield"];
function bizFormEditDirective(bizFormlyService, formfield) {
var directive = {
restrict: "E",
templateUrl: siteRootPath + "Js/AngularModules/BizFormly/bizformedit.html",
controller: bizFormEditController,
bindToController: true,
controllerAs: "vm",
scope: {
Form: "=form",
Culture: "=culture",
DisabledPlugins: "=?disabledPlugins",
EnabledPlugins: "=?enabledPlugins",
Minimal: "=minimal"
}
}
bizFormEditController.$inject = ["$rootScope", "$scope", "$mdDialog", "$timeout", "effectTypes"];
function bizFormEditController($rootScope, $scope, $mdDialog, $timeout, effectTypes) {
var vm = this;
vm.EffectTypes = effectTypes;
vm.EffectTypes.unshift({
SystemName: 'NONE',
DisplayName: 'None'
});
vm.FieldWidthClasses = bizFormlyService.FieldWidthClasses;
vm.FieldTypeChanged = FieldTypeChanged;
vm.FormPluginTypes = [];
vm.FormSettings = {
"SEND_EMAIL": {
Value: false
},
"ALLOW_MULTIPLE_SUBMISSIONS_FROM_SAME_USER": {
Value: false
},
"ONCE_PER_LOGGED_IN_DAY": {
Value: false
},
"MAX_ONCE_PER_DAY": {
Value: false
},
"EFFECT_ON_SUBMIT": {
Value: undefined
}
}
vm.TranslationTypes = {
Name: {
Value: 1,
Key: "label"
},
Placeholder: {
Value: 2,
Key: "placeholder"
},
Description: {
Value: 4
},
Image: {
Value: 5
}
}
vm.FieldListenerActions = [{
Name: "Show",
Value: "show"
}, {
Name: "Hide",
Value: "hide"
}];
vm.Init = Init;
vm.LoadSettings = LoadSettings;
vm.AddField = AddField;
vm.EditField = EditField;
vm.DeleteField = DeleteField;
vm.AddGroup = AddGroup;
vm.EditGroup = EditGroup;
vm.DeleteGroup = DeleteGroup;
vm.AddWizardStep = AddWizardStep;
vm.EditWizardStep = EditWizardStep;
vm.DeleteWizardStep = DeleteWizardStep;
vm.ReloadField = ReloadField;
vm.GetSettingModel = GetSettingModel;
vm.GetTranslation = GetTranslation;
vm.GetGroupTranslation = GetGroupTranslation;
vm.GetFormTranslation = GetFormTranslation;
vm.ChangePluginType = ChangePluginType;
vm.PopulatePluginTypes = PopulatePluginTypes;
vm.SetDefaultValues = SetDefaultValues;
vm.UpdateFriendlyLabel = UpdateFriendlyLabel;
vm.AddFieldOption = AddFieldOption;
vm.ToggleOption = ToggleOption;
vm.GetOptionTranslation = GetOptionTranslation;
vm.ChangeFieldOrder = ChangeFieldOrder;
vm.GetDataTypes = GetDataTypes;
vm.AddListener = AddListener;
vm.TriggerReload = TriggerReload;
vm.UpdateSetting = UpdateSetting;
vm.CloseDialog = CloseDialog;
function CloseDialog() {
$mdDialog.hide();
}
function EditGroup(group) {
vm.ExpandedGroup = group;
$mdDialog.show({
templateUrl: 'bizformfieldgroupeditdialog.tmpl.html',
scope: $scope,
parent: angular.element(document.body),
preserveScope: true,
clickOutsideToClose: true
}).then(cancel, cancel);
function cancel() {
vm.ExpandedGroup = undefined;
}
}
function EditField(field) {
vm.ExpandedField = field;
$mdDialog.show({
templateUrl: siteRootPath + 'Js/AngularModules/BizFormly/bizformfieldeditdialog.html',
scope: $scope,
parent: angular.element(document.body),
preserveScope: true,
clickOutsideToClose: true
}).then(cancel, cancel);
function cancel() {
vm.ExpandedField = undefined;
}
}
function TriggerReload() {
$rootScope.$broadcast('BIZFORM_FIELDS_CHANGED');
}
function AddListener(field) {
if (!field.data.listeners)
field.data.listeners = [];
field.data.listeners.push({})
}
function GetDataTypes() {
return bizFormlyService.DataTypes;
}
function GetSettingModel(field, setting) {
if (!field.templateOptions)
field.templateOptions = {};
if (!setting.CultureDependent)
return field.templateOptions;
if (!field.templateOptions.CultureOptions)
field.templateOptions.CultureOptions = {};
if (!field.templateOptions.CultureOptions[vm.Culture.Id])
field.templateOptions.CultureOptions[vm.Culture.Id] = {};
return field.templateOptions.CultureOptions[vm.Culture.Id];
}
function DeleteGroup(group) {
for (var i = 0; i < vm.Form.Fields.length; i++) {
if (vm.Form.Fields[i].data.groupKey == group.Key) {
vm.Form.Fields[i].data.groupKey = '';
vm.TriggerReload();
}
}
vm.SelectedGroup = undefined;
vm.Form.FieldGroups.Remove(group);
}
function DeleteWizardStep(wizardStep) {
for (var i = 0; i < vm.Form.Fields.length; i++) {
if (vm.Form.Fields[i].data.wizardKey == wizardStep.Key) {
vm.Form.Fields[i].data.wizardKey = '';
vm.TriggerReload();
}
}
vm.Form.WizardSteps.Remove(wizardStep);
}
function ChangeFieldOrder(field, change) {
var fields = [];
for (var i = 0; i < vm.Form.Fields.length; i++) {
if (vm.Form.Fields[i].data.groupKey == field.data.groupKey)
fields.push(vm.Form.Fields[i]);
}
var index = fields.indexOf(field);
var swapto = fields[index + change];
vm.Form.Fields.SwapItems(field, swapto);
vm.TriggerReload();
}
function FieldTypeChanged(field) {
if (!vm.FieldType[field.type])
return;
field.data.pluginKey = vm.FieldType[field.type].PluginKey;
vm.SetDefaultValues(field);
return vm.ReloadField(field);
}
function AddFieldOption(field) {
if (!field.data.options)
field.data.options = [];
field.data.options.push({
FormFieldId: field.Id,
Value: 0,
Translations: [{
Type: 1,
CultureId: vm.Culture.Id,
Value: 'New option'
}],
Settings: {}
});
}
function ToggleOption(option) {
option.Value = ~~!option.Value;
}
function UpdateFriendlyLabel(field) {
var name = vm.GetTranslation(field, vm.TranslationTypes.Name);
field.templateOptions.friendlyLabel = name ? name.Value.replace(/\##(?:.|\n)*?\##/gmi, '') : "";
}
function ReloadField(field) {
var copy = angular.copy(field);
var index = vm.Form.Fields.indexOf(field);
vm.Form.Fields[index] = copy;
vm.TriggerReload();
return copy;
}
function GetFormTranslation() {
if (!vm.Culture)
return;
var translation = vm.Form.NameTranslations.GetItemByValue('CultureId', vm.Culture.Id)
if (!translation) {
translation = {
CultureId: vm.Culture.Id,
Type: 1,
Value: ""
}
vm.Form.NameTranslations.push(translation);
}
return translation;
}
function GetGroupTranslation(group) {
if (!vm.Culture || !group || !group.Translations)
return;
var translation = group.Translations.GetItemByValue('CultureId', vm.Culture.Id);
if (!translation) {
translation = {
CultureId: vm.Culture.Id,
Type: 1,
Value: ""
}
group.Translations.push(translation);
}
if (translation.Value)
group.Name = translation.Value;
return translation;
}
function GetTranslation(field, type) {
if (!vm.Culture || !field || !field.data || !field.data.translations)
return;
var translation = field.data.translations.GetItemsByValue('CultureId', vm.Culture.Id).GetItemByValue('Type', type.Value);
if (!translation) {
translation = {
FieldKey: field.key,
CultureId: vm.Culture.Id,
Type: type.Value,
Value: ""
};
var otherCulture = field.data.translations.GetItemsByValue('FieldKey', field.key).GetItemByValue('Type', type.Value);
if (otherCulture) {
field.data[type.Key] = "No translation: " + otherCulture.Value;
}
field.data.translations.push(translation);
}
field.templateOptions[type.Key] = translation.Value;
return translation;
}
function GetOptionTranslation(option, type) {
var cultureId = vm.Culture.Id;
var translations = option.Translations.GetItemsByValue('Type', type.Value);
var translation = translations.GetItemByValue('CultureId', cultureId);
if (!translation) {
translation = {
ObjectId: option.id,
CultureId: cultureId,
Type: type.Value,
Value: ""
};
if (translations.length) {
if (!option.Placeholder) option.Placeholder = {};
option.Placeholder[type.Value] = "No translation: " + translations[0].Value;
}
option.Translations.push(translation);
}
if (type == vm.TranslationTypes.Name)
option.Name = translation.Value;
else if (type == vm.TranslationTypes.Description)
option.Description = translation.Value;
else if (type == vm.TranslationTypes.Image)
option.Image = translation.Value;
return translation;
}
function DeleteField(field) {
vm.Form.Fields.Remove(field);
vm.TriggerReload();
}
function AddGroup() {
var group = {
Key: Math.random().toString(36).substr(2, 10),
Translations: [],
Fields: [],
Settings: {},
FormId: vm.Form.Id,
Name: "Group " + (vm.Form.FieldGroups.length + 1)
}
if (vm.Culture) {
group.Translations.push({
CultureId: vm.Culture.Id,
Value: group.Name
});
}
vm.Form.FieldGroups.push(group);
vm.EditGroup(group);
}
function EditWizardStep(step) {
vm.ExpandedWizardStep = step;
$mdDialog.show({
templateUrl: 'bizformwizardstepedit.tmpl.html',
scope: $scope,
parent: angular.element(document.body),
preserveScope: true,
clickOutsideToClose: true
}).then(cancel, cancel);
function cancel() {
vm.ExpandedWizardStep = undefined;
}
}
function AddWizardStep() {
var wizardStep = {
Key: Math.random().toString(36).substr(2, 10),
Translations: [],
Fields: [],
Settings: {},
FormId: vm.Form.Id,
Name: "Step " + (vm.Form.WizardSteps.length + 1)
}
if (vm.Culture) {
wizardStep.Translations.push({
CultureId: vm.Culture.Id,
Value: wizardStep.Name
});
}
vm.Form.WizardSteps.push(wizardStep);
vm.EditWizardStep(wizardStep);
}
function AddField(group) {
var field = new formfield(vm.FieldTypes[0], vm.Culture.Id, vm.Form.Plugin);
if (group)
field.data.groupKey = group.Key;
vm.Form.Fields.push(field);
field = vm.FieldTypeChanged(field);
vm.EditField(field);
}
function SetDefaultValues(field) {
var fieldType = vm.FieldType[field.data.typeKey];
if (!fieldType)
return;
if (!fieldType.Options || !fieldType.Options.Enabled)
field.data.options = undefined;
field.type = fieldType.Type;
field.templateOptions.required = fieldType.IsMandatory;
if (fieldType.Defaults && fieldType.Defaults.length > 0) {
for (var i = 0; i < fieldType.Defaults.length; i++) {
var val = fieldType.Defaults[i].Value;
if (val === "undefined") {
val = undefined;
}
field.templateOptions[fieldType.Defaults[i].Key] = val;
}
}
}
function ChangePluginType() {
var fieldTypes = bizFormlyService.GetFieldTypes(vm.SelectedPluginKey);
var fieldType = {};
for (var i = 0; i < fieldTypes.length; i++) {
fieldType[fieldTypes[i].Type] = fieldTypes[i];
}
var invalidFields = [];
for (var i = 0; i < vm.Form.Fields.length; i++) {
if (!fieldType[vm.Form.Fields[i].type])
invalidFields.push(vm.Form.Fields[i]);
}
if (invalidFields.length) {
$mdDialog.show(
$mdDialog.confirm()
.title("Warning")
.textContent("Changing form type would render " + invalidFields.length + " fields invalid and therefore deleted. Are you sure you want to change form type?")
.ok("Yes")
.cancel("No"))
.then(function () {
PerformPluginChange(invalidFields);
}, function () {
vm.SelectedPluginKey = vm.PreviousSelectedPluginKey;
});
return;
}
PerformPluginChange();
function PerformPluginChange(invalidFields) {
vm.PreviousSelectedPluginKey = vm.SelectedPluginKey;
vm.FieldTypes = fieldTypes;
vm.FieldType = fieldType;
if (invalidFields && invalidFields.length) {
for (var i = 0; i < invalidFields.length; i++) {
vm.Form.Fields.Remove(invalidFields[i]);
}
}
if (!vm.SelectedPluginKey) {
vm.Form.Plugin = null;
vm.Form.PluginAssemblyName = null;
vm.Form.PluginClassName = null;
return;
}
var plugin = bizFormlyService.Plugins.GetItemByValue("Key", vm.SelectedPluginKey);
vm.Form.Plugin = plugin;
vm.Form.PluginAssemblyName = plugin.AssemblyName;
vm.Form.PluginClassName = plugin.ClassName;
}
}
function PopulatePluginTypes() {
for (var i = 0; i < bizFormlyService.Plugins.length; i++) {
var plugin = bizFormlyService.Plugins[i];
if (vm.DisabledPlugins && vm.DisabledPlugins.indexOf(plugin.Key) > -1
|| vm.EnabledPlugins && vm.EnabledPlugins.indexOf(plugin.Key) == -1)
continue;
vm.FormPluginTypes.push({
Name: plugin.Name,
Key: plugin.Key
});
}
}
function UpdateSetting(key) {
var setting = vm.Form.Settings.GetItemByValue('Key', key);
if (!setting) {
setting = {
Key: key
}
vm.Form.Settings.push(setting);
}
setting.Value = vm.FormSettings[key].Value;
if (key === 'ONCE_PER_LOGGED_IN_DAY' && setting.Value) {
forceSettingToFalse('MAX_ONCE_PER_DAY');
} else if (key === 'MAX_ONCE_PER_DAY' && setting.Value) {
forceSettingToFalse('ONCE_PER_LOGGED_IN_DAY');
}
if (setting.Key === 'ALLOW_MULTIPLE_SUBMISSIONS_FROM_SAME_USER' && !setting.Value) {
forceSettingToFalse('ONCE_PER_LOGGED_IN_DAY');
forceSettingToFalse('MAX_ONCE_PER_DAY');
}
if (setting.Key === 'EFFECT_ON_SUBMIT') {
setting.Value = setting.Value.SystemName;
}
function forceSettingToFalse(settingKey) {
var setting = vm.Form.Settings.GetItemByValue('Key', settingKey);
if (setting) {
setting.Value = false;
}
vm.FormSettings[settingKey].Value = false;
}
}
function LoadSettings() {
if (!vm.Form.Settings)
vm.Form.Settings = [];
for (var i = 0; i < vm.Form.Settings.length; i++) {
if (!vm.FormSettings[vm.Form.Settings[i].Key])
continue;
if (vm.Form.Settings[i].Key === 'EFFECT_ON_SUBMIT') {
var effect = vm.EffectTypes.GetItemByValue('SystemName', vm.Form.Settings[i].Value);
if (!effect) {
effect = vm.EffectTypes.GetItemByValue('SystemName', 'NONE');
}
vm.FormSettings[vm.Form.Settings[i].Key].Value = effect;
continue;
}
if (vm.Form.Settings[i].Value == 'true')
vm.Form.Settings[i].Value = true;
else if (vm.Form.Settings[i].Value == 'false')
vm.Form.Settings[i].Value = false;
else if (!isNaN(vm.Form.Settings[i].Value))
vm.Form.Settings[i].Value = parseInt(vm.Form.Settings[i].Value);
vm.FormSettings[vm.Form.Settings[i].Key].Value = vm.Form.Settings[i].Value;
}
}
function Init() {
bizFormlyService.Initialize().then(function () {
vm.MainTab = 1;
vm.PopulatePluginTypes();
vm.LoadSettings();
if (!vm.Form.Plugin) {
var plugin = vm.FormPluginTypes.GetItemByValue('Key', 'BASE');
if (!plugin)
plugin = vm.FormPluginTypes[0];
vm.Form.Plugin = plugin;
}
vm.SelectedPluginKey = vm.Form.Plugin.Key;
vm.ChangePluginType();
});
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
$rootScope.$on('FORM_ADD_FIELD', vm.AddField);
}
return directive;
}
})(window.angular);
(function (angular) {
angular.module('bizFormly').directive('bizFormShow', bizFormShowDirective);
bizFormShowDirective.$inject = ["bizFormlyService", "formfield"];
function bizFormShowDirective(bizFormlyService, formfield) {
var directive = {
restrict: "E",
templateUrl: siteRootPath + "Js/AngularModules/BizFormly/bizformshow.html",
controller: bizFormShowController,
bindToController: true,
controllerAs: "vm",
scope: {
Form: "=form",
Culture: "=?culture",
Editing: "=?editing"
}
}
bizFormShowController.$inject = ["$scope", "$rootScope", "$timeout", "$window", "$filter"];
function bizFormShowController($scope, $rootScope, $timeout, $window, $filter) {
var vm = this;
vm.Listeners = {};
vm.Init = Init;
vm.ReloadFields = ReloadFields;
vm.InitFieldListeners = InitFieldListeners;
vm.InitWatches = InitWatches;
vm.ReloadListeners = ReloadListeners;
vm.InitializeWizard = InitializeWizard;
vm.GoToWizardStep = GoToWizardStep;
vm.FormOptions = {
formState: {
culture: vm.Culture,
getCultureOptions: GetCultureOptions
}
}
function GetCultureOptions(to) {
if (!to.CultureOptions || !vm.Culture)
return to;
return to.CultureOptions[vm.Culture.Id];
}
function GoToWizardStep(index) {
$window.scrollTo(0, 0);
vm.CurrentWizardStep = index;
vm.Form.HideSubmit = index < $filter('filter')(vm.Form.WizardSteps, { 'Hidden': false }).length - 1;
}
function InitializeWizard() {
vm.CurrentWizardStep = 0;
vm.Form.HideSubmit = true;
}
function ReloadListeners() {
for (var key in vm.Listeners) {
if (!vm.Listeners[key].Cancel)
continue;
vm.Listeners[key].Cancel();
vm.Listeners[key] = {};
}
for (var i = 0; i < vm.Form.Fields.length; i++) {
vm.InitFieldListeners(vm.Form.Fields[i]);
}
}
function InitFieldListeners(field) {
if (!field.data.listeners)
return;
for (var j = 0; j < field.data.listeners.length; j++) {
InitFieldListeners(field.data.listeners[j]);
}
function InitFieldListeners(listener) {
var listenerKey = field.key + listener.Key;
if (vm.Listeners[listenerKey] && vm.Listeners[listenerKey].Listeners)
return;
vm.Listeners[listenerKey] = {
Listeners: field.data.listeners.GetItemsByValue("Key", listener.Key)
}
vm.Listeners[listenerKey].Cancel = $scope.$watch(function () {
return vm.Form.Model[listener.Key];
}, function (newValue) {
var value = "";
if (newValue != null)
value = newValue.toString();
for (var i = 0; i < vm.Listeners[listenerKey].Listeners.length; i++) {
var regex = new RegExp(vm.Listeners[listenerKey].Listeners[i].Value, "gi");
var match = value.match(regex);
var isMatch = match != null && match.length > 0;
if (vm.Listeners[listenerKey].Listeners[i].Action)
bizFormlyService.ListenerActions[vm.Listeners[listenerKey].Listeners[i].Action](field, isMatch, vm.Form.Model);
}
})
}
}
function ReloadFields() {
vm.Form.UngroupedFields = [];
for (var i = 0; i < vm.Form.WizardSteps.length; i++) {
vm.Form.WizardSteps[i].Fields = [];
vm.Form.WizardSteps[i].FieldGroups = [];
}
for (var i = 0; i < vm.Form.FieldGroups.length; i++) {
vm.Form.FieldGroups[i].Fields = [];
if (!vm.Form.FieldGroups[i].FormWizardStepKey)
continue;
var step = vm.Form.WizardSteps.GetItemByValue('Key', vm.Form.FieldGroups[i].FormWizardStepKey);
if (step)
step.FieldGroups.push(vm.Form.FieldGroups[i]);
}
for (var i = 0; i < vm.Form.Fields.length; i++) {
if (!vm.Form.Fields[i].data.groupKey) {
vm.Form.UngroupedFields.push(vm.Form.Fields[i]);
if (!vm.Form.Fields[i].data.wizardStepKey)
continue;
var step = vm.Form.WizardSteps.GetItemByValue('Key', vm.Form.Fields[i].data.wizardStepKey);
if (step)
step.Fields.push(vm.Form.Fields[i]);
continue;
}
var group = vm.Form.FieldGroups.GetItemByValue('Key', vm.Form.Fields[i].data.groupKey);
if (group)
group.Fields.push(vm.Form.Fields[i]);
}
vm.ReloadListeners();
}
function Init() {
if (vm.Form.Plugin)
bizFormlyService.Initialize().then(InitForm);
else
InitForm();
function InitForm() {
if (!vm.Form.Model)
vm.Form.Model = {};
bizFormlyService.Editing = vm.Editing;
if (vm.Form.Initialized) {
if (vm.Editing && vm.Form.Destroyed)
vm.InitWatches();
return;
}
if (vm.Form.FieldGroups) {
for (var i = 0; i < vm.Form.FieldGroups.length; i++) {
vm.Form.FieldGroups[i].Fields = [];
if (vm.Form.FieldGroups[i].Settings)
vm.Form.FieldGroups[i].Settings = JSON.parse(vm.Form.FieldGroups[i].Settings);
else
vm.Form.FieldGroups[i].Settings = {};
}
}
if (vm.Form.WizardSteps && vm.Form.WizardSteps.length) {
vm.Form.HideSubmit = true;
for (var i = 0; i < vm.Form.WizardSteps.length; i++) {
vm.Form.WizardSteps[i].Fields = [];
vm.Form.WizardSteps[i].FieldGroups = [];
if (vm.Form.WizardSteps[i].Settings)
vm.Form.WizardSteps[i].Settings = JSON.parse(vm.Form.WizardSteps[i].Settings);
else
vm.Form.WizardSteps[i].Settings = {};
if (vm.Form.WizardSteps[i].Name === null)
vm.Form.WizardSteps[i].Hidden = true;
else
vm.Form.WizardSteps[i].Hidden = false;
}
//for (var i = 0; i < vm.Form.WizardSteps.length; i++) {
// var i = vm.Form.WizardSteps.indexOf(vm.Form.WizardSteps[i]);
// if (vm.Form.WizardSteps[i].Name === null) {
// vm.Form.WizardSteps.splice(i, 1);
// }
//}
}
if (vm.Form.Id) {
vm.Form.BackendFields = angular.copy(vm.Form.Fields);
vm.Form.Fields = bizFormlyService.GetFieldsForFrontend(vm.Form.Fields);
}
vm.ReloadFields();
vm.Form.PublishDateUtc = moment(vm.Form.PublishDateUtc).toDate();
vm.Form.ExpiresDateUtc = moment(vm.Form.ExpiresDateUtc).toDate();
LoadCss(siteRootPath + 'Js/AngularModules/BizFormly/bizformshow.css');
vm.Form.Initialized = true;
if (!vm.Editing)
return;
vm.InitWatches();
}
}
function InitWatches() {
vm.CancelFieldReloads = $rootScope.$on("BIZFORM_FIELDS_CHANGED", function () {
vm.ReloadFields();
});
vm.CancelListenerReloads = $rootScope.$on("BIZFORM_LISTENER_CHANGED", function () {
vm.ReloadListeners();
})
vm.CancelCultureWatch = $scope.$watch(function () { return vm.Culture }, function (newValue) {
if (!newValue || newValue == vm.PrevCulture)
return;
for (var i = 0; i < vm.Form.Fields.length; i++) {
var name = vm.Form.Fields[i].data.translations.GetItemsByValue('CultureId', vm.Culture.Id).GetItemByValue('Type', 1);
var placeholder = vm.Form.Fields[i].data.translations.GetItemsByValue('CultureId', vm.Culture.Id).GetItemByValue('Type', 2);
vm.Form.Fields[i].templateOptions.label = name ? name.Value : "";
vm.Form.Fields[i].templateOptions.friendlyLabel = name ? name.Value.replace(/\##(?:.|\n)*?\##/gmi, '') : "";
vm.Form.Fields[i].templateOptions.placeholder = placeholder ? placeholder.Value : "";
}
vm.PrevCulture = newValue;
});
$scope.$on("$destroy", function () {
vm.Form.Destroyed = true;
vm.CancelCultureWatch();
vm.CancelFieldReloads();
vm.CancelListenerReloads();
});
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
})(window.angular);
(function (angular) {
angular.module('bizPart').directive('bizComments', bizCommentsDirective);
angular.module('bizPart').service('bizCommentsService', bizCommentsService);
bizCommentsDirective.$inject = ["bizCore"];
bizCommentsService.$inject = ["$http"];
function bizCommentsDirective(bizCoreProvider) {
var directive = {
restrict: "E",
scope: {
objectType: "@",
objectId: "@",
commentCount: "=",
allowImage: "@?",
fromDate: "=?",
toDate: "=?",
forceDate: "=?",
customSettings: "=?"
},
templateUrl: bizCoreProvider.getView('core.directives.comments', "js/AngularModules/BizComments/bizcomments.html"),
controller: bizCommentsController,
controllerAs: "vm",
bindToController: true
}
bizCommentsController.$inject = ["bizCommentsService", "bizMediabankService", "$mdDialog", "$translate", "$q"];
function bizCommentsController(bizCommentsService, bizMediabankService, $mdDialog, $translate, $q) {
var vm = this;
vm.uploadSettings = {
FileType: bizMediabankService.FileTypes.Image,
FileLocation: bizMediabankService.UploadLocations.GenericComment,
FilePattern: '',
IsPrivate: true,
IsInvisible: false,
IsPrivateControlHidden: true,
IsInvisibleControlHidden: true,
IsUser: true
};
vm.ShowComments = true;
vm.ShowComment = true;
vm.GetComments = GetComments;
vm.AddComment = AddComment;
vm.DeleteComment = DeleteComment;
vm.EditCommentText = EditCommentText;
vm.SetEditMode = SetEditMode;
vm.SetReplyMode = SetReplyMode;
vm.SelectImage = SelectImage;
function GetComments() {
if (vm.fromDate && vm.toDate) {
bizCommentsService.GetCommentsByDate(vm.objectType, vm.objectId, vm.fromDate, vm.toDate).then(GetCommentsCallback);
} else {
bizCommentsService.GetComments(vm.objectType, vm.objectId).then(GetCommentsCallback);
}
function GetCommentsCallback(response) {
vm.Comments = BizPartCoreHelpers.getResponseValue(response, []);
for (var i = 0; i < vm.Comments.length; i++) {
if (vm.Comments[i].Data) {
vm.Comments[i].Data = JSON.parse(vm.Comments[i].Data);
}
}
vm.commentCount = vm.Comments.length;
}
LoadCss(siteRootPath + 'Js/AngularModules/BizComments/bizcomments.css');
}
function SetReplyMode(comment) {
for (var i = 0; i < vm.Comments.length; i++) {
vm.Comments[i].EditMode = false;
vm.Comments[i].Replying = comment && comment.Id === vm.Comments[i].Id;
}
}
function SetEditMode(comment) {
for (var i = 0; i < vm.Comments.length; i++) {
vm.Comments[i].Replying = false;
vm.Comments[i].EditMode = comment && comment.Id === vm.Comments[i].Id;
}
}
function EditCommentText(comment, parent) {
var data = {};
if (comment.Data) {
data = angular.copy(comment.Data);
}
if (vm.allowImage) {
data.ImageUrl = comment.EditImage ? comment.EditImage.FileUrl : undefined;
}
var commentText = parent ? parent.Reply : comment.EditComment;
bizCommentsService.UpdateCommentText(comment.Id, commentText, JSON.stringify(data)).then(UpdateCommentTextCallback);
function UpdateCommentTextCallback(response) {
comment.Comment = commentText;
comment.Data.ImageUrl = comment.EditImage ? comment.EditImage.FileUrl : '';
comment.EditMode = false;
if (parent) {
parent.Reply = "";
parent.Replying = false;
}
}
}
function SelectImage(imageFile, comment) {
bizMediabankService.ShowMediabankDialog(imageFile, null, vm.uploadSettings).then(ShowMediabankDialogCallback);
function ShowMediabankDialogCallback(file) {
if (!file)
return;
if (comment) {
comment.EditImage = file;
} else {
vm.commentImage = file;
}
}
}
function AddComment(comment, parent, data) {
if (!data) {
data = {};
}
if (vm.allowImage && vm.commentImage) {
data.ImageUrl = vm.commentImage.FileUrl
}
var cmnt = {
Comment: comment,
ObjectType: vm.objectType,
ObjectId: vm.objectId,
ParentId: -1,
Data: JSON.stringify(data)
};
if (vm.forceDate) {
cmnt.Date = moment(vm.forceDate).format('YYYY-MM-DD HH:mm:ss');
}
if (parent)
cmnt.ParentId = parent.Id
bizCommentsService.AddComment(cmnt).then(AddCommentCallback);
vm.Comment = "";
vm.commentImage = undefined;
function AddCommentCallback(response) {
cmnt = BizPartCoreHelpers.getResponseValue(response);
if (cmnt) {
if (cmnt.Data) {
cmnt.Data = JSON.parse(cmnt.Data);
}
vm.Comments.push(cmnt);
}
if (parent){
parent.Reply = "";
parent.Replying = false;
}
vm.commentCount = vm.Comments.length;
vm.ShowNew = false;
}
}
function DeleteComment(comment) {
$translate(['COMMENT.CONFIRM.TITLE', 'COMMENT.CONFIRM.CONTENT', 'COMMENT.CONFIRM.OK', 'COMMENT.CONFIRM.CANCEL']).then(ShowConfirm);
function ShowConfirm(translations) {
var confirm = $mdDialog.confirm()
.title(translations['COMMENT.CONFIRM.TITLE'] || 'Radera???')
.textContent(translations['COMMENT.CONFIRM.CONTENT'] || 'Är du säker på att du vill radera kommentaren?')
.ok(translations['COMMENT.CONFIRM.OK'] || 'Ja')
.cancel(translations['COMMENT.CONFIRM.CANCEL'] || 'Avbryt');
$mdDialog.show(confirm).then(function () {
bizCommentsService.DeleteComment(comment.Id).then(DeleteCommentCallback);
function DeleteCommentCallback(response) {
comment.Deleted = true;
}
}, function () {
});
}
}
vm.$onInit = vm.GetComments;
}
return directive;
}
function bizCommentsService($http) {
var apiPath = siteRootPath + "api/GenericComment/";
this.GetComments = function (objectType, objectId) {
return $http.get(apiPath + "GetComments", {
params: {
objectType: objectType,
objectId: objectId
}
})
};
this.GetCommentsByDate = function (objectType, objectId, from, to) {
return $http.get(apiPath + "GetCommentsByDate", {
params: {
objectType: objectType,
objectId: objectId,
from: moment(from).format('YYYY-MM-DD HH:mm:ss'),
to: moment(to).format('YYYY-MM-DD HH:mm:ss')
}
})
};
this.AddComment = function (comment) {
return $http.post(apiPath + "AddComment", comment);
};
this.UpdateCommentText = function (id, comment, data) {
var data = {
Id: id,
Comment: comment,
Data: data
};
return $http.post(apiPath + "UpdateCommentText", data);
};
this.DeleteComment = function (commentId) {
return $http.delete(apiPath + "DeleteComment", {
params: {
commentId: commentId
}
});
};
}
})(window.angular);
/*! 12.2.13 */
!window.XMLHttpRequest || window.FileAPI && FileAPI.shouldLoad || (window.XMLHttpRequest.prototype.setRequestHeader = function (a) { return function (b, c) { if ("__setXHR_" === b) { var d = c(this); d instanceof Function && d(this) } else a.apply(this, arguments) } }(window.XMLHttpRequest.prototype.setRequestHeader)); var ngFileUpload = angular.module("ngFileUpload", []); ngFileUpload.version = "12.2.13", ngFileUpload.service("UploadBase", ["$http", "$q", "$timeout", function (a, b, c) { function d(d) { function e(a) { j.notify && j.notify(a), k.progressFunc && c(function () { k.progressFunc(a) }) } function h(a) { return null != d._start && g ? { loaded: a.loaded + d._start, total: d._file && d._file.size || a.total, type: a.type, config: d, lengthComputable: !0, target: a.target } : a } function i() { a(d).then(function (a) { if (g && d._chunkSize && !d._finished && d._file) { var b = d._file && d._file.size || 0; e({ loaded: Math.min(d._end, b), total: b, config: d, type: "progress" }), f.upload(d, !0) } else d._finished && delete d._finished, j.resolve(a) }, function (a) { j.reject(a) }, function (a) { j.notify(a) }) } d.method = d.method || "POST", d.headers = d.headers || {}; var j = d._deferred = d._deferred || b.defer(), k = j.promise; return d.disableProgress || (d.headers.__setXHR_ = function () { return function (a) { a && a.upload && a.upload.addEventListener && (d.__XHR = a, d.xhrFn && d.xhrFn(a), a.upload.addEventListener("progress", function (a) { a.config = d, e(h(a)) }, !1), a.upload.addEventListener("load", function (a) { a.lengthComputable && (a.config = d, e(h(a))) }, !1)) } }), g ? d._chunkSize && d._end && !d._finished ? (d._start = d._end, d._end += d._chunkSize, i()) : d.resumeSizeUrl ? a.get(d.resumeSizeUrl).then(function (a) { d._start = d.resumeSizeResponseReader ? d.resumeSizeResponseReader(a.data) : parseInt((null == a.data.size ? a.data : a.data.size).toString()), d._chunkSize && (d._end = d._start + d._chunkSize), i() }, function (a) { throw a }) : d.resumeSize ? d.resumeSize().then(function (a) { d._start = a, d._chunkSize && (d._end = d._start + d._chunkSize), i() }, function (a) { throw a }) : (d._chunkSize && (d._start = 0, d._end = d._start + d._chunkSize), i()) : i(), k.success = function (a) { return k.then(function (b) { a(b.data, b.status, b.headers, d) }), k }, k.error = function (a) { return k.then(null, function (b) { a(b.data, b.status, b.headers, d) }), k }, k.progress = function (a) { return k.progressFunc = a, k.then(null, null, function (b) { a(b) }), k }, k.abort = k.pause = function () { return d.__XHR && c(function () { d.__XHR.abort() }), k }, k.xhr = function (a) { return d.xhrFn = function (b) { return function () { b && b.apply(k, arguments), a.apply(k, arguments) } }(d.xhrFn), k }, f.promisesCount++ , k["finally"] && k["finally"] instanceof Function && k["finally"](function () { f.promisesCount-- }), k } function e(a) { var b = {}; for (var c in a) a.hasOwnProperty(c) && (b[c] = a[c]); return b } var f = this; f.promisesCount = 0, this.isResumeSupported = function () { return window.Blob && window.Blob.prototype.slice }; var g = this.isResumeSupported(); this.isUploadInProgress = function () { return f.promisesCount > 0 }, this.rename = function (a, b) { return a.ngfName = b, a }, this.jsonBlob = function (a) { null == a || angular.isString(a) || (a = JSON.stringify(a)); var b = new window.Blob([a], { type: "application/json" }); return b._ngfBlob = !0, b }, this.json = function (a) { return angular.toJson(a) }, this.isFile = function (a) { return null != a && (a instanceof window.Blob || a.flashId && a.name && a.size) }, this.upload = function (a, b) { function c(b, c) { if (b._ngfBlob) return b; if (a._file = a._file || b, null != a._start && g) { a._end && a._end >= b.size && (a._finished = !0, a._end = b.size); var d = b.slice(a._start, a._end || b.size); return d.name = b.name, d.ngfName = b.ngfName, a._chunkSize && (c.append("_chunkSize", a._chunkSize), c.append("_currentChunkSize", a._end - a._start), c.append("_chunkNumber", Math.floor(a._start / a._chunkSize)), c.append("_totalSize", a._file.size)), d } return b } function h(b, d, e) { if (void 0 !== d) if (angular.isDate(d) && (d = d.toISOString()), angular.isString(d)) b.append(e, d); else if (f.isFile(d)) { var g = c(d, b), i = e.split(","); i[1] && (g.ngfName = i[1].replace(/^\s+|\s+$/g, ""), e = i[0]), a._fileKey = a._fileKey || e, b.append(e, g, g.ngfName || g.name) } else if (angular.isObject(d)) { if (d.$$ngfCircularDetection) throw "ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: " + e; d.$$ngfCircularDetection = !0; try { for (var j in d) if (d.hasOwnProperty(j) && "$$ngfCircularDetection" !== j) { var k = null == a.objectKey ? "[i]" : a.objectKey; d.length && parseInt(j) > -1 && (k = null == a.arrayKey ? k : a.arrayKey), h(b, d[j], e + k.replace(/[ik]/g, j)) } } finally { delete d.$$ngfCircularDetection } } else b.append(e, d) } function i() { a._chunkSize = f.translateScalars(a.resumeChunkSize), a._chunkSize = a._chunkSize ? parseInt(a._chunkSize.toString()) : null, a.headers = a.headers || {}, a.headers["Content-Type"] = void 0, a.transformRequest = a.transformRequest ? angular.isArray(a.transformRequest) ? a.transformRequest : [a.transformRequest] : [], a.transformRequest.push(function (b) { var c, d = new window.FormData; b = b || a.fields || {}, a.file && (b.file = a.file); for (c in b) if (b.hasOwnProperty(c)) { var e = b[c]; a.formDataAppender ? a.formDataAppender(d, c, e) : h(d, e, c) } return d }) } return b || (a = e(a)), a._isDigested || (a._isDigested = !0, i()), d(a) }, this.http = function (b) { return b = e(b), b.transformRequest = b.transformRequest || function (b) { return window.ArrayBuffer && b instanceof window.ArrayBuffer || b instanceof window.Blob ? b : a.defaults.transformRequest[0].apply(this, arguments) }, b._chunkSize = f.translateScalars(b.resumeChunkSize), b._chunkSize = b._chunkSize ? parseInt(b._chunkSize.toString()) : null, d(b) }, this.translateScalars = function (a) { if (angular.isString(a)) { if (a.search(/kb/i) === a.length - 2) return parseFloat(1024 * a.substring(0, a.length - 2)); if (a.search(/mb/i) === a.length - 2) return parseFloat(1048576 * a.substring(0, a.length - 2)); if (a.search(/gb/i) === a.length - 2) return parseFloat(1073741824 * a.substring(0, a.length - 2)); if (a.search(/b/i) === a.length - 1) return parseFloat(a.substring(0, a.length - 1)); if (a.search(/s/i) === a.length - 1) return parseFloat(a.substring(0, a.length - 1)); if (a.search(/m/i) === a.length - 1) return parseFloat(60 * a.substring(0, a.length - 1)); if (a.search(/h/i) === a.length - 1) return parseFloat(3600 * a.substring(0, a.length - 1)) } return a }, this.urlToBlob = function (c) { var d = b.defer(); return a({ url: c, method: "get", responseType: "arraybuffer" }).then(function (a) { var b = new Uint8Array(a.data), e = a.headers("content-type") || "image/WebP", f = new window.Blob([b], { type: e }), g = c.match(/.*\/(.+?)(\?.*)?$/); g.length > 1 && (f.name = g[1]), d.resolve(f) }, function (a) { d.reject(a) }), d.promise }, this.setDefaults = function (a) { this.defaults = a || {} }, this.defaults = {}, this.version = ngFileUpload.version }]), ngFileUpload.service("Upload", ["$parse", "$timeout", "$compile", "$q", "UploadExif", function (a, b, c, d, e) { function f(a, b, c) { var e = [i.emptyPromise()]; return angular.forEach(a, function (d, f) { 0 === d.type.indexOf("image/jpeg") && i.attrGetter("ngfFixOrientation", b, c, { $file: d }) && e.push(i.happyPromise(i.applyExifRotation(d), d).then(function (b) { a.splice(f, 1, b) })) }), d.all(e) } function g(a, b, c, e) { var f = i.attrGetter("ngfResize", b, c); if (!f || !i.isResizeSupported() || !a.length) return i.emptyPromise(); if (f instanceof Function) { var g = d.defer(); return f(a).then(function (d) { h(d, a, b, c, e).then(function (a) { g.resolve(a) }, function (a) { g.reject(a) }) }, function (a) { g.reject(a) }) } return h(f, a, b, c, e) } function h(a, b, c, e, f) { function g(d, g) { if (0 === d.type.indexOf("image")) { if (a.pattern && !i.validatePattern(d, a.pattern)) return; a.resizeIf = function (a, b) { return i.attrGetter("ngfResizeIf", c, e, { $width: a, $height: b, $file: d }) }; var j = i.resize(d, a); h.push(j), j.then(function (a) { b.splice(g, 1, a) }, function (a) { d.$error = "resize", (d.$errorMessages = d.$errorMessages || {}).resize = !0, d.$errorParam = (a ? (a.message ? a.message : a) + ": " : "") + (d && d.name), f.$ngfValidations.push({ name: "resize", valid: !1 }), i.applyModelValidation(f, b) }) } } for (var h = [i.emptyPromise()], j = 0; j < b.length; j++)g(b[j], j); return d.all(h) } var i = e; return i.getAttrWithDefaults = function (a, b) { if (null != a[b]) return a[b]; var c = i.defaults[b]; return null == c ? c : angular.isString(c) ? c : JSON.stringify(c) }, i.attrGetter = function (b, c, d, e) { var f = this.getAttrWithDefaults(c, b); if (!d) return f; try { return e ? a(f)(d, e) : a(f)(d) } catch (g) { if (b.search(/min|max|pattern/i)) return f; throw g } }, i.shouldUpdateOn = function (a, b, c) { var d = i.attrGetter("ngfModelOptions", b, c); return d && d.updateOn ? d.updateOn.split(" ").indexOf(a) > -1 : !0 }, i.emptyPromise = function () { var a = d.defer(), c = arguments; return b(function () { a.resolve.apply(a, c) }), a.promise }, i.rejectPromise = function () { var a = d.defer(), c = arguments; return b(function () { a.reject.apply(a, c) }), a.promise }, i.happyPromise = function (a, c) { var e = d.defer(); return a.then(function (a) { e.resolve(a) }, function (a) { b(function () { throw a }), e.resolve(c) }), e.promise }, i.updateModel = function (c, d, e, h, j, k, l) { function m(f, g, j, l, m) { d.$$ngfPrevValidFiles = f, d.$$ngfPrevInvalidFiles = g; var n = f && f.length ? f[0] : null, o = g && g.length ? g[0] : null; c && (i.applyModelValidation(c, f), c.$setViewValue(m ? n : f)), h && a(h)(e, { $files: f, $file: n, $newFiles: j, $duplicateFiles: l, $invalidFiles: g, $invalidFile: o, $event: k }); var p = i.attrGetter("ngfModelInvalid", d); p && b(function () { a(p).assign(e, m ? o : g) }), b(function () { }) } function n() { function a(a, b) { return a.name === b.name && (a.$ngfOrigSize || a.size) === (b.$ngfOrigSize || b.size) && a.type === b.type } function b(b) { var c; for (c = 0; c < r.length; c++)if (a(b, r[c])) return !0; for (c = 0; c < s.length; c++)if (a(b, s[c])) return !0; return !1 } if (j) { q = [], t = []; for (var c = 0; c < j.length; c++)b(j[c]) ? t.push(j[c]) : q.push(j[c]) } } function o(a) { return angular.isArray(a) ? a : [a] } function p() { function a() { b(function () { m(w ? r.concat(v) : v, w ? s.concat(u) : u, j, t, x) }, z && z.debounce ? z.debounce.change || z.debounce : 0) } var f = y ? q : v; g(f, d, e, c).then(function () { y ? i.validate(q, w ? r.length : 0, c, d, e).then(function (b) { v = b.validsFiles, u = b.invalidsFiles, a() }) : a() }, function () { for (var b = 0; b < f.length; b++) { var c = f[b]; if ("resize" === c.$error) { var d = v.indexOf(c); d > -1 && (v.splice(d, 1), u.push(c)), a() } } }) } var q, r, s, t = [], u = [], v = []; r = d.$$ngfPrevValidFiles || [], s = d.$$ngfPrevInvalidFiles || [], c && c.$modelValue && (r = o(c.$modelValue)); var w = i.attrGetter("ngfKeep", d, e); q = (j || []).slice(0), ("distinct" === w || i.attrGetter("ngfKeepDistinct", d, e) === !0) && n(d, e); var x = !w && !i.attrGetter("ngfMultiple", d, e) && !i.attrGetter("multiple", d); if (!w || q.length) { i.attrGetter("ngfBeforeModelChange", d, e, { $files: j, $file: j && j.length ? j[0] : null, $newFiles: q, $duplicateFiles: t, $event: k }); var y = i.attrGetter("ngfValidateAfterResize", d, e), z = i.attrGetter("ngfModelOptions", d, e); i.validate(q, w ? r.length : 0, c, d, e).then(function (a) { l ? m(q, [], j, t, x) : (z && z.allowInvalid || y ? v = q : (v = a.validFiles, u = a.invalidFiles), i.attrGetter("ngfFixOrientation", d, e) && i.isExifSupported() ? f(v, d, e).then(function () { p() }) : p()) }) } }, i }]), ngFileUpload.directive("ngfSelect", ["$parse", "$timeout", "$compile", "Upload", function (a, b, c, d) { function e(a) { var b = a.match(/Android[^\d]*(\d+)\.(\d+)/); if (b && b.length > 2) { var c = d.defaults.androidFixMinorVersion || 4; return parseInt(b[1]) < 4 || parseInt(b[1]) === c && parseInt(b[2]) < c } return -1 === a.indexOf("Chrome") && /.*Windows.*Safari.*/.test(a) } function f(a, b, c, d, f, h, i, j) { function k() { return "input" === b[0].tagName.toLowerCase() && c.type && "file" === c.type.toLowerCase() } function l() { return t("ngfChange") || t("ngfSelect") } function m(b) { if (j.shouldUpdateOn("change", c, a)) { var e = b.__files_ || b.target && b.target.files, f = []; if (!e) return; for (var g = 0; g < e.length; g++)f.push(e[g]); j.updateModel(d, c, a, l(), f.length ? f : null, b) } } function n(a, d) { function e(b) { a.attr("id", "ngf-" + b), d.attr("id", "ngf-label-" + b) } for (var f = 0; f < b[0].attributes.length; f++) { var g = b[0].attributes[f]; "type" !== g.name && "class" !== g.name && "style" !== g.name && ("id" === g.name ? (e(g.value), u.push(c.$observe("id", e))) : a.attr(g.name, g.value || "required" !== g.name && "multiple" !== g.name ? g.value : g.name)) } } function o() { if (k()) return b; var a = angular.element('
'), c = angular.element("
upload "); return c.css("visibility", "hidden").css("position", "absolute").css("overflow", "hidden").css("width", "0px").css("height", "0px").css("border", "none").css("margin", "0px").css("padding", "0px").attr("tabindex", "-1"), n(a, c), g.push({ el: b, ref: c }), document.body.appendChild(c.append(a)[0]), a } function p(c) { if (b.attr("disabled")) return !1; if (!t("ngfSelectDisabled", a)) { var d = q(c); if (null != d) return d; r(c); try { k() || document.body.contains(x[0]) || (g.push({ el: b, ref: x.parent() }), document.body.appendChild(x.parent()[0]), x.bind("change", m)) } catch (f) { } return e(navigator.userAgent) ? setTimeout(function () { x[0].click() }, 0) : x[0].click(), !1 } } function q(a) { var b = a.changedTouches || a.originalEvent && a.originalEvent.changedTouches; if (b) { if ("touchstart" === a.type) return w = b[0].clientX, v = b[0].clientY, !0; if ("touchend" === a.type) { var c = b[0].clientX, d = b[0].clientY; if (Math.abs(c - w) > 20 || Math.abs(d - v) > 20) return a.stopPropagation(), a.preventDefault(), !1 } return !0 } } function r(b) { j.shouldUpdateOn("click", c, a) && x.val() && (x.val(null), j.updateModel(d, c, a, l(), null, b, !0)) } function s(a) { if (x && !x.attr("__ngf_ie10_Fix_")) { if (!x[0].parentNode) return void (x = null); a.preventDefault(), a.stopPropagation(), x.unbind("click"); var b = x.clone(); return x.replaceWith(b), x = b, x.attr("__ngf_ie10_Fix_", "true"), x.bind("change", m), x.bind("click", s), x[0].click(), !1 } x.removeAttr("__ngf_ie10_Fix_") } var t = function (a, b) { return j.attrGetter(a, c, b) }; j.registerModelChangeValidator(d, c, a); var u = []; t("ngfMultiple") && u.push(a.$watch(t("ngfMultiple"), function () { x.attr("multiple", t("ngfMultiple", a)) })), t("ngfCapture") && u.push(a.$watch(t("ngfCapture"), function () { x.attr("capture", t("ngfCapture", a)) })), t("ngfAccept") && u.push(a.$watch(t("ngfAccept"), function () { x.attr("accept", t("ngfAccept", a)) })), u.push(c.$observe("accept", function () { x.attr("accept", t("accept")) })); var v = 0, w = 0, x = b; k() || (x = o()), x.bind("change", m), k() ? b.bind("click", r) : b.bind("click touchstart touchend", p), -1 !== navigator.appVersion.indexOf("MSIE 10") && x.bind("click", s), d && d.$formatters.push(function (a) { return (null == a || 0 === a.length) && x.val() && x.val(null), a }), a.$on("$destroy", function () { k() || x.parent().remove(), angular.forEach(u, function (a) { a() }) }), h(function () { for (var a = 0; a < g.length; a++) { var b = g[a]; document.body.contains(b.el[0]) || (g.splice(a, 1), b.ref.remove()) } }), window.FileAPI && window.FileAPI.ngfFixIE && window.FileAPI.ngfFixIE(b, x, m) } var g = []; return { restrict: "AEC", require: "?ngModel", link: function (e, g, h, i) { f(e, g, h, i, a, b, c, d) } } }]), function () { function a(a) { return "img" === a.tagName.toLowerCase() ? "image" : "audio" === a.tagName.toLowerCase() ? "audio" : "video" === a.tagName.toLowerCase() ? "video" : /./ } function b(b, c, d, e, f, g, h, i) { function j(a) { var g = b.attrGetter("ngfNoObjectUrl", f, d); b.dataUrl(a, g)["finally"](function () { c(function () { var b = (g ? a.$ngfDataUrl : a.$ngfBlobUrl) || a.$ngfDataUrl; i ? e.css("background-image", "url('" + (b || "") + "')") : e.attr("src", b), b ? e.removeClass("ng-hide") : e.addClass("ng-hide") }) }) } c(function () { var c = d.$watch(f[g], function (c) { var k = h; if ("ngfThumbnail" === g && (k || (k = { width: e[0].naturalWidth || e[0].clientWidth, height: e[0].naturalHeight || e[0].clientHeight }), 0 === k.width && window.getComputedStyle)) { var l = getComputedStyle(e[0]); l.width && l.width.indexOf("px") > -1 && l.height && l.height.indexOf("px") > -1 && (k = { width: parseInt(l.width.slice(0, -2)), height: parseInt(l.height.slice(0, -2)) }) } return angular.isString(c) ? (e.removeClass("ng-hide"), i ? e.css("background-image", "url('" + c + "')") : e.attr("src", c)) : void (!c || !c.type || 0 !== c.type.search(a(e[0])) || i && 0 !== c.type.indexOf("image") ? e.addClass("ng-hide") : k && b.isResizeSupported() ? (k.resizeIf = function (a, e) { return b.attrGetter("ngfResizeIf", f, d, { $width: a, $height: e, $file: c }) }, b.resize(c, k).then(function (a) { j(a) }, function (a) { throw a })) : j(c)) }); d.$on("$destroy", function () { c() }) }) } ngFileUpload.service("UploadDataUrl", ["UploadBase", "$timeout", "$q", function (a, b, c) { var d = a; return d.base64DataUrl = function (a) { if (angular.isArray(a)) { var b = c.defer(), e = 0; return angular.forEach(a, function (c) { d.dataUrl(c, !0)["finally"](function () { if (e++ , e === a.length) { var c = []; angular.forEach(a, function (a) { c.push(a.$ngfDataUrl) }), b.resolve(c, a) } }) }), b.promise } return d.dataUrl(a, !0) }, d.dataUrl = function (a, e) { if (!a) return d.emptyPromise(a, a); if (e && null != a.$ngfDataUrl || !e && null != a.$ngfBlobUrl) return d.emptyPromise(e ? a.$ngfDataUrl : a.$ngfBlobUrl, a); var f = e ? a.$$ngfDataUrlPromise : a.$$ngfBlobUrlPromise; if (f) return f; var g = c.defer(); return b(function () { if (window.FileReader && a && (!window.FileAPI || -1 === navigator.userAgent.indexOf("MSIE 8") || a.size < 2e4) && (!window.FileAPI || -1 === navigator.userAgent.indexOf("MSIE 9") || a.size < 4e6)) { var c = window.URL || window.webkitURL; if (c && c.createObjectURL && !e) { var f; try { f = c.createObjectURL(a) } catch (h) { return void b(function () { a.$ngfBlobUrl = "", g.reject() }) } b(function () { if (a.$ngfBlobUrl = f, f) { g.resolve(f, a), d.blobUrls = d.blobUrls || [], d.blobUrlsTotalSize = d.blobUrlsTotalSize || 0, d.blobUrls.push({ url: f, size: a.size }), d.blobUrlsTotalSize += a.size || 0; for (var b = d.defaults.blobUrlsMaxMemory || 268435456, e = d.defaults.blobUrlsMaxQueueSize || 200; (d.blobUrlsTotalSize > b || d.blobUrls.length > e) && d.blobUrls.length > 1;) { var h = d.blobUrls.splice(0, 1)[0]; c.revokeObjectURL(h.url), d.blobUrlsTotalSize -= h.size } } }) } else { var i = new FileReader; i.onload = function (c) { b(function () { a.$ngfDataUrl = c.target.result, g.resolve(c.target.result, a), b(function () { delete a.$ngfDataUrl }, 1e3) }) }, i.onerror = function () { b(function () { a.$ngfDataUrl = "", g.reject() }) }, i.readAsDataURL(a) } } else b(function () { a[e ? "$ngfDataUrl" : "$ngfBlobUrl"] = "", g.reject() }) }), f = e ? a.$$ngfDataUrlPromise = g.promise : a.$$ngfBlobUrlPromise = g.promise, f["finally"](function () { delete a[e ? "$$ngfDataUrlPromise" : "$$ngfBlobUrlPromise"] }), f }, d }]), ngFileUpload.directive("ngfSrc", ["Upload", "$timeout", function (a, c) { return { restrict: "AE", link: function (d, e, f) { b(a, c, d, e, f, "ngfSrc", a.attrGetter("ngfResize", f, d), !1) } } }]), ngFileUpload.directive("ngfBackground", ["Upload", "$timeout", function (a, c) { return { restrict: "AE", link: function (d, e, f) { b(a, c, d, e, f, "ngfBackground", a.attrGetter("ngfResize", f, d), !0) } } }]), ngFileUpload.directive("ngfThumbnail", ["Upload", "$timeout", function (a, c) { return { restrict: "AE", link: function (d, e, f) { var g = a.attrGetter("ngfSize", f, d); b(a, c, d, e, f, "ngfThumbnail", g, a.attrGetter("ngfAsBackground", f, d)) } } }]), ngFileUpload.config(["$compileProvider", function (a) { a.imgSrcSanitizationWhitelist && a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/), a.aHrefSanitizationWhitelist && a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/) }]), ngFileUpload.filter("ngfDataUrl", ["UploadDataUrl", "$sce", function (a, b) { return function (c, d, e) { if (angular.isString(c)) return b.trustAsResourceUrl(c); var f = c && ((d ? c.$ngfDataUrl : c.$ngfBlobUrl) || c.$ngfDataUrl); return c && !f ? (!c.$ngfDataUrlFilterInProgress && angular.isObject(c) && (c.$ngfDataUrlFilterInProgress = !0, a.dataUrl(c, d)), "") : (c && delete c.$ngfDataUrlFilterInProgress, (c && f ? e ? b.trustAsResourceUrl(f) : f : c) || "") } }]) }(), ngFileUpload.service("UploadValidate", ["UploadDataUrl", "$q", "$timeout", function (a, b, c) { function d(a) { var b = "", c = []; if (a.length > 2 && "/" === a[0] && "/" === a[a.length - 1]) b = a.substring(1, a.length - 1); else { var e = a.split(","); if (e.length > 1) for (var f = 0; f < e.length; f++) { var g = d(e[f]); g.regexp ? (b += "(" + g.regexp + ")", f < e.length - 1 && (b += "|")) : c = c.concat(g.excludes) } else 0 === a.indexOf("!") ? c.push("^((?!" + d(a.substring(1)).regexp + ").)*$") : (0 === a.indexOf(".") && (a = "*" + a), b = "^" + a.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]", "g"), "\\$&") + "$", b = b.replace(/\\\*/g, ".*").replace(/\\\?/g, ".")) } return { regexp: b, excludes: c } } function e(a, b) { null == b || a.$dirty || (a.$setDirty ? a.$setDirty() : a.$dirty = !0) } var f = a; return f.validatePattern = function (a, b) { if (!b) return !0; var c = d(b), e = !0; if (c.regexp && c.regexp.length) { var f = new RegExp(c.regexp, "i"); e = null != a.type && f.test(a.type) || null != a.name && f.test(a.name) } for (var g = c.excludes.length; g--;) { var h = new RegExp(c.excludes[g], "i"); e = e && (null == a.type || h.test(a.type)) && (null == a.name || h.test(a.name)) } return e }, f.ratioToFloat = function (a) { var b = a.toString(), c = b.search(/[x:]/i); return b = c > -1 ? parseFloat(b.substring(0, c)) / parseFloat(b.substring(c + 1)) : parseFloat(b) }, f.registerModelChangeValidator = function (a, b, c) { a && a.$formatters.push(function (d) { if (a.$dirty) { var e = d; d && !angular.isArray(d) && (e = [d]), f.validate(e, 0, a, b, c).then(function () { f.applyModelValidation(a, e) }) } return d }) }, f.applyModelValidation = function (a, b) { e(a, b), angular.forEach(a.$ngfValidations, function (b) { a.$setValidity(b.name, b.valid) }) }, f.getValidationAttr = function (a, b, c, d, e) { var g = "ngf" + c[0].toUpperCase() + c.substr(1), h = f.attrGetter(g, a, b, { $file: e }); if (null == h && (h = f.attrGetter("ngfValidate", a, b, { $file: e }))) { var i = (d || c).split("."); h = h[i[0]], i.length > 1 && (h = h && h[i[1]]) } return h }, f.validate = function (a, c, d, e, g) { function h(b, c, h) { if (a) { for (var i = a.length, j = null; i--;) { var n = a[i]; if (n) { var o = f.getValidationAttr(e, g, b, c, n); null != o && (h(n, o, i) || (-1 === k.indexOf(b) ? (n.$error = b, (n.$errorMessages = n.$errorMessages || {})[b] = !0, n.$errorParam = o, -1 === m.indexOf(n) && m.push(n), l || a.splice(i, 1), j = !1) : a.splice(i, 1))) } } null !== j && d.$ngfValidations.push({ name: b, valid: j }) } } function i(c, h, i, n, o) { function p(b, d, e) { function f(f) { if (f()) if (-1 === k.indexOf(c)) { if (d.$error = c, (d.$errorMessages = d.$errorMessages || {})[c] = !0, d.$errorParam = e, -1 === m.indexOf(d) && m.push(d), !l) { var g = a.indexOf(d); g > -1 && a.splice(g, 1) } b.resolve(!1) } else { var h = a.indexOf(d); h > -1 && a.splice(h, 1), b.resolve(!0) } else b.resolve(!0) } null != e ? n(d, e).then(function (a) { f(function () { return !o(a, e) }) }, function () { f(function () { return j("ngfValidateForce", { $file: d }) }) }) : b.resolve(!0) } var q = [f.emptyPromise(!0)]; a && (a = void 0 === a.length ? [a] : a, angular.forEach(a, function (a) { var d = b.defer(); return q.push(d.promise), !i || null != a.type && 0 === a.type.search(i) ? void ("dimensions" === c && null != f.attrGetter("ngfDimensions", e) ? f.imageDimensions(a).then(function (b) { p(d, a, j("ngfDimensions", { $file: a, $width: b.width, $height: b.height })) }, function () { d.resolve(!1) }) : "duration" === c && null != f.attrGetter("ngfDuration", e) ? f.mediaDuration(a).then(function (b) { p(d, a, j("ngfDuration", { $file: a, $duration: b })) }, function () { d.resolve(!1) }) : p(d, a, f.getValidationAttr(e, g, c, h, a))) : void d.resolve(!0) })); var r = b.defer(); return b.all(q).then(function (a) { for (var b = !0, e = 0; e < a.length; e++)if (!a[e]) { b = !1; break } d.$ngfValidations.push({ name: c, valid: b }), r.resolve(b) }), r.promise } d = d || {}, d.$ngfValidations = d.$ngfValidations || [], angular.forEach(d.$ngfValidations, function (a) { a.valid = !0 }); var j = function (a, b) { return f.attrGetter(a, e, g, b) }, k = (f.attrGetter("ngfIgnoreInvalid", e, g) || "").split(" "), l = f.attrGetter("ngfRunAllValidations", e, g); if (null == a || 0 === a.length) return f.emptyPromise({ validFiles: a, invalidFiles: [] }); a = void 0 === a.length ? [a] : a.slice(0); var m = []; h("pattern", null, f.validatePattern), h("minSize", "size.min", function (a, b) { return a.size + .1 >= f.translateScalars(b) }), h("maxSize", "size.max", function (a, b) { return a.size - .1 <= f.translateScalars(b) }); var n = 0; if (h("maxTotalSize", null, function (b, c) { return n += b.size, n > f.translateScalars(c) ? (a.splice(0, a.length), !1) : !0 }), h("validateFn", null, function (a, b) { return b === !0 || null === b || "" === b }), !a.length) return f.emptyPromise({ validFiles: [], invalidFiles: m }); var o = b.defer(), p = []; return p.push(i("maxHeight", "height.max", /image/, this.imageDimensions, function (a, b) { return a.height <= b })), p.push(i("minHeight", "height.min", /image/, this.imageDimensions, function (a, b) { return a.height >= b })), p.push(i("maxWidth", "width.max", /image/, this.imageDimensions, function (a, b) { return a.width <= b })), p.push(i("minWidth", "width.min", /image/, this.imageDimensions, function (a, b) { return a.width >= b })), p.push(i("dimensions", null, /image/, function (a, b) { return f.emptyPromise(b) }, function (a) { return a })), p.push(i("ratio", null, /image/, this.imageDimensions, function (a, b) { for (var c = b.toString().split(","), d = !1, e = 0; e < c.length; e++)Math.abs(a.width / a.height - f.ratioToFloat(c[e])) < .01 && (d = !0); return d })), p.push(i("maxRatio", "ratio.max", /image/, this.imageDimensions, function (a, b) { return a.width / a.height - f.ratioToFloat(b) < 1e-4 })), p.push(i("minRatio", "ratio.min", /image/, this.imageDimensions, function (a, b) { return a.width / a.height - f.ratioToFloat(b) > -1e-4 })), p.push(i("maxDuration", "duration.max", /audio|video/, this.mediaDuration, function (a, b) { return a <= f.translateScalars(b) })), p.push(i("minDuration", "duration.min", /audio|video/, this.mediaDuration, function (a, b) { return a >= f.translateScalars(b) })), p.push(i("duration", null, /audio|video/, function (a, b) { return f.emptyPromise(b) }, function (a) { return a })), p.push(i("validateAsyncFn", null, null, function (a, b) { return b }, function (a) { return a === !0 || null === a || "" === a })), b.all(p).then(function () { if (l) for (var b = 0; b < a.length; b++) { var d = a[b]; d.$error && a.splice(b--, 1) } l = !1, h("maxFiles", null, function (a, b, d) { return b > c + d }), o.resolve({ validFiles: a, invalidFiles: m }) }), o.promise }, f.imageDimensions = function (a) { if (a.$ngfWidth && a.$ngfHeight) { var d = b.defer(); return c(function () { d.resolve({ width: a.$ngfWidth, height: a.$ngfHeight }) }), d.promise } if (a.$ngfDimensionPromise) return a.$ngfDimensionPromise; var e = b.defer(); return c(function () { return 0 !== a.type.indexOf("image") ? void e.reject("not image") : void f.dataUrl(a).then(function (b) { function d() { var b = h[0].naturalWidth || h[0].clientWidth, c = h[0].naturalHeight || h[0].clientHeight; h.remove(), a.$ngfWidth = b, a.$ngfHeight = c, e.resolve({ width: b, height: c }) } function f() { h.remove(), e.reject("load error") } function g() { c(function () { h[0].parentNode && (h[0].clientWidth ? d() : i++ > 10 ? f() : g()) }, 1e3) } var h = angular.element("
").attr("src", b).css("visibility", "hidden").css("position", "fixed").css("max-width", "none !important").css("max-height", "none !important"); h.on("load", d), h.on("error", f); var i = 0; g(), angular.element(document.getElementsByTagName("body")[0]).append(h) }, function () { e.reject("load error") }) }), a.$ngfDimensionPromise = e.promise, a.$ngfDimensionPromise["finally"](function () { delete a.$ngfDimensionPromise }), a.$ngfDimensionPromise }, f.mediaDuration = function (a) { if (a.$ngfDuration) { var d = b.defer(); return c(function () { d.resolve(a.$ngfDuration) }), d.promise } if (a.$ngfDurationPromise) return a.$ngfDurationPromise; var e = b.defer(); return c(function () { return 0 !== a.type.indexOf("audio") && 0 !== a.type.indexOf("video") ? void e.reject("not media") : void f.dataUrl(a).then(function (b) { function d() { var b = h[0].duration; a.$ngfDuration = b, h.remove(), e.resolve(b) } function f() { h.remove(), e.reject("load error") } function g() { c(function () { h[0].parentNode && (h[0].duration ? d() : i > 10 ? f() : g()) }, 1e3) } var h = angular.element(0 === a.type.indexOf("audio") ? "
" : "").attr("src", b).css("visibility", "none").css("position", "fixed"); h.on("loadedmetadata", d), h.on("error", f); var i = 0; g(), angular.element(document.body).append(h) }, function () { e.reject("load error") }) }), a.$ngfDurationPromise = e.promise, a.$ngfDurationPromise["finally"](function () { delete a.$ngfDurationPromise }), a.$ngfDurationPromise }, f }]), ngFileUpload.service("UploadResize", ["UploadValidate", "$q", function (a, b) { var c = a, d = function (a, b, c, d, e) { var f = e ? Math.max(c / a, d / b) : Math.min(c / a, d / b); return { width: a * f, height: b * f, marginX: a * f - c, marginY: b * f - d } }, e = function (a, e, f, g, h, i, j, k) { var l = b.defer(), m = document.createElement("canvas"), n = document.createElement("img"); return n.setAttribute("style", "visibility:hidden;position:fixed;z-index:-100000"), document.body.appendChild(n), n.onload = function () { var a = n.width, b = n.height; if (n.parentNode.removeChild(n), null != k && k(a, b) === !1) return void l.reject("resizeIf"); try { if (i) { var o = c.ratioToFloat(i), p = a / b; o > p ? (e = a, f = e / o) : (f = b, e = f * o) } e || (e = a), f || (f = b); var q = d(a, b, e, f, j); m.width = Math.min(q.width, e), m.height = Math.min(q.height, f); var r = m.getContext("2d"); r.drawImage(n, Math.min(0, -q.marginX / 2), Math.min(0, -q.marginY / 2), q.width, q.height), l.resolve(m.toDataURL(h || "image/WebP", g || .934)) } catch (s) { l.reject(s) } }, n.onerror = function () { n.parentNode.removeChild(n), l.reject() }, n.src = a, l.promise }; return c.dataUrltoBlob = function (a, b, c) { for (var d = a.split(","), e = d[0].match(/:(.*?);/)[1], f = atob(d[1]), g = f.length, h = new Uint8Array(g); g--;)h[g] = f.charCodeAt(g); var i = new window.Blob([h], { type: e }); return i.name = b, i.$ngfOrigSize = c, i }, c.isResizeSupported = function () { var a = document.createElement("canvas"); return window.atob && a.getContext && a.getContext("2d") && window.Blob }, c.isResizeSupported() && Object.defineProperty(window.Blob.prototype, "name", { get: function () { return this.$ngfName }, set: function (a) { this.$ngfName = a }, configurable: !0 }), c.resize = function (a, d) { if (0 !== a.type.indexOf("image")) return c.emptyPromise(a); var f = b.defer(); return c.dataUrl(a, !0).then(function (b) { e(b, d.width, d.height, d.quality, d.type || a.type, d.ratio, d.centerCrop, d.resizeIf).then(function (e) { if ("image/jpeg" === a.type && d.restoreExif !== !1) try { e = c.restoreExif(b, e) } catch (g) { setTimeout(function () { throw g }, 1) } try { var h = c.dataUrltoBlob(e, a.name, a.size); f.resolve(h) } catch (g) { f.reject(g) } }, function (b) { "resizeIf" === b && f.resolve(a), f.reject(b) }) }, function (a) { f.reject(a) }), f.promise }, c }]), function () {
function a(a, c, d, e, f, g, h, i, j, k) {
function l() { return c.attr("disabled") || s("ngfDropDisabled", a) } function m(b, c, d) { if (b) { var e; try { e = b && b.getData && b.getData("text/html") } catch (f) { } q(b.items, b.files, s("ngfAllowDir", a) !== !1, s("multiple") || s("ngfMultiple", a)).then(function (a) { a.length ? n(a, c) : o(d, e).then(function (a) { n(a, c) }) }) } } function n(b, c) { i.updateModel(e, d, a, s("ngfChange") || s("ngfDrop"), b, c) } function o(b, c) { if (!i.shouldUpdateOn(b, d, a) || "string" != typeof c) return i.rejectPromise([]); var e = []; c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (a, b, c) { e.push(c) }); var f = [], g = []; if (e.length) { angular.forEach(e, function (a) { f.push(i.urlToBlob(a).then(function (a) { g.push(a) })) }); var h = k.defer(); return k.all(f).then(function () { h.resolve(g) }, function (a) { h.reject(a) }), h.promise } return i.emptyPromise() } function p(a, b, c, d) { var e = s("ngfDragOverClass", a, { $event: c }), f = "dragover"; if (angular.isString(e)) f = e; else if (e && (e.delay && (w = e.delay), e.accept || e.reject)) { var g = c.dataTransfer.items; if (null != g && g.length) for (var h = e.pattern || s("ngfPattern", a, { $event: c }), j = g.length; j--;) { if (!i.validatePattern(g[j], h)) { f = e.reject; break } f = e.accept } else f = e.accept } d(f) } function q(b, c, e, f) { function g(a, b) { var c = k.defer(); if (null != a) if (a.isDirectory) { var d = [i.emptyPromise()]; if (m) { var e = { type: "directory" }; e.name = e.path = (b || "") + a.name, n.push(e) } var f = a.createReader(), h = [], p = function () { f.readEntries(function (e) { try { e.length ? (h = h.concat(Array.prototype.slice.call(e || [], 0)), p()) : (angular.forEach(h.slice(0), function (c) { n.length <= j && l >= o && d.push(g(c, (b ? b : "") + a.name + "/")) }), k.all(d).then(function () { c.resolve() }, function (a) { c.reject(a) })) } catch (f) { c.reject(f) } }, function (a) { c.reject(a) }) }; p() } else a.file(function (a) { try { a.path = (b ? b : "") + a.name, m && (a = i.rename(a, a.path)), n.push(a), o += a.size, c.resolve() } catch (d) { c.reject(d) } }, function (a) { c.reject(a) }); return c.promise } var j = i.getValidationAttr(d, a, "maxFiles"); null == j && (j = Number.MAX_VALUE); var l = i.getValidationAttr(d, a, "maxTotalSize"); null == l && (l = Number.MAX_VALUE); var m = s("ngfIncludeDir", a), n = [], o = 0, p = [i.emptyPromise()]; if (b && b.length > 0 && "file:" !== h.location.protocol) for (var q = 0; q < b.length; q++) { if (b[q].webkitGetAsEntry && b[q].webkitGetAsEntry() && b[q].webkitGetAsEntry().isDirectory) { var r = b[q].webkitGetAsEntry(); if (r.isDirectory && !e) continue; null != r && p.push(g(r)) } else { var t = b[q].getAsFile(); null != t && (n.push(t), o += t.size) } if (n.length > j || o > l || !f && n.length > 0) break } else if (null != c) for (var u = 0; u < c.length; u++) { var v = c.item(u); if ((v.type || v.size > 0) && (n.push(v), o += v.size), n.length > j || o > l || !f && n.length > 0) break } var w = k.defer(); return k.all(p).then(function () { if (f || m || !n.length) w.resolve(n); else { for (var a = 0; n[a] && "directory" === n[a].type;)a++; w.resolve([n[a]]) } }, function (a) { w.reject(a) }), w.promise } var r = b(), s = function (a, b, c) { return i.attrGetter(a, d, b, c) }; if (s("dropAvailable") && g(function () { a[s("dropAvailable")] ? a[s("dropAvailable")].value = r : a[s("dropAvailable")] = r }), !r) return void (s("ngfHideOnDropNotAvailable", a) === !0 && c.css("display", "none")); null == s("ngfSelect") && i.registerModelChangeValidator(e, d, a); var t, u = null, v = f(s("ngfStopPropagation")), w = 1; c[0].addEventListener("dragover", function (b) { if (!l() && i.shouldUpdateOn("drop", d, a)) { if (b.preventDefault(), v(a) && b.stopPropagation(), navigator.userAgent.indexOf("Chrome") > -1) { var e = b.dataTransfer.effectAllowed; b.dataTransfer.dropEffect = "move" === e || "linkMove" === e ? "move" : "copy" } g.cancel(u), t || (t = "C", p(a, d, b, function (d) { t = d, c.addClass(t), s("ngfDrag", a, { $isDragging: !0, $class: t, $event: b }) })) } }, !1), c[0].addEventListener("dragenter", function (b) { !l() && i.shouldUpdateOn("drop", d, a) && (b.preventDefault(), v(a) && b.stopPropagation()) }, !1), c[0].addEventListener("dragleave", function (b) {
!l() && i.shouldUpdateOn("drop", d, a) && (b.preventDefault(),
v(a) && b.stopPropagation(), u = g(function () { t && c.removeClass(t), t = null, s("ngfDrag", a, { $isDragging: !1, $event: b }) }, w || 100))
}, !1), c[0].addEventListener("drop", function (b) { !l() && i.shouldUpdateOn("drop", d, a) && (b.preventDefault(), v(a) && b.stopPropagation(), t && c.removeClass(t), t = null, m(b.dataTransfer, b, "dropUrl")) }, !1), c[0].addEventListener("paste", function (b) { navigator.userAgent.toLowerCase().indexOf("firefox") > -1 && s("ngfEnableFirefoxPaste", a) && b.preventDefault(), !l() && i.shouldUpdateOn("paste", d, a) && m(b.clipboardData || b.originalEvent.clipboardData, b, "pasteUrl") }, !1), navigator.userAgent.toLowerCase().indexOf("firefox") > -1 && s("ngfEnableFirefoxPaste", a) && (c.attr("contenteditable", !0), c.on("keypress", function (a) { a.metaKey || a.ctrlKey || a.preventDefault() }))
} function b() { var a = document.createElement("div"); return "draggable" in a && "ondrop" in a && !/Edge\/12./i.test(navigator.userAgent) } ngFileUpload.directive("ngfDrop", ["$parse", "$timeout", "$window", "Upload", "$http", "$q", function (b, c, d, e, f, g) { return { restrict: "AEC", require: "?ngModel", link: function (h, i, j, k) { a(h, i, j, k, b, c, d, e, f, g) } } }]), ngFileUpload.directive("ngfNoFileDrop", function () { return function (a, c) { b() && c.css("display", "none") } }), ngFileUpload.directive("ngfDropAvailable", ["$parse", "$timeout", "Upload", function (a, c, d) { return function (e, f, g) { if (b()) { var h = a(d.attrGetter("ngfDropAvailable", g)); c(function () { h(e), h.assign && h.assign(e, !0) }) } } }])
}(), ngFileUpload.service("UploadExif", ["UploadResize", "$q", function (a, b) { function c(a, b, c, d) { switch (b) { case 2: return a.transform(-1, 0, 0, 1, c, 0); case 3: return a.transform(-1, 0, 0, -1, c, d); case 4: return a.transform(1, 0, 0, -1, 0, d); case 5: return a.transform(0, 1, 1, 0, 0, 0); case 6: return a.transform(0, 1, -1, 0, d, 0); case 7: return a.transform(0, -1, -1, 0, d, c); case 8: return a.transform(0, -1, 1, 0, 0, c) } } function d(a) { for (var b = "", c = new Uint8Array(a), d = c.byteLength, e = 0; d > e; e++)b += String.fromCharCode(c[e]); return window.btoa(b) } var e = a; return e.isExifSupported = function () { return window.FileReader && (new FileReader).readAsArrayBuffer && e.isResizeSupported() }, e.readOrientation = function (a) { var c = b.defer(), d = new FileReader, e = a.slice ? a.slice(0, 65536) : a; return d.readAsArrayBuffer(e), d.onerror = function (a) { return c.reject(a) }, d.onload = function (a) { var b = { orientation: 1 }, d = new DataView(this.result); if (65496 !== d.getUint16(0, !1)) return c.resolve(b); for (var e = d.byteLength, f = 2; e > f;) { var g = d.getUint16(f, !1); if (f += 2, 65505 === g) { if (1165519206 !== d.getUint32(f += 2, !1)) return c.resolve(b); var h = 18761 === d.getUint16(f += 6, !1); f += d.getUint32(f + 4, h); var i = d.getUint16(f, h); f += 2; for (var j = 0; i > j; j++)if (274 === d.getUint16(f + 12 * j, h)) { var k = d.getUint16(f + 12 * j + 8, h); return k >= 2 && 8 >= k && (d.setUint16(f + 12 * j + 8, 1, h), b.fixedArrayBuffer = a.target.result), b.orientation = k, c.resolve(b) } } else { if (65280 !== (65280 & g)) break; f += d.getUint16(f, !1) } } return c.resolve(b) }, c.promise }, e.applyExifRotation = function (a) { if (0 !== a.type.indexOf("image/jpeg")) return e.emptyPromise(a); var f = b.defer(); return e.readOrientation(a).then(function (b) { return b.orientation < 2 || b.orientation > 8 ? f.resolve(a) : void e.dataUrl(a, !0).then(function (g) { var h = document.createElement("canvas"), i = document.createElement("img"); i.onload = function () { try { h.width = b.orientation > 4 ? i.height : i.width, h.height = b.orientation > 4 ? i.width : i.height; var g = h.getContext("2d"); c(g, b.orientation, i.width, i.height), g.drawImage(i, 0, 0); var j = h.toDataURL(a.type || "image/WebP", .934); j = e.restoreExif(d(b.fixedArrayBuffer), j); var k = e.dataUrltoBlob(j, a.name); f.resolve(k) } catch (l) { return f.reject(l) } }, i.onerror = function () { f.reject() }, i.src = g }, function (a) { f.reject(a) }) }, function (a) { f.reject(a) }), f.promise }, e.restoreExif = function (a, b) { var c = {}; return c.KEY_STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", c.encode64 = function (a) { var b, c, d, e, f, g = "", h = "", i = "", j = 0; do b = a[j++], c = a[j++], h = a[j++], d = b >> 2, e = (3 & b) << 4 | c >> 4, f = (15 & c) << 2 | h >> 6, i = 63 & h, isNaN(c) ? f = i = 64 : isNaN(h) && (i = 64), g = g + this.KEY_STR.charAt(d) + this.KEY_STR.charAt(e) + this.KEY_STR.charAt(f) + this.KEY_STR.charAt(i), b = c = h = "", d = e = f = i = ""; while (j < a.length); return g }, c.restore = function (a, b) { a.match("data:image/jpeg;base64,") && (a = a.replace("data:image/jpeg;base64,", "")); var c = this.decode64(a), d = this.slice2Segments(c), e = this.exifManipulation(b, d); return "data:image/jpeg;base64," + this.encode64(e) }, c.exifManipulation = function (a, b) { var c = this.getExifArray(b), d = this.insertExif(a, c); return new Uint8Array(d) }, c.getExifArray = function (a) { for (var b, c = 0; c < a.length; c++)if (b = a[c], 255 === b[0] & 225 === b[1]) return b; return [] }, c.insertExif = function (a, b) { var c = a.replace("data:image/jpeg;base64,", ""), d = this.decode64(c), e = d.indexOf(255, 3), f = d.slice(0, e), g = d.slice(e), h = f; return h = h.concat(b), h = h.concat(g) }, c.slice2Segments = function (a) { for (var b = 0, c = []; ;) { if (255 === a[b] & 218 === a[b + 1]) break; if (255 === a[b] & 216 === a[b + 1]) b += 2; else { var d = 256 * a[b + 2] + a[b + 3], e = b + d + 2, f = a.slice(b, e); c.push(f), b = e } if (b > a.length) break } return c }, c.decode64 = function (a) { var b, c, d, e, f, g = "", h = "", i = 0, j = [], k = /[^A-Za-z0-9\+\/\=]/g; k.exec(a) && console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."), a = a.replace(/[^A-Za-z0-9\+\/\=]/g, ""); do d = this.KEY_STR.indexOf(a.charAt(i++)), e = this.KEY_STR.indexOf(a.charAt(i++)), f = this.KEY_STR.indexOf(a.charAt(i++)), h = this.KEY_STR.indexOf(a.charAt(i++)), b = d << 2 | e >> 4, c = (15 & e) << 4 | f >> 2, g = (3 & f) << 6 | h, j.push(b), 64 !== f && j.push(c), 64 !== h && j.push(g), b = c = g = "", d = e = f = h = ""; while (i < a.length); return j }, c.restore(a, b) }, e }]);
(function (angular) {
angular.module('bizMediabank', ['ngFileUpload', 'bizPart', 'ngMaterial']);
angular.module('bizMediabank').directive('bizMediabankDownload', BizMediabankDownload);
angular.module('bizMediabank').directive('bizMediabankUpload', BizMediabankUpload);
angular.module('bizMediabank').directive('bizMediabankLink', BizMediabankLink);
angular.module('bizMediabank').directive('bizMediabankButton', BizMediabankButton);
angular.module('bizMediabank').directive('bizMediabankVideo', BizMediabankVideo);
angular.module('bizMediabank').directive('bizMediabankAudio', BizMediabankAudio);
angular.module('bizMediabank').directive('bizMediabankDocument', BizMediabankDocument);
angular.module('bizMediabank').directive('bizMediabankDocLink', BizMediabankDocLink);
angular.module('bizMediabank').directive('bizMediabankVideoPlayer', BizMediabankVideoPlayer);
angular.module('bizMediabank').service('bizMediabankDownloadService', ["$http", bizMediabankDownloadService]);
angular.module('bizMediabank').service('bizMediabankUploadService', ["$http", "Upload", bizMediabankUploadService]);
angular.module('bizMediabank').service('bizMediabankService', bizMediabankService);
bizMediabankService.$inject = ['$mdDialog', "$http"];
BizMediabankVideoPlayer.$inject = ["$timeout", "bizCoreService", "bizMediabankService", "$q", "bizEngageService", "$window", "$ocLazyLoad"];
BizMediabankVideo.$inject = ["$compile", "$mdDialog"];
DownloadController.$inject = ['bizMediabankDownloadService', '$mdDialog', '$q', '$rootScope'];
UploadController.$inject = ['$rootScope', '$mdDialog', 'bizMediabankUploadService', 'bizMediabankDownloadService', '$q', 'bizMediabankService'];
BizMediabankDocument.$inject = [];
BizMediabankDocLink.$inject = [];
function BizMediabankDocLink() {
var directive = {
restrict: 'E',
scope: {
fileId: '=',
moduleGuid: '@?',
containerRef: '@?'
},
templateUrl: siteRootPath + 'Js/AngularModules/BizMediabank/views/documentlink.html',
controllerAs: 'vm',
bindToController: true,
controller: BizMediabankDocumentLinkController
};
BizMediabankDocumentLinkController.$inject = ["bizMediabankService"];
function BizMediabankDocumentLinkController(bizMediabankService) {
var vm = this;
vm.guidQS = '';
function Init() {
if (vm.moduleGuid && vm.containerRef) {
vm.guidQS = '&ref=' + vm.containerRef + '&containerguid=' + vm.moduleGuid;
}
console.log("qs", vm.guidQS);
if (vm.fileId > 0) {
bizMediabankService.GetMediabankFile(vm.fileId, vm.moduleGuid, vm.containerRef).then(GetMediabankFileCallback);
function GetMediabankFileCallback(response) {
vm.File = BizPartCoreHelpers.getResponseValue(response, {});
}
}
}
vm.$onInit = Init;
}
return directive;
}
function BizMediabankDocument() {
var directive = {
restrict: 'E',
scope: {
file: '='
},
templateUrl: siteRootPath + 'Js/AngularModules/BizMediabank/views/document.html',
controllerAs: 'vm',
bindToController: true,
controller: BizMediabankDocumentController
};
BizMediabankDocumentController.$inject = ["$filter", "$sce", "$rootScope"];
function BizMediabankDocumentController($filter, $sce, $rootScope) {
var vm = this;
vm.GetEmbedUrl = GetEmbedUrl;
function GetEmbedUrl() {
if (vm.file) {
var qs = "?v=" + $rootScope.GetDate(vm.file.PhysicalFileUpdated, 'YYYYMMDDHHmmss');
if (vm.file.FileUrl.indexOf(".pptx") > 0 || vm.file.FileUrl.indexOf(".doc") > 0) {
return $sce.trustAsResourceUrl("https://view.officeapps.live.com/op/embed.aspx?src=" + $filter('fullsitepath')(vm.file.FileUrl) + qs);
}
else if (vm.file.FileUrl.indexOf(".pdf") > 0) {
return $sce.trustAsResourceUrl($filter('fullsitepath')(vm.file.FileUrl) + qs);
}
}
}
}
return directive;
}
function BizMediabankAudio() {
var directive = {
restrict: 'E',
scope: {
file: '='
},
templateUrl: siteRootPath + 'Js/AngularModules/BizMediabank/views/audio.html',
controllerAs: 'vm',
bindToController: true,
controller: BizMediabankAudioController
};
BizMediabankAudioController.$inject = ['bizEngageService', '$window', '$scope'];
function BizMediabankAudioController(bizEngageService, $window, $scope) {
var vm = this;
vm.Init = Init;
vm.Start = Start;
vm.End = End;
vm.Cancel = Cancel;
function Cancel() {
if (!vm.file || !vm.Started || vm.Ended)
return;
bizEngageService.LogUserStatus(vm.file.Id, bizEngageService.Types.MediabankFile, bizEngageService.Status.Cancelled);
}
function Start() {
if (!vm.file || vm.Started)
return;
bizEngageService.LogUserStatus(vm.file.Id, bizEngageService.Types.MediabankFile, bizEngageService.Status.Started);
vm.Started = true;
vm.Ended = false;
}
function End() {
if (!vm.file || !vm.Started || vm.Ended)
return;
bizEngageService.LogUserStatus(vm.file.Id, bizEngageService.Types.MediabankFile, bizEngageService.Status.Finished, true);
vm.Ended = true;
vm.Started = false;
}
function Init() {
vm.Audio.onplay = vm.Start;
vm.Audio.onended = vm.End;
angular.element($window).on('beforeunload', vm.Cancel);
$scope.$on('$destroy', vm.Cancel);
}
}
return directive;
}
function BizMediabankVideoPlayer($timeout, bizCoreService, bizMediabankService, $q, bizEngageService, $window, $ocLazyLoad) {
var videoIndex = 0;
var videoEvents = {
Start: 12,
End: 13,
Init: 14
}
var directive = {
restrict: "E",
scope: {
file: "=?",
source: "@",
fileId: "@?",
onStarted: "&?",
onPlayed: "&?",
showPoster: "=?",
bizAutoplay: "@?"
},
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/video.html",
link: linkFunction
};
function linkFunction(scope, element, attrs) {
scope.videoTypes = {
Native: {
Value: 1,
Init: InitNative
},
Youtube: {
Value: 2,
Regex: /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i,
VideoCodeMatchIndex: 1,
Init: InitYoutube
},
Vimeo: {
Value: 3,
Regex: /vimeo.com\/*/gmi,
Init: InitVimeo
},
Brightcove: {
Value: 4,
Regex: /b.*?cove/gmi,
Init: InitBrightcove
},
External: {
Value: 5,
Regex: /^https?:\/\//i,
Init: InitExternal
}
};
scope.videoType = scope.videoTypes.Native;
scope.videoId = "bizmediabankvideo" + videoIndex;
videoIndex = videoIndex + 1;
scope.playVideo = PlayVideo;
angular.element($window).on('beforeunload', HandleVideoCancel);
scope.$on('$destroy', HandleVideoCancel);
function HandleVideoCancel() {
if (!scope.file || !scope.started || scope.finished)
return;
bizEngageService.LogUserStatus(scope.file.Id, bizEngageService.Types.MediabankFile, bizEngageService.Status.Cancelled);
}
function PlayVideo() {
InitPlayer().then(function () {
if (scope.player)
scope.player.playVideo();
else if (scope.video)
scope.video.play();
});
}
function SetVideoType() {
var type = scope.videoTypes.Native;
for (var key in scope.videoTypes) {
if (!scope.videoTypes.hasOwnProperty(key))
continue;
var videoType = scope.videoTypes[key];
if (!videoType.Regex)
continue;
var match = videoType.Regex.exec(scope.file.FileUrl);
if (match && match.length) {
if (videoType.VideoCodeMatchIndex >= 0)
scope.videoCode = match[videoType.VideoCodeMatchIndex];
scope.videoType = videoType;
break;
}
}
}
function InitPlayer() {
scope.initialized = true;
var deferred = $q.defer();
return scope.videoType.Init(deferred);
}
function InitVimeo(deferred) {
console.log("init vimeo");
var regex = /vimeo.*\/(\d+)/gmi
var match = regex.exec(scope.file.FileUrl);
if (match && match.length > 1) {
console.log("vimeo id", match[1]);
scope.vimeo = {
VideoId: match[1]
}
}
$timeout(function () {
var scriptKey = "biz-vimeo-script";
if (!bizMediabankService.LoadingScripts[scriptKey]) {
var tmpDefine = window['define'];//vimeo player tries to set this, but only one is allowed, and already set in admin by monaco, so we save it and reset it when the script is loaded
window['define'] = undefined;
var defer = $q.defer();
bizMediabankService.LoadingScripts[scriptKey] = defer.promise;
var s = document.createElement("script");
s.src = "https://player.vimeo.com/api/player.js";
document.body.appendChild(s);
s.onload = function () {
defer.resolve(tmpDefine);
}
}
bizMediabankService.LoadingScripts[scriptKey].then(function (tmpDefine) {
window['define'] = tmpDefine;//vimeo player tries to set this, but only one is allowed, and already set in admin by monaco, so we save it and reset it when the script is loaded
var doAutoplay = scope.bizAutoplay === 'true';
var options = {
id: scope.vimeo.VideoId,
responsive: true,
autoplay: doAutoplay
};
var ve = element.find('.biz-mediabank-vimeo');
var player = new Vimeo.Player(ve, options);
player.on("loaded", function (data) {
console.log("vimeo loaded", data);
VideoInitialized();
deferred.resolve();
});
player.on("play", function (data) {
console.log("vimeo play", data);
//this event also fires when the user seeks, but with no data, so only set videostarted when data exist
if (data) {
VideoStarted();
}
});
player.on("ended", function (data) {
console.log("vimeo end", data);
VideoEnded();
});
scope.player = {
playVideo: function () {
//console.log("play video method", player);
player.play();
}
};
});
});
return deferred.promise;
}
function InitBrightcove(deferred) {
var regex = /players\.brightcove\.net\/(.*)\/(.*)_default\/index\.html\?videoId=(.*)/gmi
var match = regex.exec(scope.file.FileUrl);
if (match && match.length) {
scope.bc = {
AccountId: match[1],
PlayerId: match[2],
VideoId: match[3]
}
}
$timeout(function () {
var html = ' '
element.find('.biz-mediabank-brightcove').html(html);
if (!bizMediabankService.LoadingScripts[scope.bc.AccountId + scope.bc.PlayerId]) {
var defer = $q.defer();
bizMediabankService.LoadingScripts[scope.bc.AccountId + scope.bc.PlayerId] = defer.promise;
var s = document.createElement("script");
s.src = "https://players.brightcove.net/" + scope.bc.AccountId + "/" + scope.bc.PlayerId + "_default/index.min.js"
document.body.appendChild(s);
s.onload = function () {
defer.resolve();
}
}
bizMediabankService.LoadingScripts[scope.bc.AccountId + scope.bc.PlayerId].then(function () {
scope.video = bc(scope.videoId);
VideoInitialized();
scope.video.on("play", VideoStarted);
scope.video.on("ended", VideoEnded);
deferred.resolve();
});
});
return deferred.promise;
}
function InitYoutube(deferred) {
$timeout(function () {
scope.player = new YT.Player(scope.videoId, {
videoId: scope.videoCode,
playerVars: { rel: 0 },
width:'100%',
events: {
'onReady': function () {
VideoInitialized();
deferred.resolve();
},
'onStateChange': OnYoutubePlayerStateChange
}
});
});
return deferred.promise;
}
function InitNative(deferred) {
$timeout(function () {
VideoInitialized();
scope.video.onplay = VideoStarted;
scope.video.onended = VideoEnded;
deferred.resolve();
});
return deferred.promise;
}
function InitExternal(deferred) {
scope.showPoster = false;
VideoInitialized();
return deferred.promise;
}
function VideoInitialized() {
if (!scope.source)
return;
bizCoreService.EventStart(scope.file.Id, videoEvents.Init);
}
function VideoStarted() {
if (!scope.file || scope.started)
return;
if (scope.onStarted)
scope.onStarted({ $file: scope.file });
scope.started = true;
scope.finished = false;
bizEngageService.LogUserStatus(scope.file.Id, bizEngageService.Types.MediabankFile, bizEngageService.Status.Started);
if (!scope.source)
return;
bizCoreService.EventStart(scope.file.Id, videoEvents.Start);
}
function VideoEnded() {
if (!scope.file || !scope.started || scope.finished)
return;
if (scope.onPlayed)
scope.onPlayed({ $file: scope.file });
scope.finished = true;
scope.started = false;
bizEngageService.LogUserStatus(scope.file.Id, bizEngageService.Types.MediabankFile, bizEngageService.Status.Finished, true);
if (!scope.source)
return;
bizCoreService.EventEnd(scope.file.Id, videoEvents.End);
}
function OnYoutubePlayerStateChange(event) {
if (event.data === -1) {
VideoStarted();
}
if (event.data === 1) {
scope.youtubePlaying = true;
}
if (event.data === 0) {
if (scope.youtubePlaying)
VideoEnded();
scope.youtubePlaying = false;
}
}
function GetFile() {
bizMediabankService.GetMediabankFile(scope.fileId).then(GetFileCallback);
function GetFileCallback(response) {
scope.file = response.data;
InitFile();
}
}
function InitFile() {
SetVideoType();
if (scope.videoType == scope.videoTypes.External)
scope.showPoster = false;
if (scope.bizAutoplay === 'true') {
PlayVideo();
}
else if(!scope.showPoster) {
InitPlayer();
}
}
$ocLazyLoad.load('videojs').then(function () {
if (scope.file)
InitFile();
if (!scope.file && scope.fileId)
GetFile();
});
}
return directive;
}
function BizMediabankVideo($compile, $mdDialog) {
var directive = {
restrict: "E",
scope: {
file: "=?",
source: "@",
fileId: "@?",
onStarted: "&?",
onPlayed: "&?",
showPoster: "=?",
showInPopup: "@?",
autoplay: "@?"
},
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/VideoPlayerContainer.html",
link: linkFunction
};
function linkFunction(scope, element, attrs) {
scope.$watch('file', function (value, oldValue) {
if (!oldValue || value == oldValue
|| (value.FileSource == oldValue.FileSource && value.FileUrl == oldValue.FileUrl
&& value.Thumbnail == oldValue.Thumbnail && value.ThumbnailSource == oldValue.ThumbnailSource
&& value.Type == oldValue.Type))
return;
$compile(element.contents())(scope);
}, true);
scope.$watch('fileId', function (value, oldValue) {
if (!oldValue || value == oldValue)
return;
$compile(element.contents())(scope);
console.log("VideoPlayerContainer file id watch ap", scope.autoplay);
}, true);
scope.ShowPopup = function () {
$mdDialog.show({
parent: angular.element(document.body),
template: '',
clickOutsideToClose: true,
scope: scope,
preserveScope: true
});
}
}
return directive;
}
function BizMediabankButton() {
return {
restrict: 'E',
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/button.html",
controller: ButtonController,
controllerAs: 'vm',
bindToController: true,
scope: {
file: '=',
fileType: '@',
uploadLocation: "@?",
settings: "=?",
setDirty: "@?"
}
}
ButtonController.$inject = ["bizMediabankService", "$rootScope", "$scope"];
function ButtonController(bizMediabankService, $rootScope, $scope) {
var vm = this;
vm.ShowMediabankDialog = ShowMediabankDialog;
vm.GetOpenIcon = GetOpenIcon;
vm.GetOpenTitle = GetOpenTitle;
function GetOpenIcon() {
switch (~~vm.fileType) {
case 1:
return ['fal fa-file-video'];
case 2:
return ['fal fa-file-image'];
case 3:
return ['fal fa-file-audio'];
case 4:
return ['fal fa-file-pdf'];
default:
return ['fal fa-file'];
}
}
function GetOpenTitle() {
switch (~~vm.fileType) {
case 1:
return 'Select video';
case 2:
return 'Select image';
case 3:
return 'Select audio';
case 4:
return 'Select document';
default:
return 'Select file';
}
}
function ShowMediabankDialog() {
bizMediabankService.ShowMediabankDialog(vm.fileType, vm.uploadLocation, vm.settings).then(ShowMediabankDialogCallback);
function ShowMediabankDialogCallback(file) {
if (!file)
return;
vm.file = file;
if (vm.setDirty == "true") {
$rootScope.$broadcast('PAGE_DIRTY', true);
}
}
}
function Init() {
}
vm.$onInit = Init;
}
}
function BizMediabankDownload() {
return {
restrict: 'E',
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/download.html",
controller: DownloadController,
controllerAs: 'vm',
bindToController: true,
scope: {
fileType: '@',
callback: '&',
closeCallback: '&'
}
}
}
function BizMediabankUpload() {
return {
restrict: 'E',
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/upload.html",
controller: UploadController,
controllerAs: 'vm',
bindToController: true,
scope: {
callback: '&',
closeCallback: '&',
pattern: '@',
uploadedFrom: '@',
settings: '='
}
}
}
function BizMediabankLink() {
var directive = {
restrict: 'E',
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/link.html",
controller: LinkController,
controllerAs: 'vm',
bindToController: true,
scope: {
callback: '&',
closeCallback: '&',
uploadedFrom: '@',
settings: '=',
fileType: "@?"
}
};
LinkController.$inject = ["bizMediabankDownloadService", "bizMediabankUploadService", "$mdDialog", "$q", "$rootScope"];
function LinkController(bizMediabankDownloadService, bizMediabankUploadService, $mdDialog, $q, $rootScope) {
var vm = this;
vm.Link = "";
vm.NameTranslations = [];
vm.SelectedTags = [];
vm.isPrivate = false;
vm.isInvisible = false;
vm.TagSourceType = 11;
vm.LinkFile = LinkFile;
vm.Close = Close;
vm.LoadData = LoadData;
vm.ValidateLink = ValidateLink;
vm.GetAllTags = GetAllTags;
vm.SelectTag = SelectTag;
vm.SaveTags = SaveTags;
vm.DeleteTag = DeleteTag;
function ValidateLink() {
return true
}
function LinkFile() {
var thumbnail = vm.thumbnail ? vm.thumbnail.FileUrl : "";
if (vm.Link.length > 0 && vm.ValidateLink())
bizMediabankUploadService.LinkFile(vm.Link, vm.fileType, thumbnail, vm.uploadedFrom, vm.settings, vm.NameTranslations, vm.DescriptionTranslations).then(LinkFileSuccess);
function LinkFileSuccess(response) {
var status = BizPartCoreHelpers.getResponseValue(response, {});
if (vm.SelectedTags.length > 0 && status.ObjectId > 0)
vm.SaveTags(status.ObjectId);
$mdDialog.hide(status.Object);
}
}
function Close() {
if(vm.closeCallback) vm.closeCallback();
//$mdDialog.hide();
}
function LoadData() {
var settings = [];
settings.push('useTaggingInUpload');
settings.push('useTranslationsInUpload');
bizMediabankDownloadService.GetGenericSettings(settings).then(LoadDataDone);
function LoadDataDone(response) {
vm.useTaggingInUpload = (response.data.GetItemByValue('Key', 'useTaggingInUpload').Value == 'true' ? true : undefined);
vm.UseTranslationsInUpload = (response.data.GetItemByValue('Key', 'useTranslationsInUpload').Value == 'true' ? true : false);
if (vm.useTaggingInUpload && vm.HasWriteAccess) {
vm.GetAllTags();
}
}
}
function GetAllTags() {
bizMediabankUploadService.GetAllTags($rootScope.LoggedInUser.CultureId).then(GetAllTagsSuccess);
function GetAllTagsSuccess(response) {
vm.Tags = response.data;
}
}
function SelectTag(tag) {
if (vm.SelectedTags.filter(function (e) { return e.Id === tag.Id; }).length > 0) {
}
else
vm.SelectedTags.push(tag);
}
function SaveTags(fileId) {
for (var i = 0; i < vm.SelectedTags.length; i++) {
bizMediabankUploadService.SaveTag(vm.TagSourceType, fileId, vm.SelectedTags[i].Id);
}
}
function DeleteTag(tag) {
if (vm.SelectedTags) {
var index = vm.SelectedTags.indexOf(tag);
if (index > -1)
vm.SelectedTags.splice(index, 1);
}
}
function Init() {
vm.HasWriteAccess = $rootScope.HasModuleAccess('MEDIABANK', 20);
vm.LoadData();
}
vm.$onInit = Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
function DownloadController(bizMediabankDownloadService, $mdDialog, $q, $rootScope) {
var vm = this;
vm.Files = [];
//vm.GetFiles = GetFiles;
vm.SelectedFile;
vm.SelectFile = SelectFile;
vm.Search = Search;
vm.Close = Close;
vm.SearchFilter = {};
vm.GetPortalSettings = GetPortalSettings;
vm.MediabankTags = [];
vm.LoadData = LoadData;
vm.fileTypes = [{ Id: 0, Name: "Undetermined" }, { Id: 1, Name: "Video" }, { Id: 2, Name: "Image" }, { Id: 3, Name: 'Audio' }, { Id: 4, Name: 'Document' }];
vm.Intervals = [{ Id: 0, Name: "Last 20 files" }, { Id: 1, Name: "Last 3 months" }, { Id: 2, Name: "Last year" }, { Id: 3, Name: "All" }];
vm.ChangeInterval = ChangeInterval;
vm.SelectedMediabankUploadLocations = [];
vm.ToggleMediaBankUploadLocation = ToggleMediaBankUploadLocation;
function Search() {
vm.SearchFilter.tagId = vm.SelectedTag ? vm.SelectedTag.Id : -1;
vm.SearchFilter.type = vm.fileType;
if (!vm.SearchFilter.type)
vm.SearchFilter.type = vm.SelectedFileType ? vm.SelectedFileType.Id : -1;
//REMOVE THE DATE FILTERING - 2020-01-03
// if(!vm.SearchFilter.dateFrom)
// vm.SearchFilter.dateFrom = vm.startDate ? moment(vm.startDate).format('YYYY-MM-DD') : null;
// if(!vm.SearchFilter.dateTo)
//vm.SearchFilter.dateTo = vm.endDate ? moment(vm.endDate).format('YYYY-MM-DD') : null;
//vm.search.searchTerm = vm.SearchTerm ? vm.SearchTerm : "";
vm.SearchFilter.uploadLocations = vm.SelectedMediabankUploadLocations;
bizMediabankDownloadService.DownloadFilesSearch(vm.SearchFilter, vm.HasWriteAccess == false).then(DownloadFileSuccessCallback);
function DownloadFileSuccessCallback(response) {
vm.Files = response.data;
}
}
function ChangeInterval()
{
switch (vm.SelectedInterval.Id) {
case 0:
vm.SearchFilter.Top = 20;
break;
case 1:
vm.SearchFilter.Top = undefined;
vm.SearchFilter.dateFrom = moment().subtract(3, 'months').format('YYYY-MM-DD');
vm.SearchFilter.dateTo = moment().format('YYYY-MM-DD');
break;
case 2:
vm.SearchFilter.Top = undefined;
vm.SearchFilter.dateFrom = moment().subtract(1, 'years').format('YYYY-MM-DD');
vm.SearchFilter.dateTo = moment().format('YYYY-MM-DD');
break;
case 3:
vm.SearchFilter.Top = undefined;
vm.SearchFilter.dateFrom = undefined;
vm.SearchFilter.dateTo = undefined;
break;
}
vm.Search();
}
function SelectFile(file) {
// Double click
if (file != undefined && vm.SelectedFile != undefined && file.Id == vm.SelectedFile.Id)
vm.callback({ file: vm.SelectedFile });
if (file != undefined)
vm.SelectedFile = file;
// OK-btn
if (vm.callback && file == undefined)
vm.callback({ file: vm.SelectedFile });
}
function ToggleMediaBankUploadLocation(location) {
var index = vm.SelectedMediabankUploadLocations.indexOf(location.Id);
if (index == -1)
vm.SelectedMediabankUploadLocations.push(location.Id);
else
vm.SelectedMediabankUploadLocations.splice(index, 1);
vm.Search();
}
function Close() {
if(vm.closeCallback) vm.closeCallback();
//$mdDialog.hide();
}
function GetPortalSettings() {
}
function LoadData() {
var fileType = vm.fileType ? vm.fileType : -1;
var settings = [];
settings.push('useTagFilter');
settings.push('useDateFilter');
settings.push('useUploadLocationFilter');
settings.push('useTaggingInUpload');
var promiseList = [];
var settingsIndex = 0;
promiseList.push(bizMediabankDownloadService.GetGenericSettings(settings));
var tagsIndex = -1;
if (vm.HasWriteAccess) {
tagsIndex = 1;
promiseList.push(bizMediabankDownloadService.GetMediabankTags(fileType));
}
$q.all(promiseList).then(LoadDataDone);
function LoadDataDone(response) {
if (tagsIndex >= 0) {
vm.MediabankTags = response[tagsIndex].data;
}
//vm.Files = response[2].data;
vm.useTagFilter = (response[settingsIndex].data.GetItemByValue('Key', 'useTagFilter').Value == 'true' ? true : false);
vm.useDateFilter = (response[settingsIndex].data.GetItemByValue('Key', 'useDateFilter').Value == 'true' ? true : false);
vm.useUploadLocationFilter = (response[settingsIndex].data.GetItemByValue('Key', 'useUploadLocationFilter').Value == 'true' ? true : false);
vm.useTaggingInUpload = (response[settingsIndex].data.GetItemByValue('Key', 'useTaggingInUpload').Value == 'true' ? true : false);
if (vm.useUploadLocationFilter) {
bizMediabankDownloadService.GetUploadLocations(vm.fileType).then(GetUploadLocationsSuccess);
function GetUploadLocationsSuccess(response) {
vm.MediabankUploadLocations = response.data;
}
}
if (vm.useDateFilter == true) {
vm.startDate = moment().startOf('year').toDate();
vm.endDate = moment().toDate();
}
}
}
vm.$onInit = function () {
vm.HasWriteAccess = $rootScope.HasModuleAccess('MEDIABANK', 20);
vm.LoadData();
if (!vm.SelectedInterval);
vm.SelectedInterval = vm.Intervals.GetItemByValue("Id", 0);
}
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
function UploadController($rootScope, $mdDialog, bizMediabankUploadService, bizMediabankDownloadService, $q, bizMediabankService) {
var vm = this;
vm.UploadFile = UploadFile;
vm.Close = Close;
vm.SetFile = SetFile;
vm.FileName = undefined;
vm.File = undefined;
vm.TagSourceType = 11;
vm.GetAllTags = GetAllTags;
vm.Tags = [];
vm.LoadData = LoadData;
vm.SelectedTags = [];
vm.SelectTag = SelectTag;
vm.SaveTags = SaveTags;
vm.DeleteTag = DeleteTag;
vm.SetDefaultNameTranslations = SetDefaultNameTranslations;
vm.SetAllowedFileTypes = SetAllowedFileTypes;
vm.isPrivate = false;
vm.isInvisible = false;
//vm.isUser = false;
function SetAllowedFileTypes() {
if (vm.pattern) {
vm.AllowedFileTypes = bizMediabankService.GetFileTypesFromPattern(vm.pattern);
}
}
function LoadData() {
var fileType = vm.fileType ? vm.fileType : -1;
var settings = [];
settings.push('useTaggingInUpload');
settings.push('useTranslationsInUpload');
bizMediabankDownloadService.GetGenericSettings(settings).then(LoadDataDone);
function LoadDataDone(response) {
vm.useTaggingInUpload = (response.data.GetItemByValue('Key', 'useTaggingInUpload').Value == 'true' ? true : undefined);
vm.UseTranslationsInUpload = (response.data.GetItemByValue('Key', 'useTranslationsInUpload').Value == 'true' ? true : false);
}
}
if (vm.uploadedFrom)
console.log("Uploaded from: " + vm.uploadedFrom);
function Close() {
if(vm.closeCallback) vm.closeCallback();
//$mdDialog.hide();
}
function GetAllTags() {
bizMediabankUploadService.GetAllTags($rootScope.LoggedInUser.CultureId).then(GetAllTagsSuccess);
function GetAllTagsSuccess(response) {
vm.Tags = response.data;
}
}
function SelectTag(tag) {
if (vm.SelectedTags.filter(function (e) { return e.Id === tag.Id; }).length > 0) {
}
else
vm.SelectedTags.push(tag);
}
function SaveTags(fileId) {
for (var i = 0; i < vm.SelectedTags.length; i++)
{
bizMediabankUploadService.SaveTag(vm.TagSourceType, fileId, vm.SelectedTags[i].Id);
}
}
function UploadFile(settings) {
if (!vm.uploadedFrom)
vm.uploadedFrom = 0;
var fileName = vm.NameTranslations.GetItemByValue('CultureId', vm.SelectedCulture.Id).Value;
var description = vm.DescriptionTranslations.GetItemByValue('CultureId', vm.SelectedCulture.Id).Value;
if (vm.File != undefined && vm.FileName != undefined) {
vm.UploadBtnStatus = "SAVING";
bizMediabankUploadService.UploadFile(vm.File, vm.FileName, description, vm.uploadedFrom, vm.isPrivate, vm.isInvisible, settings, vm.NameTranslations, vm.DescriptionTranslations).then(UploadFileSuccessCallback);
function UploadFileSuccessCallback(response) {
vm.UploadBtnStatus = "SAVED";
var status = BizPartCoreHelpers.getResponseValue(response, {});
vm.UploadedFile = status.Object;
if (vm.SelectedTags.length > 0)
vm.SaveTags(vm.UploadedFile.Id);
if (vm.callback)
vm.callback({ file: vm.UploadedFile });
}
}
}
function DeleteTag(tag) {
if (vm.SelectedTags) {
var index = vm.SelectedTags.indexOf(tag);
if (index > -1)
vm.SelectedTags.splice(index, 1);
}
}
function SetDefaultNameTranslations() {
if (!vm.FileName) return;
var name = vm.FileName;
var suffixIndex = name.lastIndexOf(".");
if (suffixIndex > 0) {
name = name.substring(0, suffixIndex);
}
var newDefaultNameTranslations = [];
for (var i = 0; i < $rootScope.Cultures.length; i++) {
var culId = $rootScope.Cultures[i].Id;
var tItem = {
CultureId: culId,
Type: 1,
Value: name
};
newDefaultNameTranslations.push(tItem);
}
vm.NameTranslations = newDefaultNameTranslations;
}
function SetFile(file) {
if (file.length > 0) {
vm.File = file;
vm.FileName = vm.File[0].name;
vm.SetDefaultNameTranslations();
}
}
vm.$onInit = function () {
vm.HasWriteAccess = $rootScope.HasModuleAccess('MEDIABANK', 20);
if (vm.HasWriteAccess) {
vm.GetAllTags();
}
vm.LoadData();
vm.SelectedCulture = $rootScope.Cultures.GetItemByValue('Id', currentCultureId);
vm.NameTranslations = [];
vm.DescriptionTranslations = [];
vm.SetAllowedFileTypes();
}
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
function bizMediabankDownloadService($http) {
this.DownloadFiles = function (type) {
return $http.get(siteRootPath + "api/mediabankadmin/GetAllFilesByType?" + $.param({type: type}));
};
this.GetUploadLocations = function () {
return $http.get(siteRootPath + "api/mediabankadmin/GetUploadLocations");
};
this.GetPortalSetting = function (key) {
return $http.get(siteRootPath + "api/mediabankuser/GetPortalSetting?" + $.param({ key: key }));
};
this.GetGenericSetting = function (key) {
return $http.get(siteRootPath + "api/mediabankuser/GetGenericSetting?" + $.param({ key: key }));
};
this.GetGenericSettings = function (keys) {
return $http.get(siteRootPath + "api/genericsetting/GetGenericSettings?" + $.param({ type: 'MEDIABANK', keys: keys }));
};
this.GetMediabankTags = function (fileType) {
return $http.get(siteRootPath + "api/mediabankadmin/GetAllRelatedTags?" + $.param({ fileType: fileType }));
};
this.DownloadFilesSearch = function (search, isUser) {
var path = isUser ? 'api/mediabankuser/GetFiles' : 'api/mediabankadmin/GetFiles';
return $http.post(siteRootPath + path, search);
};
}
function bizMediabankUploadService($http, Upload) {
this.UploadFile = function (file, name, description, uploadedFrom, isPrivate, isInvisible, settings, nameTranslations, descriptionTranslations) {
var nameTranslations = JSON.stringify(nameTranslations);
var descriptionTranslations = JSON.stringify(descriptionTranslations);
var url = siteRootPath + (settings.IsUser == true ? 'api/mediabankuser/UploadFile' : 'api/mediabankadmin/UploadFile')
return Upload.upload({
url: url,
data: {
file: file, name: name,
description: description,
uploadedFrom: uploadedFrom,
isPrivate: settings.IsPrivate,
isInvisible: settings.IsInvisible,
skipDefaultPermissions: settings.SkipDefaultPermissions,
skipResize: settings.SkipResize,
nameTranslations: nameTranslations,
descriptionTranslations: descriptionTranslations
}
});
};
this.SaveTag = function (sourceType, sourceId, tagId) {
return $http.post(siteRootPath + 'api/generictag/SaveTag?' + $.param({ sourceType: sourceType, sourceId: sourceId, tagId: tagId }));
};
this.GetAllTags = function (cultureId) {
return $http.get(siteRootPath + 'api/generictag/GetAllTagsDefaultCulture', {
params: {
cultureId: cultureId
}
});
};
this.LinkFile = function (link, fileType, thumbnail, uploadedFrom, settings, nameTranslations, descriptionTranslations) {
var file = {
Link: link,
Type: fileType,
Thumbnail: thumbnail,
UploadedFrom: uploadedFrom,
IsPrivate: settings.IsPrivate,
IsInvisible: settings.IsInvisible,
NameTranslations: nameTranslations,
SkipDefaultPermissions: settings.SkipDefaultPermissions,
skipResize: settings.SkipResize,
DescriptionTranslations: descriptionTranslations
};
var url = siteRootPath + (settings.IsUser == true ? 'api/mediabankuser/LinkFile' : 'api/mediabankadmin/LinkFile')
return $http.post(url, file);
}
}
function bizMediabankService($mdDialog, $http) {
this.LoadingScripts = {};
this.FileTypes = {
Video: 1,
Image: 2,
Audio: 3,
Document: 4
}
this.FileTypeNames = {
1: "Video",
2: "Image",
3: "Audio",
4: "Document"
}
var _fileTypePatterns = {
1: "video/mp4",
2: "image/*",
3: "audio/*",
4: "application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
this.FileTypePatterns = _fileTypePatterns;
this.UploadLocations = {
Undefined: 0,
MediabankAdmin: 1,
SpeedquizAdmin: 2,
CMS: 3,
OnlineEducation: 4,
LevelSystem: 5,
UserProfile: 6,
Speedquiz: 7,
Ticket: 8,
Goal: 9,
GenericComment: 10
}
this.GetFileTypesFromPattern = function (pattern) {
var fileTypes;
if (pattern) {
const mTypes = pattern.split(',');
var tString;
var anyWildcard = false;
for (var i = 0; i < mTypes.length; i++) {
var s = mTypes[i].split("/");
if (s.length === 2) {
if (s[1] === '*') {
anyWildcard = true;
} else {
if (!tString) {
tString = s[1];
} else {
tString = tString + ", " + s[1];
}
}
}
}
if (anyWildcard) {
tString = null;
}
fileTypes = tString;
}
return fileTypes;
}
if (!settings) {
var settings = {
IsInvisible: false,
IsInvisibleControlHidden: false,
IsPrivate: false,
IsPrivateControlHidden: false,
IsUser: false,
SkipResize: false,
IsSkipResizeVisible: false
}
}
this.ShowMediabankDialog = function (fileType, uploadLocation, settings) {
if (!settings) {
var settings = {
IsInvisible: false,
IsInvisibleControlHidden: false,
IsPrivate: false,
IsPrivateControlHidden: false,
IsUser: false,
Title: "Select, upload or add a link to a file of type: " + this.FileTypeNames[fileType],
ShowLinkTab: false,
SkipDefaultPermissions: false,
SkipResize: false,
IsSkipResizeVisible: false
}
}
if (!uploadLocation)
uploadLocation = this.UploadLocations.Undefined;
return $mdDialog.show({
parent: angular.element(document.body),
templateUrl: siteRootPath + "Js/AngularModules/BizMediabank/views/Mediabank.html",
controller: MediabankDialogController,
controllerAs: "vm",
skipHide: true,
multiple: true,
uploadLocation: uploadLocation,
bindToController: true,
locals: { settings: settings }
});
MediabankDialogController.$inject = ["$mdDialog"];
function MediabankDialogController($mdDialog) {
var vm = this;
vm.fileType = fileType;
vm.pattern = "";
switch (vm.fileType) {
case 1:
case "1":
vm.pattern = _fileTypePatterns[1];
break;
case 2:
case "2":
vm.pattern = _fileTypePatterns[2];
break;
case 3:
case "3":
vm.pattern = _fileTypePatterns[3];
break;
case 4:
case "4":
vm.pattern = _fileTypePatterns[4];
break;
}
vm.settings = settings;
vm.UploadCallback = UploadCallback;
vm.selectedFile;
vm.DownloadCallback = DownloadCallback;
vm.SelectFile = SelectFile;
vm.Close = Close;
function UploadCallback(file) {
$mdDialog.hide(file);
}
function DownloadCallback(file) {
vm.selectedFile = file;
$mdDialog.hide(vm.selectedFile);
}
function SelectFile() {
$mdDialog.hide(vm.selectedFile);
}
function Close() {
$mdDialog.hide();
}
}
}
this.ShowUploadDialog = function (fileType, uploadLocation, settings) {
var pattern = "";
switch (fileType) {
case 1:
case "1":
pattern = _fileTypePatterns[1];
break;
case 2:
case "2":
pattern = _fileTypePatterns[2];
break;
case 3:
case "3":
pattern = _fileTypePatterns[3];
break;
case "4":
pattern = _fileTypePatterns[4];
break;
}
if (!uploadLocation)
uploadLocation = this.UploadLocations.Undefined;
if (!settings) {
var settings = {
FileLocation: uploadLocation,
FileType: fileType,
FilePattern: pattern,
IsInvisible: false,
IsInvisibleControlHidden: false,
IsPrivate: false,
IsPrivateControlHidden: false,
IsUser: false,
SkipResize: false,
IsSkipResizeVisible: false
}
}
return $mdDialog.show({
parent: angular.element(document.body),
template: '
',
controller: UploadToMediabankController,
controllerAs: "vm",
bindToController: true,
locals: { settings: settings }
});
UploadToMediabankController.$inject = ["$mdDialog"];
function UploadToMediabankController($mdDialog) {
var vm = this;
vm.UploadCallback = UploadCallback;
vm.Close = Close;
function UploadCallback(file) {
$mdDialog.hide(file);
}
function Close() {
$mdDialog.hide();
}
}
}
this.ShowDownloadDialog = function (fileType) {
return $mdDialog.show({
parent: angular.element(document.body),
template: '
',
controller: SelectFromMediabankController,
controllerAs: "vm",
bindToController: true,
});
//Select Cancel
SelectFromMediabankController.$inject = ["$mdDialog"];
function SelectFromMediabankController($mdDialog) {
var vm = this;
vm.selectedFile;
vm.DownloadCallback = DownloadCallback;
//vm.SelectFile = SelectFile;
//vm.Close = Close;
function DownloadCallback(file) {
//vm.selectedFile = file;
$mdDialog.hide(file)
}
//function SelectFile() {
// $mdDialog.hide(vm.selectedFile);
//}
//function Close() {
// $mdDialog.hide();
//}
}
}
var filePromises = {
};
this.GetMediabankFile = function (fileId, moduleGuid, containerRef) {
if (filePromises[fileId])
return filePromises[fileId];
filePromises[fileId] = $http.get(siteRootPath + "api/mediabankuser/GetOneFile", {
params: {
id: fileId,
moduleGuid: moduleGuid || '',
containerRef: containerRef || ''
}
});
return filePromises[fileId];
}
}
})(window.angular);
// randomColor by David Merfield under the CC0 license
// https://github.com/davidmerfield/randomColor/
; (function (root, factory) {
// Support CommonJS
if (typeof exports === 'object') {
var randomColor = factory();
// Support NodeJS & Component, which allow module.exports to be a function
if (typeof module === 'object' && module && module.exports) {
exports = module.exports = randomColor;
}
// Support CommonJS 1.1.1 spec
exports.randomColor = randomColor;
// Support AMD
} else if (typeof define === 'function' && define.amd) {
define([], factory);
// Support vanilla script loading
} else {
root.randomColor = factory();
}
}(this, function () {
// Seed to get repeatable colors
var seed = null;
// Shared color dictionary
var colorDictionary = {};
// Populate the color dictionary
loadColorBounds();
var randomColor = function (options) {
options = options || {};
// Check if there is a seed and ensure it's an
// integer. Otherwise, reset the seed value.
if (options.seed !== undefined && options.seed !== null && options.seed === parseInt(options.seed, 10)) {
seed = options.seed;
// A string was passed as a seed
} else if (typeof options.seed === 'string') {
seed = stringToInteger(options.seed);
// Something was passed as a seed but it wasn't an integer or string
} else if (options.seed !== undefined && options.seed !== null) {
throw new TypeError('The seed value must be an integer or string');
// No seed, reset the value outside.
} else {
seed = null;
}
var H, S, B;
// Check if we need to generate multiple colors
if (options.count !== null && options.count !== undefined) {
var totalColors = options.count,
colors = [];
options.count = null;
while (totalColors > colors.length) {
// Since we're generating multiple colors,
// incremement the seed. Otherwise we'd just
// generate the same color each time...
if (seed && options.seed) options.seed += 1;
colors.push(randomColor(options));
}
options.count = totalColors;
return colors;
}
// First we pick a hue (H)
H = pickHue(options);
// Then use H to determine saturation (S)
S = pickSaturation(H, options);
// Then use S and H to determine brightness (B).
B = pickBrightness(H, S, options);
// Then we return the HSB color in the desired format
return setFormat([H, S, B], options);
};
function pickHue(options) {
var hueRange = getHueRange(options.hue),
hue = randomWithin(hueRange);
// Instead of storing red as two seperate ranges,
// we group them, using negative numbers
if (hue < 0) { hue = 360 + hue; }
return hue;
}
function pickSaturation(hue, options) {
if (options.hue === 'monochrome') {
return 0;
}
if (options.luminosity === 'random') {
return randomWithin([0, 100]);
}
var saturationRange = getSaturationRange(hue);
var sMin = saturationRange[0],
sMax = saturationRange[1];
switch (options.luminosity) {
case 'bright':
sMin = 55;
break;
case 'dark':
sMin = sMax - 10;
break;
case 'light':
sMax = 55;
break;
}
return randomWithin([sMin, sMax]);
}
function pickBrightness(H, S, options) {
var bMin = getMinimumBrightness(H, S),
bMax = 100;
switch (options.luminosity) {
case 'dark':
bMax = bMin + 20;
break;
case 'light':
bMin = (bMax + bMin) / 2;
break;
case 'random':
bMin = 0;
bMax = 100;
break;
}
return randomWithin([bMin, bMax]);
}
function setFormat(hsv, options) {
switch (options.format) {
case 'hsvArray':
return hsv;
case 'hslArray':
return HSVtoHSL(hsv);
case 'hsl':
var hsl = HSVtoHSL(hsv);
return 'hsl(' + hsl[0] + ', ' + hsl[1] + '%, ' + hsl[2] + '%)';
case 'hsla':
var hslColor = HSVtoHSL(hsv);
var alpha = options.alpha || Math.random();
return 'hsla(' + hslColor[0] + ', ' + hslColor[1] + '%, ' + hslColor[2] + '%, ' + alpha + ')';
case 'rgbArray':
return HSVtoRGB(hsv);
case 'rgb':
var rgb = HSVtoRGB(hsv);
return 'rgb(' + rgb.join(', ') + ')';
case 'rgba':
var rgbColor = HSVtoRGB(hsv);
var alpha = options.alpha || Math.random();
return 'rgba(' + rgbColor.join(', ') + ', ' + alpha + ')';
default:
return HSVtoHex(hsv);
}
}
function getMinimumBrightness(H, S) {
var lowerBounds = getColorInfo(H).lowerBounds;
for (var i = 0; i < lowerBounds.length - 1; i++) {
var s1 = lowerBounds[i][0],
v1 = lowerBounds[i][1];
var s2 = lowerBounds[i + 1][0],
v2 = lowerBounds[i + 1][1];
if (S >= s1 && S <= s2) {
var m = (v2 - v1) / (s2 - s1),
b = v1 - m * s1;
return m * S + b;
}
}
return 0;
}
function getHueRange(colorInput) {
if (typeof parseInt(colorInput) === 'number') {
var number = parseInt(colorInput);
if (number < 360 && number > 0) {
return [number, number];
}
}
if (typeof colorInput === 'string') {
if (colorDictionary[colorInput]) {
var color = colorDictionary[colorInput];
if (color.hueRange) { return color.hueRange; }
} else if (colorInput.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)) {
var hue = HexToHSB(colorInput)[0];
return [hue, hue];
}
}
return [0, 360];
}
function getSaturationRange(hue) {
return getColorInfo(hue).saturationRange;
}
function getColorInfo(hue) {
// Maps red colors to make picking hue easier
if (hue >= 334 && hue <= 360) {
hue -= 360;
}
for (var colorName in colorDictionary) {
var color = colorDictionary[colorName];
if (color.hueRange &&
hue >= color.hueRange[0] &&
hue <= color.hueRange[1]) {
return colorDictionary[colorName];
}
} return 'Color not found';
}
function randomWithin(range) {
if (seed === null) {
return Math.floor(range[0] + Math.random() * (range[1] + 1 - range[0]));
} else {
//Seeded random algorithm from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
var max = range[1] || 1;
var min = range[0] || 0;
seed = (seed * 9301 + 49297) % 233280;
var rnd = seed / 233280.0;
return Math.floor(min + rnd * (max - min));
}
}
function HSVtoHex(hsv) {
var rgb = HSVtoRGB(hsv);
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? '0' + hex : hex;
}
var hex = '#' + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]);
return hex;
}
function defineColor(name, hueRange, lowerBounds) {
var sMin = lowerBounds[0][0],
sMax = lowerBounds[lowerBounds.length - 1][0],
bMin = lowerBounds[lowerBounds.length - 1][1],
bMax = lowerBounds[0][1];
colorDictionary[name] = {
hueRange: hueRange,
lowerBounds: lowerBounds,
saturationRange: [sMin, sMax],
brightnessRange: [bMin, bMax]
};
}
function loadColorBounds() {
defineColor(
'monochrome',
null,
[[0, 0], [100, 0]]
);
defineColor(
'red',
[-26, 18],
[[20, 100], [30, 92], [40, 89], [50, 85], [60, 78], [70, 70], [80, 60], [90, 55], [100, 50]]
);
defineColor(
'orange',
[19, 46],
[[20, 100], [30, 93], [40, 88], [50, 86], [60, 85], [70, 70], [100, 70]]
);
defineColor(
'yellow',
[47, 62],
[[25, 100], [40, 94], [50, 89], [60, 86], [70, 84], [80, 82], [90, 80], [100, 75]]
);
defineColor(
'green',
[63, 178],
[[30, 100], [40, 90], [50, 85], [60, 81], [70, 74], [80, 64], [90, 50], [100, 40]]
);
defineColor(
'blue',
[179, 257],
[[20, 100], [30, 86], [40, 80], [50, 74], [60, 60], [70, 52], [80, 44], [90, 39], [100, 35]]
);
defineColor(
'purple',
[258, 282],
[[20, 100], [30, 87], [40, 79], [50, 70], [60, 65], [70, 59], [80, 52], [90, 45], [100, 42]]
);
defineColor(
'pink',
[283, 334],
[[20, 100], [30, 90], [40, 86], [60, 84], [80, 80], [90, 75], [100, 73]]
);
}
function HSVtoRGB(hsv) {
// this doesn't work for the values of 0 and 360
// here's the hacky fix
var h = hsv[0];
if (h === 0) { h = 1; }
if (h === 360) { h = 359; }
// Rebase the h,s,v values
h = h / 360;
var s = hsv[1] / 100,
v = hsv[2] / 100;
var h_i = Math.floor(h * 6),
f = h * 6 - h_i,
p = v * (1 - s),
q = v * (1 - f * s),
t = v * (1 - (1 - f) * s),
r = 256,
g = 256,
b = 256;
switch (h_i) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
var result = [Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)];
return result;
}
function HexToHSB(hex) {
hex = hex.replace(/^#/, '');
hex = hex.length === 3 ? hex.replace(/(.)/g, '$1$1') : hex;
var red = parseInt(hex.substr(0, 2), 16) / 255,
green = parseInt(hex.substr(2, 2), 16) / 255,
blue = parseInt(hex.substr(4, 2), 16) / 255;
var cMax = Math.max(red, green, blue),
delta = cMax - Math.min(red, green, blue),
saturation = cMax ? (delta / cMax) : 0;
switch (cMax) {
case red: return [60 * (((green - blue) / delta) % 6) || 0, saturation, cMax];
case green: return [60 * (((blue - red) / delta) + 2) || 0, saturation, cMax];
case blue: return [60 * (((red - green) / delta) + 4) || 0, saturation, cMax];
}
}
function HSVtoHSL(hsv) {
var h = hsv[0],
s = hsv[1] / 100,
v = hsv[2] / 100,
k = (2 - s) * v;
return [
h,
Math.round(s * v / (k < 1 ? k : 2 - k) * 10000) / 100,
k / 2 * 100
];
}
function stringToInteger(string) {
var total = 0
for (var i = 0; i !== string.length; i++) {
if (total >= Number.MAX_SAFE_INTEGER) break;
total += string.charCodeAt(i)
}
return total
}
return randomColor;
}));
(function (angular) {
angular.module('BizContainer', ['ngAnimate', 'ngMaterial', 'bizPart', 'dndLists', 'sticky', 'color.picker', 'duParallax', 'slickCarousel', 'rzModule',
'ngCookies', 'bizSelect', 'bizMediabank', 'ngMessages', 'ui.knob', 'bizFormly', 'oc.lazyLoad']);
angular.module('BizContainer').config(configFunction);
configFunction.$inject = ["$provide", "$ocLazyLoadProvider"];
function configFunction($provide, $ocLazyLoadProvider) {
$ocLazyLoadProvider.config({
modules: GetLazyLoadModules()
});
}
angular.module('BizContainer').directive('bizContainerEdit', bizContainerEditDirective);
angular.module('BizContainer').directive('bizContainerShow', bizContainerShowDirective);
angular.module('BizContainer').directive('bizContainerContent', bizContainerContentDirective);
angular.module('BizContainer').directive('bizContainerStyle', bizContainerStyleDirective);
angular.module('BizContainer').directive('bizContainerModuleAdminStylesheet', bizContainerModuleAdminStylesheetDirective);
angular.module('BizContainer').directive('bizContainerModuleContainer', bizContainerModuleContainerDirective);
angular.module('BizContainer').directive('bizContainerAdminSettings', bizContainerAdminSettingsDirective);
angular.module('BizContainer').directive('bizModuleAbstractSettingsPluginWrapper', bizModuleAbstractSettingsPluginWrapper);
angular.module('BizContainer').directive('bizContainerModuleStyle', bizContainerModuleStyleDirective);
angular.module('BizContainer').directive('bizContainerModuleSettings', bizContainerModuleSettingsDirective);
angular.module('BizContainer').directive('bizContainerModuleStatistics', bizContainerModuleStatisticsDirective);
angular.module('BizContainer').directive('bizContainerModuleMediabank', bizContainerModuleMediabankDirective);
angular.module('BizContainer').directive('bizContainerSlideDotStyle', bizContainerSlideDotStyle);
angular.module('BizContainer').directive('bizContainerVersions', bizContainerVersionsDirective);
angular.module('BizContainer').value('bizContainerUrls', {
Container: "Modules/BizContainer/Core/WS/BizContainerService.asmx/",
CategoryAdmin: "Modules/BizContainer/Core/WS/BizContainerModuleCategoryAdminService.asmx/",
OnlineEducation: "Modules/BizContainer/OnlineEducation/WS/BizOnlineEducationAdminService.asmx/",
OnlineEducationUser: "Modules/BizContainer/OnlineEducation/WS/BizOnlineEducationUserService.asmx/",
Speedquiz: "ModulesCustom/BizExtSpeedQuiz/WS/SpeedQuiz.asmx/",
MissionsAdmin: "Modules/BizMissions/WS/MissionsAdminService.asmx/",
MissionsUser: "Modules/BizMissions/WS/MissionsService.asmx/",
GenericSend: "Modules/BizGenericSend/WS/BizGenericSendService.asmx/",
Permission: "api/Permission/"
});
angular.module('BizContainer').value('bizContainerSettings', {
PortalCustomerName: BizPart.Client.Core.PortalCustomerName,
PortalVersion: BizPart.Client.Core.Version,
PortalDefaultCulture: BizPart.Client.Core.PortalDefaultCultureId,
CurrentCultureId: BizPart.Client.Core.CurrentCultureId,
CurrentUserId: BizPart.Client.Core.CurrentUser.Id,
CurrentUserCurrency: BizPart.Client.Core.CurrentUser.Coins,
CurrentUserDepartments: BizPart.Client.Core.CurrentUser.Departments,
CurrentContainerType: "",
UseApiController: false,
UseEngageCore: false,
ContainerRefererType: "",
ContainerRefererObjectId: -1
});
function GetLazyLoadModules() {
return [
//CORE MODULES
CreateLazyLoadModule('AutomaticProductSale', 'Core'),
CreateLazyLoadModule('Button', 'Core'),
CreateLazyLoadModule('Effects', 'Core'),
CreateLazyLoadModule('Favorite', 'Core'),
CreateLazyLoadModule('Form', 'Core'),
CreateLazyLoadModule('IFrame', 'Core'),
CreateLazyLoadModule('Image', 'Core'),
CreateLazyLoadModule('ImageHotspots', 'Core'),
CreateLazyLoadModule('ImageText', 'Core'),
CreateLazyLoadModule('Journey', 'Core'),
CreateLazyLoadModule('LikeActions', 'Core'),
CreateLazyLoadModule('Missions', 'Core'),
CreateLazyLoadModule('Navigation', 'Core'),
CreateLazyLoadModule('Paint', 'Core'),
CreateLazyLoadModule('Question', 'Core'),
CreateLazyLoadModule('QuestionForm', 'Core', 'Form'),
CreateLazyLoadModule('Segment', 'Core', 'SegmentModule'),
CreateLazyLoadModule('SlideShow', 'Core'),
CreateLazyLoadModule('SocialShare', 'Core'),
CreateLazyLoadModule('Speedquiz', 'Core'),
CreateLazyLoadModule('SpeedquizHighscore', 'Core'),
CreateLazyLoadModule('Text', 'Core', 'TextModule'),
CreateLazyLoadModule('Video', 'Core'),
//Layout MODULES
CreateLazyLoadModule('ChangePassword', 'Layout'),
CreateLazyLoadModule('CookieButton', 'Layout'),
CreateLazyLoadModule('FavoriteEdit', 'Layout'),
CreateLazyLoadModule('WelcomeGuideButton', 'Layout'),
//CMS MODULES
CreateLazyLoadModule('BlogList', 'CMS'),
CreateLazyLoadModule('BlogListLarge', 'CMS'),
CreateLazyLoadModule('Certifications', 'CMS'),
CreateLazyLoadModule('CombinationModule', 'CMS'),
CreateLazyLoadModule('Countdown', 'CMS'),
CreateLazyLoadModule('Educations', 'CMS'),
CreateLazyLoadModule('EventList', 'CMS'),
CreateLazyLoadModule('ForumList', 'CMS'),
CreateLazyLoadModule('GoogleAnalytics', 'CMS'),
CreateLazyLoadModule('Highscore', 'CMS'),
CreateLazyLoadModule('HighscoreMaster', 'CMS'),
CreateLazyLoadModule('HTML5Educations', 'CMS'),
CreateLazyLoadModule('LinkList', 'CMS'),
CreateLazyLoadModule('MediaList', 'CMS'),
CreateLazyLoadModule('MiniJourney', 'CMS'),
CreateLazyLoadModule('MyCertifications', 'CMS'),
CreateLazyLoadModule('MyEducationsByCategory', 'CMS'),
CreateLazyLoadModule('MyEducationsCompleted', 'CMS'),
CreateLazyLoadModule('MyEducationsMiniList', 'CMS'),
CreateLazyLoadModule('Progress', 'CMS'),
CreateLazyLoadModule('ShopModule', 'CMS'),
CreateLazyLoadModule('Suggestions', 'CMS'),
CreateLazyLoadModule('TagFilter', 'CMS'),
//OnlineEducation MODULES
CreateLazyLoadModule('EducationSummary', 'OnlineEducation'),
CreateLazyLoadModule('Evaluation', 'OnlineEducation'),
CreateLazyLoadModule('QuestionsMaster', 'OnlineEducation'),
CreateLazyLoadModule('Questions', 'OnlineEducation', 'QuestionsModule'),
CreateLazyLoadModule('TextInput', 'OnlineEducation'),
//Campaign MODULES
CreateLazyLoadModule('Events', 'Campaign'),
//TermsAndConditions MODULES
CreateLazyLoadModule('GenericSendSignup', 'TermsAndConditions'),
CreateLazyLoadModule('Signature', 'TermsAndConditions'),
];
}
function CreateLazyLoadModule(moduleSystemName, project, overrideFileName) {
var prefix = 'Container';
var basePaths = {
"Core": "Modules/BizPart.BizContainer/Core/GUI/Modules/",
"Layout": "Modules/BizPart.BizContainer/Layout/GUI/Modules/",
"CMS": "Modules/BizPart.BizContainer/CMS/GUI/Modules/",
"OnlineEducation": "Modules/BizPart.BizContainer/OnlineEducation/GUI/Modules/",
"TermsAndConditions": "Modules/BizPart.BizContainer/TermsAndConditions/GUI/Modules/",
"Campaign": "Modules/BizPart.BizContainer/Campaign/GUI/Modules/"
};
var fileName = overrideFileName || moduleSystemName;
return {
name: prefix + moduleSystemName,
files: [
siteRootPath + basePaths[project] + fileName + '.js?v=' + bizPartVersion,
siteRootPath + basePaths[project] + fileName + '.css?v=' + bizPartVersion
]
}
}
bizContainerEditDirective.$inject = [];
bizContainerShowDirective.$inject = [];
bizContainerContentDirective.$inject = [];
bizContainerStyleDirective.$inject = [];
bizContainerModuleAdminStylesheetDirective.$inject = [];
bizContainerModuleContainerDirective.$inject = ["$compile", "$http", "moduleInstance", "$timeout", "$filter", "bizContainerSettings", "$ocLazyLoad"];
bizModuleAbstractSettingsPluginWrapper.$inject = ["$compile"];
bizContainerModuleStyleDirective.$inject = [];
bizContainerModuleSettingsDirective.$inject = [];
bizContainerModuleStatisticsDirective.$inject = [];
bizContainerVersionsDirective.$inject = [];
function bizContainerAdminSettingsDirective() {
var directive = {
restrict: 'E',
scope: {
config: '=?',
},
templateUrl: siteRootPath + 'Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerAdminSettings.html?v=' + bizPartVersion,
bindToController: true,
controllerAs: 'vm',
controller: bizContainerAdminSettingsController
};
bizContainerAdminSettingsController.$inject = ["bizContainerService", "$rootScope"];
function bizContainerAdminSettingsController(bizContainerService, $rootScope) {
var vm = this;
vm.Init = Init;
vm.GetSettings = GetSettings;
vm.SaveSettings = SaveSettings;
vm.GetModuleAbstracts = GetModuleAbstracts;
function GetModuleAbstracts() {
bizContainerService.GetAllModuleAbstracts().then(GetAllModuleAbstractsCallback);
function GetAllModuleAbstractsCallback(response) {
vm.ModuleAbstracts = BizPartCoreHelpers.getResponseValue(response, []);
}
}
function GetSettings() {
bizContainerService.GetAdminSettings().then(GetAdminSettingsCallback);
function GetAdminSettingsCallback(response) {
vm.Settings = BizPartCoreHelpers.getResponseValue(response, {});
}
}
function SaveSettings() {
bizContainerService.SaveAdminSettings(vm.Settings).then(SaveAdminSettingsCallback);
function SaveAdminSettingsCallback(response) {
}
}
function Init() {
vm.GetSettings();
vm.GetModuleAbstracts();
vm.config = {
Save: vm.SaveSettings
}
}
vm.$onInit = vm.Init;
}
return directive;
}
function bizContainerEditDirective() {
var directive = {
restrict: "E",
scope: {
Container: "=?container",
containerWrapper: "=?",
accessModuleKey: "@?",
moduleAbstracts: "=?",
modulePermissionKey: "@?",
moduleAbstractSettingsPlugins: "=?",
isDirty: "&?",
activeCultureIds: "&?",
usePlaceholders: "=?"
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerEdit.html?v=" + bizPartVersion,
controller: bizContainerEditController,
bindToController: true,
controllerAs: "vm"
};
return directive;
}
bizContainerEditController.$inject = ["$scope", "$filter", "$rootScope", "container", "moduleInstance", "bizContainerService", "$timeout", "bizCoreService", "$interval", "bizContainerSettings", "$q", "containerWrapper", "placeholder", "$mdDialog", "$mdToast"];
function bizContainerEditController($scope, $filter, $rootScope, container, moduleInstance, bizContainerService, $timeout, bizCoreService, $interval, bizContainerSettings, $q, containerWrapper, placeholder, $mdDialog, $mdToast) {
var vm = this;
vm.ActiveSettings = "content";
vm.ActiveDeviceSettings = undefined;
vm.InvisibleModules = [];
vm.RenderedCount = 0;
vm.FixedPositions = [{
Name: "Top left",
Value: "fixed top left"
}, {
Name: "Top right",
Value: "fixed top right"
}, {
Name: "Bottom left",
Value: "fixed bottom left"
}, {
Name: "Bottom right",
Value: "fixed bottom right"
}];
vm.DeleteSelectedPlaceholder = DeleteSelectedPlaceholder;
vm.EditSelectedPlaceholder = EditSelectedPlaceholder;
vm.AddPlaceholder = AddPlaceholder;
vm.DropModule = DropModule;
vm.CopyContent = CopyContent;
vm.TranslateModule = TranslateModule;
vm.ModuleClick = ModuleClick;
vm.ModuleMouseenter = ModuleMouseenter;
vm.ModuleMouseleave = ModuleMouseleave;
vm.GetCultures = GetCultures;
vm.ActivateSetting = ActivateSetting;
vm.SetActiveDevice = SetActiveDevice;
vm.SetSelectedModule = SetSelectedModule;
vm.DeleteModule = DeleteModule;
vm.MoveModule = MoveModule;
vm.CopyModule = CopyModule;
vm.CopyModuleToClipboard = CopyModuleToClipboard;
vm.PasteClipboardModule = PasteClipboardModule;
vm.SaveClipboardModule = SaveClipboardModule;
vm.LoadSavedModules = LoadSavedModules;
vm.ShouldModuleBeVisible = ShouldModuleBeVisible;
vm.GetContainerStyleLimitations = GetContainerStyleLimitations;
vm.SelectedPlaceholderId = 0;
vm.FilteredContainer;
vm.InsertedModule = InsertedModule;
vm.RightPanelWidth = 'NORMAL';
vm.SelectedPlaceholder = undefined;
vm.IsModuleInPlaceholder = IsModuleInPlaceholder;
vm.MakeLayeredModule = MakeLayeredModule;
vm.GetFilteredContainer = GetFilteredContainer;
vm.ImportContainer = ImportContainer;
vm.ExportContainer = ExportContainer;
vm.LoadClipboardModule = LoadClipboardModule;
vm.ClearClipboardModule = ClearClipboardModule;
vm.GetPanelWidth = GetPanelWidth;
vm.PanelWidths = [
{ Id: 'HIDDEN', Name: 'HIDDEN' },
{ Id: 'COMPACT', Name: 'COMPACT' },
{ Id: 'NORMAL', Name: 'NORMAL' },
{ Id: 'WIDE', Name: 'WIDE' },
{ Id: 'SUPERWIDE', Name: 'SUPERWIDE' },
];
function GetPanelWidth() {
vm.Container.UseInlineTextEditor = vm.RightPanelWidth === 'HIDDEN';
if (vm.RightPanelWidth === 'SUPERWIDE') return 'settings-width-superwide';
if (vm.RightPanelWidth === 'WIDE') return 'settings-width-wide';
if (vm.RightPanelWidth === 'NORMAL') return 'settings-width-normal';
if (vm.RightPanelWidth === 'COMPACT') return 'settings-width-compact';
if (vm.RightPanelWidth === 'HIDDEN') return 'settings-width-hidden';
return 'settings-width-normal';
}
function GetFilteredContainer() {
var container = vm.Container.getContainerCultureFiltered($rootScope.SelectedCulture.Id);
var placeholder = container.getPlaceholder(vm.SelectedPlaceholderId);
container.Placeholders = [placeholder];
return container;
}
function MakeLayeredModule(module, e) {
console.log('PlaceholderId: ', vm.SelectedPlaceholderId);
console.log('Placeholder: ', vm.Container.Placeholders[vm.SelectedPlaceholderId]);
var m = angular.copy(module);
m.resetIds(true);
vm.Container.Placeholders[vm.SelectedPlaceholderId].Modules.push(m);
vm.SelectedPlaceholder = vm.Container.getPlaceholder(vm.SelectedPlaceholderId);
e.preventDefault();
}
function ImportContainer() {
$mdDialog.show({
templateUrl: siteRootPath + 'Modules/BizPart.BizContainer/Core/GUI/Views/bizContainerImportDialog.html?v=' + bizPartVersion,
controller: ImportContainerController,
controllerAs: 'vm',
bindToController: true,
locals: {
}
}).then(function (guid) {
if (guid) {
bizContainerService.ImportContainer(guid).then(ImportContainerCallback);
function ImportContainerCallback(response) {
var c = BizPartCoreHelpers.getResponseValue(response);
c.AdminMode = true;
vm.Container = new container(c);
vm.SelectedPlaceholder = vm.Container.getPlaceholder(vm.SelectedPlaceholderId);
vm.FilteredContainer = vm.GetFilteredContainer();
}
}
});
ImportContainerController.$inject = ["$mdDialog"];
function ImportContainerController($mdDialog) {
var vm = this;
vm.Select = Select;
vm.Cancel = Cancel;
vm.Init = Init;
function Select(guid) {
$mdDialog.hide(guid);
}
function Init() {
bizContainerService.GetExportedContainerList().then(GetExportedContainerListCallback);
function GetExportedContainerListCallback(response) {
vm.ExportList = BizPartCoreHelpers.getResponseValue(response, []);
}
}
function Cancel() {
$mdDialog.hide();
}
vm.$onInit = Init;
}
}
function ExportContainer() {
$mdDialog.show({
templateUrl: siteRootPath + 'Modules/BizPart.BizContainer/Core/GUI/Views/bizContainerExportDialog.html?v=' + bizPartVersion,
controller: ExportContainerController,
controllerAs: 'vm',
bindToController: true,
locals: {
}
}).then(function (exportInfo) {
if (exportInfo) {
var container = vm.Container.createBackendCopy();
bizContainerService.ExportContainer(container, exportInfo.SaveToName).then(ExportContainerCallback);
function ExportContainerCallback(response) {
$mdToast.updateSuccess();
}
}
});
ExportContainerController.$inject = ["$mdDialog"];
function ExportContainerController($mdDialog) {
var vm = this;
vm.ExportTypes = [
{
Name: 'Save to server',
Value: 'SaveToServer'
},
{
Name: 'Save to local zip (NOT IMPLEMENTED YET!)',
Value: 'SaveToZip'
}];
vm.ExportInfo = {
SaveToName: 'untitled',
ExportType: 'SaveToServer'
};
vm.Close = Close;
function Close(save) {
if (save === true) {
$mdDialog.hide(vm.ExportInfo);
} else {
$mdDialog.hide();
}
}
function Init() {
}
vm.$onInit = Init;
}
}
$rootScope.$watch(function () { return vm.SelectedPlaceholderId; }, function (newVal, oldVal) {
if (~~newVal >= 0) {
vm.SelectedPlaceholder = vm.Container.getPlaceholder(~~newVal);
vm.FilteredContainer = vm.GetFilteredContainer();
if (!vm.Container.IsEditing) {
vm.Container.IsEditing = !vm.Container.IsEditing;
$timeout(function () {
vm.Container.IsEditing = !vm.Container.IsEditing;
}, 1);
}
}
});
$rootScope.$watch(function () { return vm.Container.Placeholders; }, function () {
if (vm.Container.SelectedModule && vm.SelectedPlaceholder.Type === 2) {
var targetModule = vm.SelectedPlaceholder.getModuleByGuid(vm.Container.SelectedModule.Guid);
targetModule.Content = vm.Container.SelectedModule.Content;
targetModule.Settings = vm.Container.SelectedModule.Settings;
targetModule.Style = vm.Container.SelectedModule.Style;
}
}, true);
function IsModuleInPlaceholder(mod) {
if (mod.Id <= 0) return true;
return mod.PlaceholderId === vm.Container.Placeholders[vm.SelectedPlaceholderId].Id
|| mod.TargetPlaceholderId === vm.Container.Placeholders[vm.SelectedPlaceholderId].Id;
}
function DeleteSelectedPlaceholder() {
var confirm = $mdDialog.confirm({
title: "Delete?",
content: "Are you sure that you want to delete the placeholder: " + vm.SelectedPlaceholder.Name,
ok: "Yes",
cancel: "No",
parent: angular.element(document.body)
});
$mdDialog.show(confirm).then(okDelete);
function okDelete() {
bizContainerService.DeletePlaceholder(vm.SelectedPlaceholder.Id).then(function () {
vm.Container.Placeholders.splice(vm.SelectedPlaceholderId, 1);
vm.SelectedPlaceholderId = 0;
});
}
}
function EditSelectedPlaceholder() {
$mdDialog.show({
templateUrl: 'bizContainerPlaceholderAddDialog.html?v=' + bizPartVersion,
controller: AddPlaceholderController,
controllerAs: 'vm',
bindToController: true,
locals: {
container: vm.Container,
placeholderToEdit: vm.SelectedPlaceholder
}
}).then(function (data) {
if (data.placeholderToEdit) {
vm.Container.Placeholders[vm.SelectedPlaceholderId].Permissions = data.placeholderToEdit.Permissions;
vm.Container.Placeholders[vm.SelectedPlaceholderId].Name = data.placeholderToEdit.Name;
vm.SelectedPlaceholder = vm.Container.getPlaceholder(vm.SelectedPlaceholderId);
}
});
}
function AddPlaceholder(container) {
$mdDialog.show({
templateUrl: 'bizContainerPlaceholderAddDialog.html?v=' + bizPartVersion,
controller: AddPlaceholderController,
controllerAs: 'vm',
bindToController: true,
locals: {
container: container
}
});
}
AddPlaceholderController.$inject = ["$mdDialog", "placeholder"];
function AddPlaceholderController($mdDialog, placeholder) {
var vm = this;
vm.PlaceholderName = "";
vm.PermissionsPlaceholder = {
Id: -1,
Content: {
Permissions: []
}
};
vm.usedPermissions = [];
vm.Close = Close;
function Close(save) {
if (save === true) {
console.log('SAVE');
if (vm.placeholderToEdit === undefined) {
var p = new placeholder();
if (vm.SelectedCopyType === "copy") {
p = angular.copy(vm.container.Placeholders[0]);
p.resetIds();
}
else if (vm.SelectedCopyType === "layer") {
//p = angular.copy(vm.container.Placeholders[0]);
p.convertToLayer();
}
p.Name = vm.PlaceholderName;
p.Permissions = vm.PermissionsPlaceholder.Content.Permissions;
vm.container.Placeholders.push(p);
}
else if (vm.placeholderToEdit) {
vm.placeholderToEdit.Permissions = vm.PermissionsPlaceholder.Content.Permissions;
vm.placeholderToEdit.Name = vm.PlaceholderName;
}
}
$mdDialog.hide({ placeholderToEdit: vm.placeholderToEdit });
}
function Init() {
if (vm.placeholderToEdit) {
vm.PermissionsPlaceholder.Content.Permissions = vm.placeholderToEdit.Permissions;
vm.PlaceholderName = vm.placeholderToEdit.Name;
}
for (var i = 0; i < vm.container.Placeholders.length; i++) {
for (var y = 0; y < vm.container.Placeholders[i].Permissions.length; y++) {
vm.usedPermissions.push(vm.container.Placeholders[i].Permissions[y]);
}
}
}
vm.$onInit = Init;
}
function BindWatchers() {
$scope.$on("$destroy", function () {
$scope.$broadcast("CONTAINER_EDIT_DESTROYED");
console.log("Destroyed bizContainerEdit directive");
});
$rootScope.$on('MODULE_RENDER', function (event, module) {
vm.RenderedCount++;
if (vm.RenderedCount == vm.Modules.length + vm.InvisibleModules.length - 1)
$rootScope.$broadcast('ALL_MODULES_RENDERED');
});
$rootScope.$on('CONTAINER_CULTURE_CHANGE', function (event, culture) {
$timeout(function () {
vm.Container.SelectedModule = undefined;
});
if (culture)
vm.Modules = vm.Container.getModulesByCulture(culture.Id)
else
vm.Modules = vm.Container.getModules();
});
$rootScope.$on('MODULE_REJECTED', function (event, module) {
var placeholder = vm.Container.getPlaceholderForModule(module.Guid);
if (module.IsInvisible) {
placeholder.InvisibleModules.splice(placeholder.InvisibleModules.indexOf(module), 1);
}
else {
placeholder.Modules.splice(placeholder.Modules.indexOf(module), 1);
}
});
$rootScope.$on('PAGE_DIRTY', function (e, isDirty) {
if (vm.ContainerForm && !isDirty) {
vm.ContainerForm.$setPristine();
}
if (vm.Container && !isDirty) {
vm.Container.ModulesToDelete = [];
}
});
$rootScope.$on('CLIPBOARD_MODULE_UPDATE', function (event) {
vm.LoadClipboardModule();
})
$rootScope.$on('SAVED_MODULE_DROPPED', function (event, savedModuleGuid) {
var savedModule = vm.SavedModules.GetItemByValue('Guid', savedModuleGuid);
var mod = new moduleInstance(savedModule.Module, false, false);
bizContainerService.CopyModule(mod).then(CopyModuleCallback);
function CopyModuleCallback(response) {
var backendCopiedModule = response.data;
backendCopiedModule.SavedModuleGuid = savedModuleGuid;
savedModule.Module = backendCopiedModule;
}
})
$rootScope.$watch(function () {
if (vm.ContainerForm) { return vm.ContainerForm.$dirty; } else return false;
}, function (newVal, oldVal) {
if (newVal && newVal === true) {
$rootScope.$broadcast('PAGE_DIRTY', true);
}
});
}
function ShouldModuleBeVisible(module, cultureId) {
if (!cultureId || !module.Content.Translations)
return true;
if (module.Content.Translations.HiddenForCultures.indexOf(cultureId) == -1) {
if (module.Content.Translations.TranslatedCultures.indexOf(cultureId) > -1)
return true;
else if (!module.Content.Translations.TranslationOriginalGuid)
return true;
}
return false;
}
function GetCultures() {
if ($rootScope.Cultures && $rootScope.Cultures.length > 0) {
SetCultureData();
return;
}
bizCoreService.GetCultures().then(function (response) {
$rootScope.Cultures = BizPartCoreHelpers.getResponseValue(response, []);
SetCultureData();
});
function SetCultureData() {
vm.Cultures = $rootScope.Cultures;
vm.ActiveCultures = vm.Cultures;
vm.InactiveCultures = [];
if (!$rootScope.DefaultCulture)
$rootScope.DefaultCulture = vm.Cultures.GetItemByValue('Id', bizContainerSettings["PortalDefaultCulture"]);
var cultureIds = null;
if (vm.activeCultureIds && typeof vm.activeCultureIds == "function")
cultureIds = vm.activeCultureIds();
if (cultureIds) {
vm.ActiveCultures = [];
for (var i = 0; i < vm.Cultures.length; i++) {
if (cultureIds.indexOf(vm.Cultures[i].Id) > -1)
vm.ActiveCultures.push(vm.Cultures[i]);
else
vm.InactiveCultures.push(vm.Cultures[i]);
}
}
$rootScope.$on('admin.core.init', function () {
if (!$rootScope.SelectedCulture) {
var isDefaultCultureActive = vm.ActiveCultures.GetItemByValue('Id', $rootScope.DefaultCultureID);
$rootScope.SelectedCulture = vm.ActiveCultures.length && isDefaultCultureActive ? isDefaultCultureActive : vm.ActiveCultures[0];
}
if (!$rootScope.SelectedCulture) {
$rootScope.SelectedCulture = vm.Cultures[0];
}
if (vm.containerWrapper)
bizContainerService.ContainerWrapper = new containerWrapper(vm.containerWrapper, $rootScope.SelectedCulture.Id);
});
}
}
function ModuleMouseenter(module) {
module.Highlight = true;
}
function ModuleMouseleave(module) {
module.Highlight = false;
}
function TranslateModule(module, placeholder, culture, $event) {
var firstTranslation = false;
if (!module.Content.Translations) {
firstTranslation = true;
module.Content.Translations = {
TranslatedCultures: [],
HiddenForCultures: [],
VisibleForCultures: [],
}
}
if (!module.Content.Permissions || !module.Content.Permissions.length)
module.Content.Permissions = [{}];
module.Content.Translations.TranslatedCultures.push(culture.Id);
var source = angular.copy(module)
module.Content.Translations.HiddenForCultures.push(culture.Id);
var target = new moduleInstance(source, true, true);
var permissionCulture = { Id: culture.Id, FriendlyName: culture.FriendlyName, Name: culture.Name };
for (var i = target.Content.Permissions.length - 1; i >= 0; i--) {
target.Content.Permissions[i].Culture = permissionCulture;
target.Content.Permissions[i].CultureId = permissionCulture.Id;
}
target.Content.Translations.VisibleForCultures = [culture.Id];
target.Content.Translations.TranslationOriginalGuid = module.Guid;
var originalPermissions = angular.copy(module.Content.Permissions);
if ($rootScope.Cultures) {
if (firstTranslation)
module.Content.Permissions = [];
for (var i = 0; i < $rootScope.Cultures.length; i++) {
if ($rootScope.Cultures[i].Id != culture.Id) {
target.Content.Translations.HiddenForCultures.push($rootScope.Cultures[i].Id);
if (firstTranslation) {
module.Content.Translations.VisibleForCultures.push($rootScope.Cultures[i].Id);
for (var j = 0; j < originalPermissions.length; j++) {
var newPermission = angular.copy(originalPermissions[j]);
newPermission.Culture = { Id: $rootScope.Cultures[i].Id, FriendlyName: $rootScope.Cultures[i].FriendlyName };
newPermission.CultureId = $rootScope.Cultures[i].Id;
module.Content.Permissions.push(newPermission);
}
}
}
else if (!firstTranslation) {
for (var j = module.Content.Permissions.length - 1; j >= 0; j--) {
if (module.Content.Permissions[j].Culture && module.Content.Permissions[j].Culture.Id == $rootScope.Cultures[i].Id) {
module.Content.Permissions.splice(j, 1);
}
}
}
}
}
var visibleIndex = module.Content.Translations.VisibleForCultures.indexOf(culture.Id);
if (visibleIndex > -1)
module.Content.Translations.VisibleForCultures.splice(visibleIndex, 1);
var content = angular.copy(target.Content);
placeholder.Modules.splice(placeholder.Modules.indexOf(module), 0, target);
$timeout(function () {
target.Content = content;
vm.CopyContent(module, target);
vm.SetSelectedModule(target);
});
$rootScope.$broadcast('PAGE_DIRTY', true);
$event.preventDefault();
}
function ModuleClick(module) {
if (!module.Guid)
return;
var container = $('.biz-container');
var em = container.find('[conmi="' + module.Guid + '"]');
container.animate({
scrollTop: container.scrollTop() + (em.offset().top - container.offset().top)
}, 200);
}
function CopyContent(source, target) {
if (source.Modules) {
for (var i = 0; i < source.Modules.length; i++) {
target.Modules[i].Content = angular.copy(source.Modules[i].Content);
vm.CopyContent(source.Modules[i], target.Modules[i]);
}
}
}
//This is used to replace the module to the right place in the array since we have invisible modules...
function InsertedModule(module, event, index, placeholder) {
var newIndex = angular.copy(index);
for (var i = 0; i < newIndex; i++) {
if (!vm.ShouldModuleBeVisible(vm.SelectedPlaceholder.Modules[i], $rootScope.SelectedCulture.Id)) {
newIndex++;
}
}
if (newIndex > index) {
for (var i = 0; i < vm.SelectedPlaceholder.Modules.length; i++) {
if (vm.SelectedPlaceholder.Modules[i].Guid === module.Guid) {
vm.SelectedPlaceholder.Modules.splice(i, 1);
}
}
vm.SelectedPlaceholder.Modules.splice(newIndex, 0, module);
}
}
function DropModule(module, event, index, placeholder) {
if (module.SavedModuleGuid) {
$rootScope.$broadcast('SAVED_MODULE_DROPPED', module.SavedModuleGuid);
}
if (!module.Guid) {
module = new moduleInstance(module, false, false);
if (module.Dependency && !vm.Container.getInvisibleModules(module.Dependency).length) {
var dependency = vm.moduleAbstracts.GetItemByValue('SystemName', module.Dependency);
if (dependency && dependency.IsInvisible) { //Dependency modules should always be invisible modules
if (!placeholder.InvisibleModules)
placeholder.InvisibleModules = [];
placeholder.InvisibleModules.push(new moduleInstance(dependency));
}
return module;
}
else {
if (module.IsInvisible) {
if (!placeholder.InvisibleModules)
placeholder.InvisibleModules = [];
placeholder.InvisibleModules.push(module);
return false;
}
}
} else {
module = new moduleInstance(module, false, false, placeholder.Id);
}
vm.SetSelectedModule(module);
$rootScope.$broadcast('PAGE_DIRTY', true);
return module;
}
function ActivateSetting(setting) {
vm.ActiveSettings = setting;
}
function SetActiveDevice(device, width, height) {
if (vm.ActiveDeviceSettings && vm.ActiveDeviceSettings.Device == device) {
vm.ActiveDeviceSettings = undefined;
$rootScope.SimulationDevice = undefined;
vm.Container.IsEditing = true;
$timeout(function () {
$rootScope.$broadcast('DEVICE_SIMULATION');
}, 200);
return;
}
if (parseInt(width) > parseInt($rootScope.MaxWidth) && parseInt($rootScope.MaxWidth) > 0) {
width = $rootScope.MaxWidth;
}
vm.ActiveDeviceSettings = {};
vm.ActiveDeviceSettings.Device = device;
vm.ActiveDeviceSettings.Width = width;
vm.ActiveDeviceSettings.Height = height;
$rootScope.SimulationDevice = device;
vm.Container.IsEditing = false;
$timeout(function () {
$rootScope.$broadcast('DEVICE_SIMULATION', device);
}, 200);
}
function SetSelectedModule(module) {
if (vm.Container.IsEditing) {
if (vm.SelectedPlaceholder && vm.SelectedPlaceholder.Type === 2) {
var m = vm.Container.Placeholders[vm.SelectedPlaceholderId].getModuleByGuid(module.Guid);
if (m) {
vm.Container.SelectedModule = m;
}
}
else {
vm.Container.SelectedModule = module;
}
if (vm.Container.SelectedModule) {
if (!vm.Container.SelectedModule.Content.ContainerModuleLink) {
vm.Container.SelectedModule.Content.ContainerModuleLink = {};
}
if (!vm.Container.SelectedModule.Content.ContainerModuleLink.UrlData) {
vm.Container.SelectedModule.Content.ContainerModuleLink.UrlData = {};
}
//backwards compatibility
if (vm.Container.SelectedModule.Content.ContainerModuleLink.Url) {
vm.Container.SelectedModule.Content.ContainerModuleLink.UrlData.Link = vm.Container.SelectedModule.Content.ContainerModuleLink.Url;
}
}
}
}
function DeleteModule(module, placeholder, isInvisible, skipConfirm) {
bizContainerService.DeleteModule(module, placeholder, vm.Container, isInvisible, skipConfirm);
}
function MoveModule(module, placeholder, direction) {
var index = placeholder.Modules.indexOf(module);
if (direction == "up" && index > 0) {
placeholder.Modules.Move(index, index - 1);
}
else if (direction == "down" && index < placeholder.Modules.length - 1) {
placeholder.Modules.Move(index, index + 1);
}
$rootScope.$broadcast('PAGE_DIRTY', true);
}
function CopyModuleToClipboard(module) {
bizContainerService.CopyModuleToClipboard(module);
$mdToast.show(
$mdToast.simple()
.hideDelay(3000)
.parent(angular.element('biz-container-edit > div'))
.textContent('Copied module')
.position('top left'));
$rootScope.$broadcast('CLIPBOARD_MODULE_UPDATE');
}
function CopyModule(module, placeholder, container) {
vm.CopyingModule = true;
bizContainerService.CopyModule(module).then(CopyModuleCallback, CopyModuleError);
function CopyModuleCallback(response) {
var backendCopiedModule = response.data;
newModule = new moduleInstance(backendCopiedModule, false, true);
newModule.Initialized = true;
var index = vm.Container.Placeholders[0].Modules.indexOf(module);
vm.Container.Placeholders[0].Modules.splice(index + 1, 0, newModule);
$rootScope.$broadcast('PAGE_DIRTY', true);
vm.SetSelectedModule(newModule);
vm.CopyingModule = false;
}
function CopyModuleError() {
vm.CopyingModule = false;
}
}
function SaveClipboardModule() {
if (!vm.ClipboardModule) return;
vm.SaveClipboardModuleBtnStatus = "SAVING";
bizContainerService.SaveModuleCombination(vm.ClipboardModule, vm.SaveClipboardModuleName).then(SaveModuleCombinationCallback, SaveModuleCombinationError);
function SaveModuleCombinationCallback(response) {
if (response.data) {
vm.SaveClipboardModuleBtnStatus = "SAVED";
vm.SaveClipboardModuleName = '';
vm.LoadSavedModules();
} else {
vm.SaveClipboardModuleBtnStatus = "ERROR";
}
}
function SaveModuleCombinationError(response) {
vm.SaveClipboardModuleBtnStatus = "ERROR";
}
}
function PasteClipboardModule() {
if (!vm.ClipboardModule) return;
vm.PastingModule = true;
bizContainerService.CopyModule(vm.ClipboardModule).then(CopyModuleCallback, CopyModuleError);
function CopyModuleCallback(response) {
var backendCopiedModule = response.data;
newModule = new moduleInstance(backendCopiedModule, false, true);
newModule.Initialized = true;
vm.Container.Placeholders[0].Modules.splice(0, 0, newModule);
vm.PastingModule = false;
}
function CopyModuleError() {
vm.PastingModule = false;
}
}
function LoadSavedModules() {
bizContainerService.GetSavedModuleCombinations().then(GetSavedModuleCombinationsCallback);
function GetSavedModuleCombinationsCallback(response) {
vm.SavedModules = response.data;
}
}
function GetContainerStyleLimitations() {
bizContainerService.GetContainerStyleLimitations().then(GetContainerStyleLimitationsSuccess);
function GetContainerStyleLimitationsSuccess(response) {
var data = (response.data.d || response.data);
if (data && data != '""' && data != "") {
if (data.d === undefined || (data.d !== undefined && data.d != "")) {
vm.Container.Limitations = JSON.parse(data);
}
}
else {
vm.Container.Limitations = {};
}
}
}
function ClearClipboardModule() {
deleteSessionStorage('SAVEDCONTAINERMODULE');
vm.ClipboardModule = undefined;
}
function LoadClipboardModule() {
//changing from clipboard to session storage due to permissions, but keeping the code in case we want it later
//because with session storage we cant copy to another site.
try {
var storedModuleWrapperJson = getSessionStorage('SAVEDCONTAINERMODULE');
if (!storedModuleWrapperJson) return;
var storedModuleWrapper = JSON.parse(storedModuleWrapperJson);
vm.ClipboardModule = new moduleInstance(storedModuleWrapper.module, false, true);
console.log("Loaded clipboard module", vm.ClipboardModule)
} catch (err) {
console.log("Error parsing session storage module", err);
}
//try {
// $timeout(function () {
// navigator.clipboard.readText().then(ReadClipboardCallback);
// }, 500);
//} catch (err) {
// console.log("no clipboard data found");
//}
//function ReadClipboardCallback(text) {
// if (!text) return;
// try {
// var module = JSON.parse(text);
// if (module.type !== 'BIZPARTCONTAINERMODULE' || module.host !== window.location.hostname) return;
// console.log("found module in clipboard", module);
// vm.ClipboardModule = module.module;
// } catch (err) {
// console.log("clipboard data is not a module");
// }
//}
}
function Init() {
BindWatchers();
if (!vm.modulePermissionKey)
vm.modulePermissionKey = "CONTAINER_MODULE_INSTANCE";
vm.Container.Limitations = {};
vm.Container.AdminMode = true;
vm.Modules = vm.Container.getModules();
vm.InvisibleModules = vm.Container.getInvisibleModules();
if (vm.Modules.length + vm.InvisibleModules.length <= 0) {
setTimeout(function () {
$rootScope.$broadcast('ALL_MODULES_RENDERED');
}, 0);
}
vm.GetCultures();
vm.GetContainerStyleLimitations();
if (vm.Container && vm.Container.Placeholders && vm.Container.Placeholders.length > 0) {
vm.Container = new container(vm.Container);
}
else if (~~vm.Container.Id > 0) {
vm.Container = new container(vm.Container);
vm.Container.initialize({
TextSize: "14px",
TextColor: "#000000",
TextAlign: 'left'
});
}
else {
vm.Container = new container();
vm.Container.initialize({
TextSize: "14px",
TextColor: "#000000",
TextAlign: 'left'
});
}
$rootScope.ModuleAbstracts = vm.moduleAbstracts;
if (vm.Container.RequiredModules) {
for (var i = 0; i < vm.Container.RequiredModules.length; i++) {
var moduleAbstract = vm.moduleAbstracts.GetItemByValue('SystemName', vm.Container.RequiredModules[i]);
if (!moduleAbstract)
continue;
moduleAbstract.Hidden = true;
var modules = vm.Container.getModules(moduleAbstract.SystemName);
if (!modules.length) {
var module = new moduleInstance(moduleAbstract);
vm.Container.Placeholders[0].Modules.push(module);
}
}
}
vm.SelectedPlaceholder = vm.Container.getPlaceholder(vm.SelectedPlaceholderId);
bizCoreService.GetPortalsetting("IsAdvancedContainerEnabled").then(function (response) {
vm.IsAdvancedContainerEnabled = response.data === "True" || vm.usePlaceholders ? true : false;
});
vm.LoadClipboardModule();
vm.LoadSavedModules();
}
vm.$onInit = Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
function bizContainerVersionsDirective() {
var directive = {
restrict: "E",
scope: {
Container: "=container"
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerVersions.html?v=" + bizPartVersion,
controller: bizContainerVersionsController,
controllerAs: "vm",
bindToController: true
};
bizContainerVersionsController.$inject = ["$rootScope", "container", "$mdDialog", "bizContainerService", "$timeout"];
function bizContainerVersionsController($rootScope, container, $mdDialog, bizContainerService, $timeout) {
var vm = this;
vm.ShowVersions = ShowVersions;
vm.CreateVersion = CreateVersion;
vm.LoadVersion = LoadVersion;
function ShowVersions() {
$mdDialog.show({
parent: angular.element(document.body),
templateUrl: "BizContainerVersionsList.tmpl.html",
controller: VersionsController,
controllerAs: 'vm',
bindToController: true,
clickOutsideToClose: true,
locals: {
Container: vm.Container
}
}).then(vm.LoadVersion);
VersionsController.$inject = ["$mdDialog", "bizContainerService"]
function VersionsController($mdDialog, bizContainerService) {
var vm = this;
vm.VersionTypes = [{
Name: "History",
Value: 1
}, {
Name: "User Created",
Value: 2
}];
vm.SelectedVersionType = vm.VersionTypes[0];
vm.Versions = {};
vm.Close = Close;
vm.GetVersions = GetVersions;
vm.LoadVersion = LoadVersion;
vm.DeleteVersion = DeleteVersion;
vm.ChangeVersionType = ChangeVersionType;
function DeleteVersion(version) {
if (!window.confirm("Are you sure you want to delete this version?"))
return;
bizContainerService.DeleteContainerVersion(version.Id).then(DeleteContainerVersionCallback);
function DeleteContainerVersionCallback(response) {
vm.Versions[vm.SelectedVersionType.Value].Remove(version);
}
}
function GetVersions() {
if (!vm.Container || vm.Versions[vm.SelectedVersionType.Value])
return;
bizContainerService.GetContainerVersions(vm.SelectedVersionType.Value, vm.Container.Id).then(GetContainerVersionsCallback);
function GetContainerVersionsCallback(response) {
vm.Versions[vm.SelectedVersionType.Value] = BizPartCoreHelpers.getResponseValue(response, []);
vm.Versions[vm.SelectedVersionType.Value].Pages = Math.ceil(vm.Versions[vm.SelectedVersionType.Value].length / 10);
vm.Versions[vm.SelectedVersionType.Value].StartAt = 0;
}
}
function Close(data) {
$mdDialog.hide(data);
}
function LoadVersion(version) {
vm.Close(version.Id);
}
function ChangeVersionType(versionType) {
vm.SelectedVersionType = versionType;
vm.GetVersions();
}
vm.GetVersions();
}
}
function CreateVersion() {
$mdDialog.show({
parent: angular.element(document.body),
templateUrl: "BizContainerVersionEdit.tmpl.html?v=" + bizPartVersion,
controller: VersionCreateController,
controllerAs: 'vm',
bindToController: true,
clickOutsideToClose: true,
locals: {
Container: vm.Container
}
});
VersionCreateController.$inject = ["$mdDialog", "bizContainerService"]
function VersionCreateController($mdDialog, bizContainerService) {
var vm = this;
vm.VersionTypes = [{
Name: "History",
Value: 1
}, {
Name: "User Created",
Value: 2
}];
vm.Version = {
Container: vm.Container,
OriginalContainerId: vm.Container.Id,
VersionType: vm.VersionTypes[1].Value
}
vm.SelectedVersionType = vm.VersionTypes[0];
vm.Close = Close;
vm.SaveVersion = SaveVersion;
function SaveVersion() {
if (!vm.VersionForm.$valid)
return;
var version = angular.copy(vm.Version);
version.Container = version.Container.createBackendCopy();
bizContainerService.SaveContainerVersion(version).then(SaveContainerVersionsCallback);
function SaveContainerVersionsCallback(response) {
var versionId = BizPartCoreHelpers.getResponseValue(response, -1);
if (versionId > 0)
vm.Close();
}
}
function Close(data) {
$mdDialog.hide(data);
}
}
}
function LoadVersion(versionId) {
if (!versionId || versionId < 0)
return;
bizContainerService.GetContainerVersionWContainer(versionId).then(GetContainerVersionWContainerCallback);
function GetContainerVersionWContainerCallback(response) {
var version = BizPartCoreHelpers.getResponseValue(response);
if (version && version.Container) {
var containerId = vm.Container.Id;
var con = new container(version.Container, true);
con.Id = containerId;
vm.Container = con;
}
}
}
}
return directive;
}
function bizContainerShowDirective() {
var directive = {
restrict: "E",
scope: {
Container: "=container",
containerWrapper: "=?"
},
templateUrl: siteRootPath + "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerShow.html?v=" + bizPartVersion,
controller: bizContainerShowController,
bindToController: true,
controllerAs: "vm"
};
return directive;
}
bizContainerShowController.$inject = ["$rootScope", "$scope", "container", "moduleInstance", "bizContainerService", "containerWrapper"];
function bizContainerShowController($rootScope, $scope, container, moduleInstance, bizContainerService, containerWrapper) {
var vm = this;
vm.LoadMoreAmount = 1;
vm.RenderedCount = 0;
vm.Modules = [];
vm.InvisibleModules = [];
vm.VisibleModuleCount = 0;
vm.ModuleLimit = 1;
vm.LoadMore = LoadMore;
function LoadMore(limit) {
if (vm.ModuleLimit < limit) {
vm.ModuleLimit += vm.LoadMoreAmount;
}
}
$scope.$on('MODULE_RENDER', function (event, module) {
vm.RenderedCount++;
if (vm.RenderedCount == vm.VisibleModuleCount + vm.InvisibleModules.length) {
$rootScope.$broadcast('ALL_MODULES_RENDERED');
}
});
var cancelModuleFinishWatch = $scope.$on('MODULE_FINISH', function (event, module) {
var finishedModules = vm.FinishableModules.Where(function (module) {
return module.IsFinished;
});
if (finishedModules.length >= vm.FinishableModules.length) {
vm.Container.finish();
cancelModuleFinishWatch();
}
});
function Init() {
if (vm.Container) {
vm.Modules = vm.Container.getModules();
vm.FinishableModules = vm.Container.getFinishableModules();
var finishedModules = vm.FinishableModules.Where(function (module) {
return module.IsFinished;
});
if (finishedModules.length >= vm.FinishableModules.length)
vm.Container.finish();
for (var i = 0; i < vm.Modules.length; i++) {
if (!vm.Modules[i].isHiddenForUser()) {
vm.VisibleModuleCount++;
}
}
vm.InvisibleModules = vm.Container.getInvisibleModules();
if (vm.containerWrapper)
bizContainerService.ContainerWrapper = new containerWrapper(vm.containerWrapper);
var p = vm.Container.getPlaceholder(vm.Container.Placeholders.length - 1);
vm.Container.Placeholders = [];
vm.Container.Placeholders.push(p);
}
}
vm.$onInit = Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
$scope.$on("$destroy", function () {
vm.Container.destroy();
$scope.$broadcast("CONTAINER_SHOW_DESTROYED");
console.log("Destroyed bizContainerShow directive");
});
}
function bizContainerContentDirective() {
var directive = {
restrict: "E",
require: "^bizContainerEdit",
scope: {
moduleAbstracts: "="
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerContent.html?v=" + bizPartVersion,
controller: bizContainerContentController,
bindToController: true,
controllerAs: "vm"
};
bizContainerContentController.$inject = ["$rootScope", "moduleAbstract", "bizContainerService"];
function bizContainerContentController($rootScope, moduleAbstract, bizContainerService) {
var vm = this;
vm.Init = Init;
vm.selectCat = true;
vm.Modules = [];
vm.ModuleAbstractCategories = [];
vm.AllModuleAbstracts = [];
vm.GetType = GetType;
vm.GetModulesFromCategory = GetModulesFromCategory;
function GetModulesFromCategory() {
if (vm.ModuleFilterCategory) {
bizContainerService.GetModulesFromCategory(vm.ModuleFilterCategory).then(GetModulesFromCategorySuccess);
function GetModulesFromCategorySuccess(response) {
vm.Modules = (response.data.d || response.data);
}
}
else
vm.Modules = vm.AllModuleAbstracts;
}
function Init() {
if (vm.moduleAbstracts && vm.moduleAbstracts.length > 0) {
for (var i = 0; i < vm.moduleAbstracts.length; i++) {
vm.Modules.push(new moduleAbstract(vm.moduleAbstracts[i]));
}
vm.AllModuleAbstracts = angular.copy(vm.Modules);
setTimeout(function () {
$('[data-toggle="tooltip"]').tooltip();
}, 100);
}
bizContainerService.GetAllBizContainerModuleCategoryPages().then(GetAllBizContainerModuleCategoryPagesSuccess);
function GetAllBizContainerModuleCategoryPagesSuccess(response) {
vm.Categories = (response.data.d || response.data);
if (vm.moduleAbstracts && vm.moduleAbstracts.length > 0) {
vm.ModuleAbstractCategories = [];
for (var i = 0; i < vm.Categories.length; i++) {
vm.ModuleAbstractCategories.push(vm.Categories[i]);
}
}
}
}
function GetType(module) {
if (module.IsInvisible) {
return "'invisible'";
}
return "'module'";
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
function bizContainerStyleDirective() {
var directive = {
restrict: "E",
require: "^bizContainerEdit",
scope: {
container: "="
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerStyle.html?v=" + bizPartVersion,
controller: bizContainerStyleController,
bindToController: true,
controllerAs: "vm"
};
bizContainerStyleController.$inject = ["style", "$mdDialog", "$rootScope", "bizMediabankService"];
function bizContainerStyleController(style, $mdDialog, $rootScope, bizMediabankService) {
var vm = this;
vm.ResetAllModuleStyles = ResetAllModuleStyles;
vm.ResetSimulation = ResetSimulation;
vm.CopyDesktopStyle = CopyDesktopStyle;
vm.CopyMobileStyle = CopyMobileStyle;
vm.MediabankCallback = MediabankCallback;
vm.SelectFromMediabank = SelectFromMediabank;
vm.UploadToMediabank = UploadToMediabank;
function MediabankCallback(file) {
if (file)
vm.container.Style.BackgroundImage = file.FileUrl;
}
function SelectFromMediabank() {
bizMediabankService.ShowDownloadDialog(bizMediabankService.FileTypes.Image).then(vm.MediabankCallback);
}
function UploadToMediabank() {
bizMediabankService.ShowUploadDialog(bizMediabankService.FileTypes.Image).then(vm.MediabankCallback);
}
function CopyDesktopStyle() {
vm.container.Style.Mobile = angular.copy(vm.container.Style);
vm.container.Style.Mobile.Enabled = true;
vm.container.Style.Mobile.Mobile = undefined;
}
function CopyMobileStyle() {
vm.container.Style = angular.copy(vm.container.Style.Mobile);
}
function ResetAllModuleStyles() {
var confirmDialog = $mdDialog.confirm({
title: "Confirm reset",
content: "Do you really want to reset all module styles?",
ok: "Yes",
cancel: "No",
parent: angular.element(document.body)
});
$mdDialog.show(confirmDialog).then(function () {
var modules = vm.container.getModules();
for (var i = 0; i < modules.length; i++) {
modules[i].Style = new style();
}
});
}
function ResetSimulation() {
vm.container.AdminSimulation = '';
}
$('[data-toggle="tooltip"]').tooltip({ html: true });
vm.$onInit = function () {
vm.container.AdminMode = true;
};
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
function bizContainerModuleAdminStylesheetDirective() {
var directive = {
restrict: "E",
scope: {
module: "=",
container: "="
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerModuleAdminStylesheet.html?v=" + bizPartVersion,
bindToController: true,
controllerAs: "vm",
controller: function () {
var vm = this;
vm.$onInit = function () { };
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
};
return directive;
}
function bizContainerModuleContainerDirective($compile, $http, moduleClass, $timeout, $filter, bizContainerSettings, $ocLazyLoad) {
var directive = {
restrict: "AE",
scope: {
module: "=",
type: "@",
container: "=",
selectedPlaceholder: "=?",
selectedPlaceholderId: "=?"
},
template: "",
link: bizModuleContainerLink,
controller: function () {
var vm = this;
vm.$onInit = function () { };
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
};
function bizModuleContainerLink(scope, ele, attrs) {
var directiveTypes = {
"admin": {
Build: BuildAdminHtml
},
"admin-settings": {
Build: BuildAdminSettingsHtml
},
"admin-style": {
Build: BuildAdminStyleHtml
},
"view": {
Build: BuildViewHtml
}
}
function BuildHtml() {
var lazyLoadModuleName = 'Container' + scope.module.SystemName;
var lazyLoadConfig = $ocLazyLoad.getModuleConfig(lazyLoadModuleName);
function doBuild() {
var html = directiveTypes[scope.type].Build();
$compile(ele.contents())(scope);
if (scope.type == "view") {
scope.module.$element = ele.find(scope.module.Component);
}
}
if (lazyLoadConfig) {
$ocLazyLoad.load(lazyLoadModuleName).then(doBuild);
} else {
doBuild();
}
}
function GetStyleProperty(property, value, important, defaultValue) {
if (!value)
return defaultValue || "";
var style = property + ":" + value;
if (important)
style += " !important";
return style + ";"
}
function BuildAdminHtml() {
var templateUrl;
var templateCss = '';
if (scope.module.View && scope.module.View.AdminTemplateUrl) {
templateUrl = scope.module.View.AdminTemplateUrl;
if (scope.module.View.CssContent) {
var customCssContent = scope.module.View.CssContent.replace(/CONMI_PLACEHOLDER/g, scope.module.Guid);
templateCss = "";
}
}
ele.html(templateCss + "<" + scope.module.AdminComponent + " class='biz-container-module' selected-placeholder-id=\"selectedPlaceholderId\" selected-placeholder=\"selectedPlaceholder\" module=\"module\" container=\"container\" conmi=\"{{::module.Guid}}\"" +
(templateUrl ? ' templateurl=\"' + templateUrl + '\" ' : '') +
"ng-class=\"module.AdminSimulation\"" +
"ng-init=\"module.render()\">" + scope.module.AdminComponent + '>');
// load baseStyle from JSON.
if (scope.module.Id <= 0 && !scope.module.Content.HasLoadedCustomStyleSettings && !scope.module.PreventInit) {
scope.module.Content.HasLoadedCustomStyleSettings = true;
if (bizContainerSettings["PortalCustomerName"].length) {
var baseStyleFile = 'Customers/BizContainerCustomModules/' + bizContainerSettings["PortalCustomerName"] + '/StyleSettings/' + scope.module.SystemName + '.json?v=' + bizContainerSettings["PortalVersion"];
$http.get(siteRootPath + baseStyleFile).then(function (response) {
var json = response.data;
if (bizContainerSettings.CurrentContainerType && json[bizContainerSettings.CurrentContainerType]) {
json.Style = json[bizContainerSettings.CurrentContainerType].Style;
json.Content = json[bizContainerSettings.CurrentContainerType].Content;
}
for (var key in json.Style) {
if (json.Style.hasOwnProperty(key)) {
if (key == "Mobile") {
scope.module.Style.Mobile.Enabled = true;
for (var subkey in json.Style[key]) {
scope.module.Style.Mobile[subkey] = json.Style[key][subkey];
}
}
else {
scope.module.Style[key] = json.Style[key];
}
}
}
for (var key in json.Content) {
if (json.Content.hasOwnProperty(key)) {
scope.module.Content[key] = json.Content[key];
}
}
}, function () { console.warn("No customization json file found for module " + scope.module.SystemName); });
}
}
}
function BuildAdminSettingsHtml() {
ele.html("<" + scope.module.AdminSettingsComponent + " module=\"module\" container=\"container\">" + scope.module.AdminSettingsComponent + ">");
}
function BuildAdminStyleHtml() {
ele.html("<" + scope.module.AdminStyleComponent + " module=\"module\" container=\"container\">" + scope.module.AdminStyleComponent + ">");
}
function BuildViewHtml() {
var moduleId = scope.module.Guid;
if (scope.module.isHiddenForUser()) {
scope.module.Hide = true;
scope.module.Style.HideOnMobile = true;
scope.module.Style.HideOnDesktop = true;
return;
}
var isButton = scope.module.SystemName === "Button" || scope.module.SystemName === "WelcomeGuideButton";
var stylesheet = '';
var templateUrl;
if (scope.module.View && scope.module.View.UserTemplateUrl) {
templateUrl = scope.module.View.UserTemplateUrl;
}
var element = "";
var onClick = "";
if (scope.module.Content.ContainerModuleScroll && scope.module.Content.ContainerModuleScroll.Enabled) {
onClick = 'ng-click="scrollToModule(module.Content.ContainerModuleScroll.Guid)"';
scope.scrollToModule = function (guid) {
var module = scope.container.getModuleByGuid(guid);
scope.container.goToModule(module);
}
}
if (scope.module.Content.ContainerModuleExpandSegment && scope.module.Content.ContainerModuleExpandSegment.Enabled) {
onClick = 'ng-click="expandSegment(module.Content.ContainerModuleExpandSegment.Guid)"';
scope.expandSegment = function (guid) {
scope.container.toggleExpandSegment(guid);
}
}
if (scope.module.Content.ContainerModuleLink && scope.module.Content.ContainerModuleLink.Enabled && (!scope.module.IsRestricted || scope.module.HasFullAccess)) {
var moduleLink;
if (scope.module.Content.ContainerModuleLink.UrlData) {
if (scope.module.Content.ContainerModuleLink.UrlData.LinkType === 'STATE') {
moduleLink = 'ui-sref="{{::module.Content.ContainerModuleLink.UrlData.Link}}"';
} else {
moduleLink = 'ng-href="{{::module.Content.ContainerModuleLink.UrlData.Link | siteroot}}" target="' + (scope.module.Content.ContainerModuleLink.NewTab ? '_blank' : '_self') + '"';
}
} else {
moduleLink = 'ng-href="{{::module.Content.ContainerModuleLink.Url | siteroot}}" target="' + (scope.module.Content.ContainerModuleLink.NewTab ? '_blank' : '_self') + '"';
}
element = '' +
"<" + scope.module.Component + " class='biz-container-module " + GetModuleClasses(scope.module) + "' module=\"::module\" container=\"::container\" conmi=\"" + moduleId + "\" id=\"conmi-" + moduleId + "\"" +
(templateUrl ? ' templateurl=\"' + templateUrl + '\" ' : '') +
"ng-init=\"module.render()\">" + scope.module.Component + ">" +
" ";
}
else if (!scope.module.IsRestricted || scope.module.HasFullAccess) {
element = "<" + scope.module.Component + " " + onClick + " class='biz-container-module " + GetModuleClasses(scope.module) + "' module=\"::module\" container=\"::container\" conmi=\"" + moduleId + "\" id=\"conmi-" + moduleId + "\"" +
(templateUrl ? ' templateurl=\"' + templateUrl + '\" ' : '') + GetNgClass(scope.module) +
"ng-init=\"module.render()\">" + scope.module.Component + ">";
}
else {
element = "<" + scope.module.Component + " class='biz-container-module " + GetModuleClasses(scope.module) + "' module=\"::module\" container=\"::container\" conmi=\"" + moduleId + "\" id=\"conmi-" + moduleId + "\"" +
(templateUrl ? ' templateurl=\"' + templateUrl + '\" ' : '') +
"ng-init=\"module.render()\">" + scope.module.Component + ">";
}
function GetNgClass(module) {
var ng = "";
if (module.Content.ContainerModuleExpandSegment && module.Content.ContainerModuleExpandSegment.Enabled) {
var targetGuid = module.Content.ContainerModuleExpandSegment.Guid;
ng = " ng-class=\"{\'expanded\': container.ExpandedSegmentStatusList[\'" + targetGuid + "\']}\" ";
}
return ng;
}
function GetModuleClasses(module) {
var cssClasses = "";
if (module.IsRestricted && !module.HasFullAccess && module.Content.Restriction) {
var restrictions = Object.keys(module.Content.Restriction);
for (var i = 0; i < restrictions.length; i++) {
if (module.Content.Restriction[restrictions[i]] == true) {
cssClasses += "restriction-" + restrictions[i] + " ";
}
}
}
if (module.Content.ContainerModuleExpandSegment && module.Content.ContainerModuleExpandSegment.Enabled) {
cssClasses += "expandable ";
}
return cssClasses;
}
ele.html(stylesheet + element);
}
scope.$watch('module', function (newVal, oldVal) {
if (newVal != oldVal) {
BuildHtml();
}
});
scope.$root.$on('HIDE_MODULE_TYPE', function (event, systemname) {
if (systemname == scope.module.SystemName) {
scope.module.Invisible = true;
scope.module.Hide = true;
}
})
scope.$root.$on('SHOW_MODULE_TYPE', function (event, systemname) {
if (systemname == scope.module.SystemName) {
scope.module.Invisible = false;
scope.module.Hide = false;
}
})
scope.$root.$on('HIDE_MODULES', function (event, exceptionSystemName) {
if (exceptionSystemName != scope.module.SystemName)
scope.module.Hide = true;
})
scope.$root.$on('SHOW_MODULES', function () {
if (!scope.module.Invisible)
scope.module.Hide = false;
})
scope.$root.$on('CHANGE_MODULE_VIEW', function (event, systemname) {
if (systemname == scope.module.SystemName) {
BuildHtml();
}
})
BuildHtml();
}
return directive;
}
function bizModuleAbstractSettingsPluginWrapper($compile) {
var directive = {
restrict: "E",
scope: {
module: "=",
plugin: "="
},
template: "",
link: bizModuleAbstractSettingsPluginWrapperLink,
controller: function () {
var vm = this;
vm.$onInit = function () { };
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
};
function bizModuleAbstractSettingsPluginWrapperLink(scope, ele, attrs) {
function CompilePlugin() {
ele.html("<" + scope.plugin.Component + " module='module'>" + scope.plugin.Component + ">");
$compile(ele.contents())(scope);
}
scope.$watch('plugin', function (newVal, oldVal) {
if (newVal != oldVal) {
CompilePlugin();
}
});
CompilePlugin();
}
return directive;
}
function bizContainerModuleStyleDirective() {
var directive = {
restrict: "E",
scope: {
module: "=",
container: "="
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerModuleStyle.html?v=" + bizPartVersion,
controller: bizContainerModuleStyleController,
controllerAs: "vm",
bindToController: true
};
bizContainerModuleStyleController.$inject = ["style", "$mdDialog", "$scope", "$rootScope", "bizMediabankService", "bizContainerService"];
function bizContainerModuleStyleController(style, $mdDialog, $scope, $rootScope, bizMediabankService, bizContainerService) {
var vm = this;
vm.SetTextAlign = SetTextAlign;
vm.SetMobileTextAlign = SetMobileTextAlign;
vm.SetTextVerticalAlignClass = SetTextVerticalAlignClass;
vm.ResetStyle = ResetStyle;
vm.ApplyOnAllSameModules = ApplyOnAllSameModules;
vm.ResetSimulation = ResetSimulation;
vm.MediabankCallback = MediabankCallback;
vm.SelectFromMediabank = SelectFromMediabank;
vm.UploadToMediabank = UploadToMediabank;
vm.CopyDesktopStyle = CopyDesktopStyle;
vm.CopyMobileStyle = CopyMobileStyle;
vm.CopyStyle = CopyStyle;
vm.PasteStyle = PasteStyle;
vm.ShowAdminPanel = ShowAdminPanel;
function ShowAdminPanel(panelName) {
return vm.module.AdminPanelsVisible && vm.module.AdminPanelsVisible.indexOf(panelName) >= 0;
}
function CopyStyle() {
vm.container.CopiedStyle = angular.copy(vm.module.Style);
bizContainerService.CopiedStyle = vm.container.CopiedStyle;
}
function PasteStyle() {
if (vm.container.CopiedStyle)
vm.module.Style = angular.copy(vm.container.CopiedStyle);
}
function CopyDesktopStyle() {
vm.module.Style.Mobile = angular.copy(vm.module.Style);
vm.module.Style.Mobile.Enabled = true;
vm.module.Style.Mobile.Mobile = undefined;
}
function CopyMobileStyle() {
vm.module.Style = angular.copy(vm.module.Style.Mobile);
}
function MediabankCallback(file) {
if (file) {
vm.module.Style.BackgroundImage = file.FileUrl;
}
}
function SelectFromMediabank() {
bizMediabankService.ShowDownloadDialog(bizMediabankService.FileTypes.Image).then(vm.MediabankCallback);
}
function UploadToMediabank() {
bizMediabankService.ShowUploadDialog(bizMediabankService.FileTypes.Image).then(vm.MediabankCallback);
}
function SetTextAlign(align) {
if (vm.module.Style.TextAlign == align) {
vm.module.Style.TextAlign = undefined;
}
else {
vm.module.Style.TextAlign = align;
}
}
function SetMobileTextAlign(align) {
if (vm.module.Style.Mobile.TextAlign == align) {
vm.module.Style.Mobile.TextAlign = undefined;
}
else {
vm.module.Style.Mobile.TextAlign = align;
}
}
function SetTextVerticalAlignClass(cl) {
if (vm.module.Style.TextVerticalAlignClass == cl) {
vm.module.Style.TextVerticalAlignClass = undefined;
}
else
vm.module.Style.TextVerticalAlignClass = cl;
}
function ResetStyle() {
var confirmDialog = $mdDialog.confirm({
title: "Confirm reset",
content: "Do you really want to reset the style for this module?",
ok: "Yes",
cancel: "No",
parent: angular.element(document.body)
});
$mdDialog.show(confirmDialog).then(function () {
vm.module.Style = new style();
});
}
function ApplyOnAllSameModules() {
var confirmDialog = $mdDialog.confirm({
title: "Confirm apply",
content: "Do you really want to apply this style to all \"" + vm.module.Name + "\" modules?",
ok: "Yes",
cancel: "No",
parent: angular.element(document.body)
});
$mdDialog.show(confirmDialog).then(function () {
var modules = vm.container.getModules(vm.module.Name);
for (var i = 0; i < modules.length; i++) {
modules[i].Style = angular.copy(vm.module.Style);
}
});
}
function ResetSimulation() {
vm.module.AdminSimulation = '';
}
$scope.$watch('vm.module.View', function (newVal, oldVal) {
if (newVal != oldVal && vm.module.Guid == vm.moduleGuid) {
$rootScope.$broadcast('CHANGE_MODULE_VIEW', vm.module.SystemName);
}
vm.moduleGuid = vm.module.Guid;
});
vm.$onInit = function () {
vm.module.AdminStyle = '';
vm.moduleGuid = vm.module.Guid;
vm.container.CopiedStyle = bizContainerService.CopiedStyle;
};
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
$('[data-toggle="tooltip"]').tooltip({ html: true });
}
return directive;
}
function bizContainerModuleSettingsDirective() {
var directive = {
restrict: "E",
scope: {
module: "="
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerModuleSettings.html?v=" + bizPartVersion,
controller: bizContainerModuleSettingsController,
controllerAs: "vm",
bindToController: true
};
bizContainerModuleSettingsController.$inject = ["$rootScope", "$scope"];
function bizContainerModuleSettingsController($rootScope, $scope) {
var vm = this;
$scope.$watch('vm.module', function (module) {
if (!module)
return;
vm.ModuleAbstract = $rootScope.ModuleAbstracts.GetItemByValue('SystemName', vm.module.SystemName);
});
}
return directive;
}
function bizContainerModuleStatisticsDirective() {
var directive = {
restrict: "E",
scope: {
module: "="
},
templateUrl: "Modules/BizPart.BizContainer/Core/GUI/Views/BizContainerModuleStatistics.html?v=" + bizPartVersion,
controller: bizContainerModuleStatisticsController,
controllerAs: "vm",
bindToController: true
}
bizContainerModuleStatisticsController.$inject = ["$scope", "bizContainerService"];
function bizContainerModuleStatisticsController($scope, bizContainerService) {
var vm = this;
vm.UserEvents = [];
vm.Countries = [];
vm.data = [[], []];
vm.labels = [];
vm.series = ["Total", "Unique"];
vm.chartOptions = {
scales: {
xAxes: [{
ticks: {
beginAtZero: true
}
}]
}
};
vm.barChartLimit = 4;
vm.GetModuleInstanceUserEvents = GetModuleInstanceUserEvents;
vm.HandleStatisticsData = HandleStatisticsData;
vm.ResetData = ResetData;
function GetModuleInstanceUserEvents() {
loaderContainer($("#container-module-stats-loader"));
bizContainerService.GetModuleInstanceUserEvents(vm.module.Id).then(GetModuleInstanceUserEventsSuccess);
function GetModuleInstanceUserEventsSuccess(response) {
if (response && (response.data.d || response.data)) {
vm.UserEvents = (response.data.d || response.data);
vm.HandleStatisticsData();
}
loaderContainerStop($("#container-module-stats-loader"));
}
}
function HandleStatisticsData() {
vm.ResetData();
//WE WANT TO ADD SUPPORT FOR BACKGROUND WORKERS IN THE SYSTEM AND THEN THIS FUNCTION SHOULD BE RUN INSIDE A BACKGROUND WORKER
var holder = {};
for (var i = 0; i < vm.UserEvents.length; i++) {
if (vm.selectedCountry !== undefined && vm.selectedCountry.Name == vm.UserEvents[i].Country) {
var found = false;
for (var j = 0; j < vm.Countries.length; j++) {
if (vm.Countries[j].Name == vm.UserEvents[i].Country) {
found = true;
break;
}
}
if (!found)
vm.Countries.push({ Name: vm.UserEvents[i].Country });
if (holder[vm.UserEvents[i].Type] == undefined) {
vm.labels.push(vm.UserEvents[i].Name);
holder[vm.UserEvents[i].Type] = { Users: [], Count: 0, UniqueCount: 0 };
}
if (holder[vm.UserEvents[i].Type].Users.indexOf(vm.UserEvents[i].UserId) == -1) {
holder[vm.UserEvents[i].Type].Users.push(vm.UserEvents[i].UserId);
holder[vm.UserEvents[i].Type].UniqueCount++;
}
holder[vm.UserEvents[i].Type].Count++;
}
else if (vm.selectedCountry == undefined || vm.selectedCountry.Name == "") {
var found = false;
for (var j = 0; j < vm.Countries.length; j++) {
if (vm.Countries[j].Name == vm.UserEvents[i].Country) {
found = true;
break;
}
}
if (!found)
vm.Countries.push({ Name: vm.UserEvents[i].Country });
if (holder[vm.UserEvents[i].Type] == undefined) {
vm.labels.push(vm.UserEvents[i].Name);
holder[vm.UserEvents[i].Type] = { Users: [], Count: 0, UniqueCount: 0 };
}
if (holder[vm.UserEvents[i].Type].Users.indexOf(vm.UserEvents[i].UserId) == -1) {
holder[vm.UserEvents[i].Type].Users.push(vm.UserEvents[i].UserId);
holder[vm.UserEvents[i].Type].UniqueCount++;
}
holder[vm.UserEvents[i].Type].Count++;
}
}
for (var prop in holder) {
if (holder.hasOwnProperty(prop)) {
vm.data[0].push(holder[prop].Count);
vm.data[1].push(holder[prop].UniqueCount);
}
}
}
function ResetData() {
vm.data = [[], []];
vm.labels = [];
vm.series = ["Total", "Unique"];
}
vm.$onInit = function () {
vm.GetModuleInstanceUserEvents();
};
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
$scope.$watch("vm.module.Id", function (newVal, oldVal) {
if (newVal && newVal != oldVal) {
vm.ResetData();
vm.GetModuleInstanceUserEvents();
}
});
}
return directive;
}
function bizContainerModuleMediabankDirective() {
var directive = {
restrict: "E",
scope: {
file: "=?",
fileUrl: "=?",
fileThumbnail: "=?",
fileName: "=?",
fileType: "@",
hideAdvanced: "@",
settings: '=?'
},
template: '
File url
',
link: linkFunction
}
function linkFunction(scope, element, attrs) {
var skipFileUpdate = false;
if (!scope.file) {
scope.file = {
FileUrl: scope.fileUrl,
Thumbnail: scope.fileThumbnail,
Name: scope.fileName
};
}
scope.$watch('fileUrl', function (value) {
scope.file.FileUrl = value;
});
scope.$watch('fileThumbnail', function (value) {
scope.file.Thumbnail = value;
});
scope.$watch('fileName', function (value) {
scope.file.Name = value;
});
scope.$watch('file', function (value) {
if (!value)
value = { FileUrl: "", Thumbnail: "" };
scope.fileUrl = value.FileUrl;
scope.fileThumbnail = value.Thumbnail;
scope.fileName = value.Name;
}, true);
}
return directive;
}
function bizContainerSlideDotStyle() {
var directive = {
restrict: "E",
scope: {
selectedStyle: "=",
onChange: "&"
},
template: ' ',
controller: bizContainerModuleSettingsController,
controllerAs: "vm",
bindToController: true
};
bizContainerModuleSettingsController.$inject = [];
function bizContainerModuleSettingsController() {
var vm = this;
vm.ValueChanged = ValueChanged;
vm.SlideDotStyles = [{
Name: "Hidden",
Value: "biz-slick-hidden"
}, {
Name: "Small circles",
Value: "biz-slick-circle"
}, {
Name: "Big circles",
Value: "biz-slick-circle bigger"
}, {
Name: "Small rectangles",
Value: "biz-slick-square"
}, {
Name: "Big rectangles",
Value: "biz-slick-square bigger"
}, {
Name: "Small rings",
Value: "biz-slick-ring"
}, {
Name: "Big rings",
Value: "biz-slick-ring bigger"
}, {
Name: "Blue",
Value: "biz-slick-blue"
}, {
Name: "Inside blue",
Value: "biz-slick-dots-inside-blue"
}];
function ValueChanged() {
if (vm.onChange)
vm.onChange();
}
vm.$onInit = function () {
if (!vm.selectedStyle)
vm.selectedStyle = vm.SlideDotStyles[0].Value;
};
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
/* FACTORYS (CLASSES) */
angular.module('BizContainer').factory('containerWrapper', containerWrapperFactory);
angular.module('BizContainer').factory('container', containerFactory);
angular.module('BizContainer').factory('placeholder', placeholderFactory);
angular.module('BizContainer').factory('settings', settingsFactory);
angular.module('BizContainer').factory('style', styleFactory);
angular.module('BizContainer').factory('moduleAbstract', moduleAbstractFactory);
angular.module('BizContainer').factory('moduleInstance', moduleInstanceFactory);
angular.module('BizContainer').factory('moduleAbstractSettingsPlugin', moduleAbstractSettingsPluginFactory);
angular.module('BizContainer').factory('moduleEvent', moduleEventFactory);
containerFactory.$inject = ["placeholder", "style", "$q", "$mdToast", "$rootScope", "$mdDialog", "$timeout"];
placeholderFactory.$inject = ["moduleInstance"];
moduleInstanceFactory.$inject = ["$rootScope", "moduleAbstract", "style", "settings", "bizContainerService", "bizContainerSettings"];
moduleAbstractFactory.$inject = [];
moduleAbstractSettingsPluginFactory.$inject = [];
moduleEventFactory.$inject = [];
function containerWrapperFactory() {
var containerWrapper = function (wrapper, cultureId) {
if (!wrapper)
wrapper = {};
this.Id = wrapper.Id;
this.Name = wrapper.Name;
this.NameTranslations = wrapper.NameTranslations;
this.Tags = wrapper.Tags;
if (!this.Name && this.NameTranslations && this.NameTranslations.length) {
var translation = this.NameTranslations[0];
if (cultureId && cultureId > 0)
translation = this.NameTranslations.GetItemByValue('CultureId', cultureId);
this.Name = translation.Value;
}
};
return containerWrapper;
}
function containerFactory(placeholder, style, $q, $mdToast, $rootScope, $mdDialog, $timeout) {
var container = function (con, preventInit, parent) {
if (!con)
con = {};
this.Id = con.Id || -1;
this.Placeholders = [];
this.RequiredModules = con.RequiredModules || [];
this.Parent = con.Parent || null;
this.ModulesToDelete = con.ModulesToDelete || [];
if (con.Placeholders) {
for (var i = 0; i < con.Placeholders.length; i++) {
this.Placeholders.push(new placeholder(con.Placeholders[i], preventInit));
}
}
if (con.Style) {
if (typeof con.Style == "string") {
this.Style = new style(JSON.parse(con.Style));
}
else {
this.Style = con.Style;
}
}
else {
this.Style = new style();
}
this.IsEditing = true;
this.AdminMode = con.AdminMode || false;
this.Limitations = con.Limitations || [];
this._saveFunctions = [];
if (parent) {
this.Parent = {
Name: parent.Name || parent.Title || "",
NameTranslations: parent.NameTranslations || [],
ImageUrl: parent.ImageUrl || "",
EngageObjectType: parent.EngageObjectType || 0,
EngageObjectId: parent.EngageObjectId || 0,
IsRootObject: parent.ObjectRootId === undefined || parent.ObjectRootId === parent.Id
};
}
};
container.prototype.getAncestors = function (module) {
var ancestors = [];
var modules = this.getModules();
var parentGuid = module.ParentGuid;
while (parentGuid) {
var parent = modules.GetItemByValue('Guid', parentGuid);
ancestors.push(parent);
parentGuid = parent.ParentGuid;
}
return ancestors;
}
container.prototype.toggleExpandSegment = function (segmentGuid) {
$rootScope.$broadcast('TOGGLE_EXPANDED_SEGMENT_' + segmentGuid);
}
container.prototype.updateExpandedSegmentStatus = function (segmentGuid, expanded) {
if (!segmentGuid) return;
if (!this.ExpandedSegmentStatusList) {
this.ExpandedSegmentStatusList = {};
}
this.ExpandedSegmentStatusList[segmentGuid] = expanded;
}
container.prototype.goToModule = function (module) {
if (!module.$element)
return;
var wasHidden = false;
var segments = this.getAncestors(module);
for (var i = 0; i < segments.length; i++) {
if (segments[i].Content.Expanding && !segments[i].Expanded)
wasHidden = true;
segments[i].Expanded = true;
}
if (wasHidden)
$timeout(navigate, 200);
else
navigate();
function navigate() {
angular.element('html, body').animate({
scrollTop: module.$element.offset().top + 'px'
}, 'fast');
}
}
container.prototype.onDestroy = function (fn) {
if (typeof fn != 'function')
return;
if (!this._destroyHandlers)
this._destroyHandlers = [];
this._destroyHandlers.push(fn);
}
container.prototype.destroy = function () {
if (this._destroyed)
return;
this._destroyed = true;
if (!this._destroyHandlers)
return;
for (var i = 0; i < this._destroyHandlers.length; i++) {
this._destroyHandlers[i](this);
}
}
container.prototype.onFinish = function (fn) {
if (typeof fn != 'function')
return;
if (!this._finishHandlers)
this._finishHandlers = [];
this._finishHandlers.push(fn);
}
container.prototype.finish = function () {
if (this._finished)
return;
this._finished = true;
if (!this._finishHandlers)
return;
for (var i = 0; i < this._finishHandlers.length; i++) {
this._finishHandlers[i](this);
}
}
container.prototype.onModuleMouseEnter = function (module) {
if (!this.ModuleHoverList) {
this.ModuleHoverList = [];
}
//check if any child module already exist in hoverlist, which means this current module was missed when adding the child module and needs to be inserted into the correct place
var topIndexOfChildModules = GetTopIndexForChildModulesAlreadyInList(this.ModuleHoverList);
if (topIndexOfChildModules >= 0) {
this.ModuleHoverList.splice(topIndexOfChildModules, 0, module.Guid);
return;
} else {
this.ModuleHoverList.push(module.Guid);
}
function GetTopIndexForChildModulesAlreadyInList(mhList) {
var childModules = module.getChildModules();
if (childModules.length && mhList.length) {
var topIndex = -1;
for (var i = 0; i < childModules.length; i++) {
var index = mhList.indexOf(childModules[i].Guid);
if (index >= 0) {
if (topIndex < index) topIndex = index;
}
}
return topIndex;
}
return -1;
}
}
container.prototype.onModuleMouseLeave = function (module) {
if (!this.ModuleHoverList) {
return;
}
var index = this.ModuleHoverList.indexOf(module.Guid);
if (index < 0) {
console.log("guid not found in hoverlist when leaving module", module.Guid);
return;
}
this.ModuleHoverList.length = index;
}
container.prototype.handleSaveFunctions = function () {
var requests = [];
for (var i = 0; i < this._saveFunctions.length; i++) {
requests.push(this._saveFunctions[i].fn(this._saveFunctions[i].args));
}
var promise = $q.all(requests);
return promise;
}
container.prototype.setModuleFinishHandler = function (fn) {
this.forEachModule(function (module) {
module._finishHandler = fn;
});
}
container.prototype.addSaveFunction = function (fn, args) {
if (args)
this.removeSaveFunction(args);
this._saveFunctions.push({
args: args,
fn: fn
});
}
container.prototype.removeSaveFunction = function (args) {
var i = this._saveFunctions.GetIndexByValue('args', args);
if (i > -1)
this._saveFunctions.splice(i, 1);
}
container.prototype.CultureFilter = function (cultureId) {
return function (module) {
return !cultureId || !module.Content || !module.Content.Translations || module.Content.Translations.VisibleForCultures.indexOf(cultureId) > -1;
}
}
container.prototype.initialize = function (st) {
this.Placeholders.push(new placeholder());
this.Style = new style(st);
}
container.prototype.getContainerCultureFiltered = function (cultureId) {
var container = angular.copy(this);
for (var p = 0; p < container.Placeholders.length; p++) {
for (var m = container.Placeholders[p].Modules.length - 1; m >= 0; m--) {
var module = container.Placeholders[p].Modules[m];
if (!VerifyAccess(module)) {
container.Placeholders[p].Modules.splice(m, 1);
continue;
}
HandleModule(container.Placeholders[p].Modules[m]);
}
}
return container;
function VerifyAccess(module) {
if (!module.Content.Translations)
return true;
else {
return module.Content.Translations.VisibleForCultures.indexOf(cultureId) > -1;
}
}
function HandleModule(module) {
if (module.Modules && module.Modules.length > 0) {
for (var i = module.Modules.length - 1; i >= 0; i--) {
if (!VerifyAccess(module)) {
module.Modules.splice(i, 1);
continue;
}
HandleModule(module.Modules[i]);
}
}
}
}
container.prototype.createBackendCopy = function () {
var copy = angular.copy(this);
var order = 0;
copy.SelectedModule = undefined;
copy.Limitations = undefined;
copy.Style = JSON.stringify(copy.Style);
for (var p = 0; p < copy.Placeholders.length; p++) {
if (copy.Placeholders[p].InvisibleModules) {
for (var m = 0; m < copy.Placeholders[p].InvisibleModules.length; m++) {
copy.Placeholders[p].Modules.push(copy.Placeholders[p].InvisibleModules[m]);
}
}
copy.Placeholders[p].InvisibleModules = undefined;
for (var m = 0; m < copy.Placeholders[p].Modules.length; m++) {
HandleModule(copy.Placeholders[p].Modules[m]);
}
}
function HandleModule(module) {
module.Style = JSON.stringify(module.Style);
module.Content = JSON.stringify(module.Content);
module.Order = angular.copy(order);
order++;
for (var m2 = 0; m2 < module.Modules.length; m2++) {
HandleModule(module.Modules[m2]);
}
}
return copy;
}
container.prototype.prepareSave = function () {
var validation = this.validate();
if (!validation.valid) {
$mdToast.show(
$mdToast.simple()
.hideDelay(30000)
.parent(angular.element('biz-container-edit > div'))
.textContent('Error in ' + validation.module.Name + '-module: ' + validation.message)
.position('top right'));
return false;
}
this.handleSaveFunctions();
var resetModules = this.handleModuleAccessLimit();
if (resetModules > 0) {
$mdDialog.show($mdDialog.alert()
.parent(angular.element(document.body))
.title('Module access changed')
.textContent(resetModules + ' modules permissions were reset from "Limit" to "Everyone" because nothing was selected to limit to.')
.ok('OK'))
}
$rootScope.$broadcast("CONTAINER_SAVED");
return true;
}
container.prototype.handleModuleAccessLimit = function () {
var resetModules = 0;
this.forEachModule(function (module) {
if (module.LimitAccess && !(module.Content.Permissions.length
|| module.Content.HideForCoinsUsers
|| module.Content.HideForNonCoinsUsers
|| module.Content.HideForLoggedInUsers
|| module.Content.HideForNotLoggedInUsers)) {
module.LimitAccess = false;
resetModules++;
}
});
return resetModules;
}
container.prototype.forEachModule = function (action) {
for (var i = 0; i < this.Placeholders.length; i++) {
for (var j = 0; j < this.Placeholders[i].Modules.length; j++) {
HandleModule(this.Placeholders[i].Modules[j]);
}
}
function HandleModule(module) {
action(module);
if (!module.Modules)
return;
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
container.prototype.validate = function () {
for (var i = 0; i < this.Placeholders.length; i++) {
for (var j = 0; j < this.Placeholders[i].Modules.length; j++) {
var validation = HandleModule(this.Placeholders[i].Modules[j]);
if (!validation.valid)
return validation;
}
}
return { valid: true };
function HandleModule(module) {
var validation = module.validate();
if (!validation.valid)
return validation;
if (module.Modules) {
for (var i = 0; i < module.Modules.length; i++) {
validation = HandleModule(module.Modules[i]);
if (!validation.valid)
break;
}
}
return validation;
}
}
container.prototype.getInvisibleModulesByCulture = function (cultureId) {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].InvisibleModules.length; m++) {
HandleModule(this.Placeholders[p].InvisibleModules[m]);
}
}
function HandleModule(module) {
if (VerifyAccess(module)) {
modules.push(module);
function VerifyAccess(module) {
if (!module.Content.Translations)
return true;
else {
return module.Content.Translations.HiddenForCultures.indexOf(cultureId) == -1;
}
}
}
}
return modules;
}
container.prototype.getModulesByCulture = function (cultureId, systemName) {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
HandleModule(this.Placeholders[p].Modules[m]);
}
}
function HandleModule(module) {
if (VerifyAccess(module)) {
if (systemName && module.SystemName == systemName)
modules.push(module);
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
}
return modules;
function VerifyAccess(module) {
if (!module.Content.Translations)
return true;
else {
return module.Content.Translations.HiddenForCultures.indexOf(cultureId) == -1;
}
}
}
container.prototype.getNamedSegments = function (cultureId) {
var segments = [];
if (cultureId > 0)
segments = this.getModulesByCulture(cultureId, 'Segment');
else
segments = this.getModules('Segment');
return segments.Where(function (segment) {
return !!segment.Content.Name;
});
}
container.prototype.getFinishableModules = function () {
var modules = [];
this.forEachModule(function (module) {
if (module.UseSettings) {
console.log("settings", module.Settings);
}
var isOptional = module.Optional;
if (module.Settings && module.Settings.Optional !== undefined) {
isOptional = module.Settings.Optional;
}
if (module.UseSettings && !isOptional)
modules.push(module);
});
return modules;
}
container.prototype.getModules = function (systemName) {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
HandleModule(this.Placeholders[p].Modules[m]);
}
}
function HandleModule(module) {
if (systemName && module.SystemName.toLowerCase() == systemName.toLowerCase()) {
modules.push(module);
}
else if (!systemName) {
modules.push(module);
}
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
return modules;
}
container.prototype.getModulesByDependency = function (dependencySystemName) {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
HandleModule(this.Placeholders[p].Modules[m]);
}
}
function HandleModule(module) {
if (module.Dependency == dependencySystemName) {
modules.push(module);
}
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
return modules;
}
container.prototype.getModuleByGuid = function (guid) {
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
var module = HandleModule(this.Placeholders[p].Modules[m]);
if (module)
return module;
}
}
function HandleModule(module) {
if (module.Guid == guid)
return module;
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
var found = HandleModule(module.Modules[i]);
if (found)
return found;
}
}
}
}
container.prototype.minimizeModules = function (systemName, value) {
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
HandleModule(this.Placeholders[p].Modules[m]);
}
}
function HandleModule(module) {
if (!systemName || module.SystemName == systemName)
module.Minimized = value;
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
}
container.prototype.getInvisibleModules = function (systemName) {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].InvisibleModules.length; m++) {
HandleModule(this.Placeholders[p].InvisibleModules[m]);
}
}
function HandleModule(module) {
if (systemName && module.SystemName == systemName) {
modules.push(module);
}
else if (!systemName) {
modules.push(module);
}
}
return modules;
}
container.prototype.getVisibleModules = function () {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
HandleModule(this.Placeholders[p].Modules[m]);
}
}
function HandleModule(module) {
if (!module.IsInvisible) {
modules.push(module);
}
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
return modules;
}
container.prototype.getModulesWithSettings = function () {
var modules = [];
for (var p = 0; p < this.Placeholders.length; p++) {
for (var m = 0; m < this.Placeholders[p].Modules.length; m++) {
HandleModule(this.Placeholders[p].Modules[m], this.Placeholders[p]);
}
}
function HandleModule(module, parent) {
if (module.UseSettings) {
module.ParentGuid = parent.Guid;
modules.push(module);
}
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i], module);
}
}
}
return modules;
}
container.prototype.hasStickyNavigation = function () {
var navigations = this.getModules("Navigation");
for (var i = 0; i < navigations.length; i++) {
if (navigations[i].Content.IsSticky) {
return true;
}
}
return false;
}
container.prototype.getModuleAncestors = function (module) {
var placeholders = this.Placeholders;
var ancestors = [];
for (var i = 0; i < placeholders.length; i++) {
for (var j = 0; j < placeholders[i].Modules.length; j++) {
HandleModule(placeholders[i].Modules[j], module);
}
}
return ancestors;
function HandleModule(parent, child) {
if (parent.Modules.indexOf(child) > 0) {
ancestors.push(parent);
for (var i = 0; i < placeholders.length; i++) {
for (var j = 0; j < placeholders[i].Modules.length; j++) {
HandleModule(placeholders[i].Modules[j], parent);
}
}
}
else {
for (var i = 0; i < parent.Modules.length; i++) {
HandleModule(parent.Modules[i], child);
}
}
}
}
container.prototype.getPlaceholderForModule = function (guid) {
for (var i = 0; i < this.Placeholders.length; i++) {
for (var j = 0; j < this.Placeholders[i].Modules.length; j++) {
if (HandleModule(this.Placeholders[i].Modules[j]))
return this.Placeholders[i];
}
}
function HandleModule(module) {
if (module.Guid == guid)
return true;
if (module.Modules.length) {
for (var i = 0; i < module.Modules.length; i++) {
if (HandleModule(module.Modules[i]))
return true;
}
}
return false;
}
}
container.prototype.getImageUrls = function () {
const imageUrls = [];
const imageModules = this.getModules('Image');
const segmentModules = this.getModules('Segment');
for (var i = 0; i < imageModules.length; i++) {
const m = imageModules[i];
if (m.Content && m.Content.ImageUrl && imageUrls.indexOf(m.Content.ImageUrl) < 0) {
imageUrls.push(m.Content.ImageUrl);
}
}
for (var i = 0; i < segmentModules.length; i++) {
var m = segmentModules[i];
if (m.Style && m.Style.BackgroundImage && imageUrls.indexOf(m.Style.BackgroundImage) < 0) {
imageUrls.push(m.Style.BackgroundImage);
}
}
return imageUrls;
}
container.prototype.getPlaceholder = function (index) {
function HandleLayerModule(mod, p) {
for (var i = 0; i < p.Modules.length; i++) {
p.replaceModule(mod);
}
for (var i = 0; i < mod.Modules.length; i++) {
HandleLayerModule(mod.Modules[i], p);
}
}
if (this.Placeholders[index].Type === undefined || this.Placeholders[index].Type === 1) {
var p = this.Placeholders[index];
//console.log('Placeholder to use: ', p);
return p;
}
else if (this.Placeholders[index].Type === 2) {
// We need to handle the layering
//Get the default placeholder...
var p = new placeholder(angular.copy(this.Placeholders[0]));
//getModuleByGuid
var layer = new placeholder(angular.copy(this.Placeholders[index]));
p.Type = layer.Type;
p.Name = layer.Name;
p.Id = layer.Id;
p.Permissions = layer.Permissions;
for (var i = 0; i < layer.Modules.length; i++) {
HandleLayerModule(layer.Modules[i], p);
}
//console.log('Final placeholder for layer:', p);
return p;
}
};
return container;
}
function placeholderFactory(moduleInstance) {
var placeholder = function (pl, preventInit) {
if (!pl)
pl = {};
this.Id = pl.Id || -1;
this.Modules = [];
this.InvisibleModules = [];
this.Name = pl.Name || "";
this.Type = pl.Type || 1;
this.Permissions = pl.Permissions || [];
if (pl.InvisibleModules) {
for (var i = 0; i < pl.InvisibleModules.length; i++) {
this.InvisibleModules.push(new moduleInstance(pl.InvisibleModules[i], false, preventInit, this.Id));
}
}
if (pl.Modules) {
for (var i = 0; i < pl.Modules.length; i++) {
if (!pl.Modules[i].IsInvisible)
this.Modules.push(new moduleInstance(pl.Modules[i], false, preventInit, this.Id));
else
this.InvisibleModules.push(new moduleInstance(pl.Modules[i], false, preventInit, this.Id));
}
}
};
placeholder.prototype.getModuleByGuid = function (guid) {
for (var m = 0; m < this.Modules.length; m++) {
var module = HandleModule(this.Modules[m]);
if (module)
return module;
}
function HandleModule(module) {
if (module.Guid === guid)
return module;
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
var found = HandleModule(module.Modules[i]);
if (found)
return found;
}
}
}
};
placeholder.prototype.replaceModule = function (mod) {
for (var m = 0; m < this.Modules.length; m++) {
this.Modules[m].tryReplace(mod, this.Id);
}
};
placeholder.prototype.convertToLayer = function () {
function ResetModuleAsLayer(mod) {
mod.LayeredModuleInstanceGuid = angular.copy(mod.Guid);
mod.Id = -1;
mod.Guid = Math.random().toString(36).substr(2, 10);
for (var i = 0; i < mod.Modules.length; i++) {
ResetModuleAsLayer(mod.Modules[i]);
}
}
this.Id = -1;
this.Type = 2;
for (var i = 0; i < this.Modules.length; i++) {
ResetModuleAsLayer(this.Modules[i]);
}
};
placeholder.prototype.resetIds = function () {
//function ResetModuleId(mod) {
// mod.Id = -1;
// mod.Guid = Math.random().toString(36).substr(2, 10);
// mod.Identifier = -1;
// for (var i = 0; i < mod.Modules.length; i++) {
// ResetModuleId(mod.Modules[i]);
// }
//}
this.Id = -1;
for (var i = 0; i < this.Modules.length; i++) {
//ResetModuleId(this.Modules[i]);
this.Modules[i].resetIds();
}
};
return placeholder;
}
function settingsFactory() {
var settings = function (mod) {
this.PointsGain = mod.DefaultExperienceValue || 0;
this.CoinsGain = mod.DefaultVirtualCurrencyValue || 0;
};
return settings;
}
function styleFactory() {
var style = function (st) {
if (!st)
st = {};
if (!st.Mobile)
st.Mobile = {};
this.TextColor = st.TextColor || "";
this.HeaderTextColor = st.HeaderTextColor || "";
this.TextSize = st.TextSize || "";
this.LineHeight = st.LineHeight || "";
this.HeaderTextSize = st.HeaderTextSize || "";
this.BackgroundColor = st.BackgroundColor || "";
this.BorderStyle = st.BorderStyle || "";
this.BorderWidth = st.BorderWidth || "";
this.BorderColor = st.BorderColor || "";
this.BorderRadius = st.BorderRadius || "";
this.PaddingTop = st.PaddingTop || "";
this.PaddingRight = st.PaddingRight || "";
this.PaddingBottom = st.PaddingBottom || "";
this.PaddingLeft = st.PaddingLeft || "";
this.Margin = st.Margin || "";
this.MarginLeft = st.MarginLeft || "";
this.MarginRight = st.MarginRight || "";
this.MarginTop = st.MarginTop || "";
this.MarginBottom = st.MarginBottom || "";
this.TextAlign = st.TextAlign || "";
this.FontFamily = st.FontFamily || "";
this.HeaderFontFamily = st.HeaderFontFamily || "";
this.JustifyContent = st.JustifyContent || "flex-start";
this.MaxWidth = st.MaxWidth || "";
this.MaxHeight = st.MaxHeight || "";
this.ModuleMaxWidth = st.ModuleMaxWidth || "";
this.MinWidth = st.MinWidth || "";
this.MinHeight = st.MinHeight || "";
this.Bold = st.Bold || "";
this.Italic = st.Italic || "";
this.MobileWidthClass = st.MobileWidthClass || "";
this.DesktopWidthClass = st.DesktopWidthClass || "";
this.TextVerticalAlignClass = st.TextVerticalAlignClass || "";
this.HideOnDesktop = st.HideOnDesktop || false;
this.HideOnMobile = st.HideOnMobile || false;
this.BackgroundImage = st.BackgroundImage || "";
this.BackgroundImageBrightness = st.BackgroundImageBrightness || '100';
this.BackgroundImageBlur = st.BackgroundImageBlur || '0';
this.BackgroundImageOpacity = st.BackgroundImageOpacity || '100';
this.Translated = st.Translated || [];
this.Mobile = {
Enabled: st.Mobile.Enabled || false,
TextColor: st.Mobile.TextColor || "",
HeaderTextColor: st.Mobile.HeaderTextColor || "",
HeaderTextSize: st.Mobile.HeaderTextSize || "",
TextSize: st.Mobile.TextSize || "",
LineHeight: st.Mobile.LineHeight || "",
BackgroundColor: st.Mobile.BackgroundColor || "",
BorderStyle: st.Mobile.BorderStyle || "",
BorderWidth: st.Mobile.BorderWidth || "",
BorderColor: st.Mobile.BorderColor || "",
BorderRadius: st.Mobile.BorderRadius || "",
PaddingTop: st.Mobile.PaddingTop || "",
PaddingRight: st.Mobile.PaddingRight || "",
PaddingBottom: st.Mobile.PaddingBottom || "",
PaddingLeft: st.Mobile.PaddingLeft || "",
Margin: st.Mobile.Margin || "",
MarginLeft: st.Mobile.MarginLeft || "",
MarginRight: st.Mobile.MarginRight || "",
MarginTop: st.Mobile.MarginTop || "",
MarginBottom: st.Mobile.MarginBottom || "",
TextAlign: st.Mobile.TextAlign || "",
FontFamily: st.Mobile.FontFamily || "",
HeaderFontFamily: st.Mobile.HeaderFontFamily || "",
JustifyContent: st.Mobile.JustifyContent || "",
MaxWidth: st.Mobile.MaxWidth || "",
MaxHeight: st.Mobile.MaxHeight || "",
ModuleMaxWidth: st.Mobile.ModuleMaxWidth || "",
MinWidth: st.Mobile.MinWidth || "",
MinHeight: st.Mobile.MinHeight || "",
Bold: st.Mobile.Bold || "",
Italic: st.Mobile.Italic || "",
TextVerticalAlignClass: st.Mobile.TextVerticalAlignClass || "",
BackgroundImage: st.Mobile.BackgroundImage || ""
}
};
return style;
}
function moduleAbstractFactory() {
var moduleAbstract = function (mod) {
this.ModuleAbstractId = mod.ModuleAbstractId || -1;
this.SystemName = mod.SystemName || "";
this.Name = mod.Name || "";
this.Image = mod.Image || "";
this.IconCss = mod.IconCss || "";
this.Description = mod.Description || "";
this.AdminComponent = mod.AdminComponent || "";
this.AdminSettingsComponent = mod.AdminSettingsComponent || "";
this.AdminStyleComponent = mod.AdminStyleComponent || "";
this.Component = mod.Component || "";
this.ClassName = mod.ClassName || "";
this.Category = mod.Category || "";
this.UseSettings = mod.UseSettings || false;
this.UseStatistics = mod.UseStatistics || false;
this.IsInvisible = mod.IsInvisible || false;
this.Dependency = mod.Dependency || "";
this.Features = mod.Features || {};
this.ViewList = mod.ViewList || [];
this.Hidden = mod.Hidden || false;
this.DefaultExperienceValue = mod.DefaultExperienceValue || 0;
this.DefaultVirtualCurrencyValue = mod.DefaultVirtualCurrencyValue || 0;
this.Optional = mod.Optional || false;
this.AdminPanelsVisible = mod.AdminPanelsVisible || [];
};
moduleAbstract.prototype.initialize = function (mod) {
this.ModuleAbstractId = mod.ModuleAbstractId || -1;
this.SystemName = mod.SystemName || "";
this.Name = mod.Name || "";
this.Image = mod.Image || "";
this.IconCss = mod.IconCss || "";
this.Description = mod.Description || "";
this.AdminComponent = mod.AdminComponent || "";
this.AdminSettingsComponent = mod.AdminSettingsComponent || "";
this.AdminStyleComponent = mod.AdminStyleComponent || "";
this.Component = mod.Component || "";
this.ClassName = mod.ClassName || "";
this.UseSettings = mod.UseSettings || false;
this.UseStatistics = mod.UseStatistics || false;
this.IsInvisible = mod.IsInvisible || false;
this.Dependency = mod.Dependency || "";
this.Features = mod.Features || {};
this.ViewList = mod.ViewList || [];
this.Hidden = mod.Hidden || false;
this.DefaultExperienceValue = mod.DefaultExperienceValue || 0;
this.DefaultVirtualCurrencyValue = mod.DefaultVirtualCurrencyValue || 0;
this.Optional = mod.Optional || false;
this.AdminPanelsVisible = mod.AdminPanelsVisible || [];
};
return moduleAbstract;
}
function moduleInstanceFactory($rootScope, moduleAbstract, style, settings, containerService, bizContainerSettings) {
var module = function (mod, reset, preventInit, targetplaceholderId) {
this.initialize(mod);
if (!reset)
this.Id = mod.Id || -1;
else
this.Id = -1;
this.Modules = [];
this.TargetPlaceholderId = ~~targetplaceholderId;
if (mod.HasFinishedBefore) {
this.HasFinishedBefore = mod.HasFinishedBefore;
}
if (!reset)
this.Guid = mod.Guid || Math.random().toString(36).substr(2, 10);
else
this.Guid = Math.random().toString(36).substr(2, 10);
this.LayeredModuleInstanceGuid = mod.LayeredModuleInstanceGuid || "";
if (mod.Modules && mod.Modules.length > 0) {
for (var i = 0; i < mod.Modules.length; i++) {
var child = new module(mod.Modules[i], reset, preventInit);
child.ParentGuid = this.Guid;
this.Modules.push(child);
}
}
if (mod.Content) {
if (typeof mod.Content == "string") {
this.Content = JSON.parse(mod.Content);
}
else {
this.Content = angular.copy(mod.Content);
}
}
else {
this.Content = {};
}
if (mod.Style) {
if (typeof mod.Style == "string") {
this.Style = new style(JSON.parse(mod.Style));
}
else {
this.Style = angular.copy(mod.Style);
}
}
else {
this.Style = new style();
}
this.Settings = mod.Settings || new settings(mod);
for (var i = 0; mod.ViewList && i < mod.ViewList.length; i++) {
if ((mod.View && mod.View.Id == mod.ViewList[i].Id)
|| (!mod.View && mod.ViewList[i].Id < 1)) {
this.View = mod.ViewList[i];
}
}
this.IsFinished = mod.IsFinished || false;
this.ModuleAbstractId = mod.ModuleAbstractId || -1;
this.SystemName = mod.SystemName || "";
this.Name = mod.Name || "";
this.Image = mod.Image || "";
this.Description = mod.Description || "";
this.AdminComponent = mod.AdminComponent || "";
this.AdminSettingsComponent = mod.AdminSettingsComponent || "";
this.AdminStyleComponent = mod.AdminStyleComponent || "";
this.Component = mod.Component || "";
this.ClassName = mod.ClassName || "";
this.UseSettings = mod.UseSettings || false;
this.Features = mod.Features || {};
this.IsInvisible = mod.IsInvisible || false;
this.Dependency = mod.Dependency || "";
this.ViewList = mod.ViewList || [];
this.Identifier = this.Id > 0 ? this.Id : this.Guid;
this.Color = mod.Color || randomColor({ luminosity: 'light' });
this.DefaultExperienceValue = mod.DefaultExperienceValue || 0;
this.DefaultVirtualCurrencyValue = mod.DefaultVirtualCurrencyValue || 0;
this.Optional = mod.Optional || false;
this.IsRestricted = mod.IsRestricted || false;
this.HasFullAccess = mod.HasFullAccess || false;
this.Restriction = mod.Restriction || {};
this.AdminPanelsVisible = mod.AdminPanelsVisible || [];
if (preventInit) {
this.Initialized = true;
this.PreventInit = true;
}
//setTimeout(function (moi) {
// moi.Initialized = true;
//}, 300, this);
// trying to fix js error moi is undefined, maybe issue with using 'this' that way.
setTimeout(function () {
this.Initialized = true;
}.bind(this), 300);
};
module.prototype = new moduleAbstract(this);
module.prototype.constructor = module;
module.prototype.parent = moduleAbstract.prototype;
module.prototype.render = function () {
if (!this.IsRendered) {
$rootScope.$broadcast('MODULE_RENDER', this);
}
this.IsRendered = true;
};
module.prototype.resetIds = function (setLayeredModuleInstanceGuid) {
function ResetModuleId(mod) {
if (setLayeredModuleInstanceGuid) {
mod.LayeredModuleInstanceGuid = angular.copy(mod.Guid);
}
mod.Id = -1;
mod.Guid = Math.random().toString(36).substr(2, 10);
mod.Identifier = -1;
for (var i = 0; i < mod.Modules.length; i++) {
ResetModuleId(mod.Modules[i]);
}
}
if (setLayeredModuleInstanceGuid) {
this.LayeredModuleInstanceGuid = angular.copy(this.Guid);
}
this.Id = -1;
this.Guid = Math.random().toString(36).substr(2, 10);
this.Identifier = -1;
for (var i = 0; i < this.Modules.length; i++) {
ResetModuleId(this.Modules[i]);
}
};
module.prototype.tryReplace = function (mod, placeholderId) {
if (mod.LayeredModuleInstanceGuid !== undefined && mod.LayeredModuleInstanceGuid !== ""
&& this.Guid === mod.LayeredModuleInstanceGuid) {
this.Id = mod.Id;
this.Guid = mod.Guid;
this.Content = mod.Content;
this.Settings = mod.Settings;
this.Style = mod.Style;
this.LayeredModuleInstanceGuid = "";
this.Identifier = mod.Identifier;
this.PlaceholderId = placeholderId;
}
else if (this.Modules) {
for (var i = 0; i < this.Modules.length; i++) {
this.Modules[i].tryReplace(mod, placeholderId);
}
}
};
module.prototype.finish = function (passed) {
this.IsFinished = true;
this.IsPassed = passed || passed === undefined;
// if (!this.UseSettings)
// return;
$rootScope.$broadcast('MODULE_FINISH', this);
if (this._finishHandler)
return this._finishHandler(this);
containerService.SetContainerModuleInstanceFinished(this.Id).then();
}
module.prototype.reject = function () {
$rootScope.$broadcast('MODULE_REJECTED', this);
}
module.prototype.logEvent = function (event) {
$rootScope.$broadcast('MODULE_LOG_EVENT', { module: this, event: event });
if ($rootScope.LoggedInUser.Id > 0) {
containerService.LogEvent(event);
}
}
module.prototype.isHiddenForUser = function () {
var isLoggedIn = $rootScope.LoggedInUser && $rootScope.LoggedInUser.Id && $rootScope.LoggedInUser.Id > 0;
var hidden = this.Content.HideForNonCoinsUsers && bizContainerSettings["CurrentUserCurrency"] == -1
|| this.Content.HideForCoinsUsers && bizContainerSettings["CurrentUserCurrency"] >= 0
|| this.Content.HideForLoggedInUsers && isLoggedIn
|| this.Content.HideForNotLoggedInUsers && !isLoggedIn;
return hidden || false;
}
module.prototype.getUnfinishedChilds = function (name) {
var modules = [];
for (var i = 0; i < this.Modules.length; i++) {
HandleModule(this.Modules[i]);
}
function HandleModule(module) {
if (!module.IsFinished) {
if (name && module.Name == name) {
modules.push(module);
}
else if (!name) {
modules.push(module);
}
}
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
return modules;
};
module.prototype.getChildModules = function (name) {
var modules = [];
for (var i = 0; i < this.Modules.length; i++) {
HandleModule(this.Modules[i]);
}
function HandleModule(module) {
if (name && module.Name === name) {
modules.push(module);
}
else if (!name) {
modules.push(module);
}
if (module.Modules && module.Modules.length > 0) {
for (var i = 0; i < module.Modules.length; i++) {
HandleModule(module.Modules[i]);
}
}
}
return modules;
};
module.prototype.prepareForBackend = function (order) {
if (!order) order = 0;
this.Style = JSON.stringify(this.Style);
this.Content = JSON.stringify(this.Content);
this.Order = angular.copy(order);
order++;
for (var m2 = 0; m2 < this.Modules.length; m2++) {
this.Modules[m2].prepareForBackend(order);
}
}
module.prototype.setValidation = function (validationFn) {
this._validationFunction = validationFn;
}
module.prototype.validate = function () {
var validation = { valid: true };
if (!this._validationFunction)
return validation;
this._validationFunction(validation);
validation.module = this;
return validation;
}
module.prototype.generateStyleSheet = function () {
//TODO Implement generating of stylesheet through js
//this.destroyStyleSheet();
}
module.prototype.destroyStyleSheet = function () {
//TODO Implement desctruction of stylesheet through js
}
return module;
}
function moduleAbstractSettingsPluginFactory() {
var plugin = function (name, component) {
this.Name = name || "";
this.Component = component || "";
};
return plugin;
}
function moduleEventFactory() {
var event = function (e) {
this.Type = e.Type || "";
this.Name = e.Name || "";
this.UserId = e.UserId || -1;
this.ModuleInstance = e.ModuleInstance || {};
this.Date = e.Date || moment().format('YYYY-MM-DD HH:mm:ss');
}
return event;
}
/* SERVICE */
angular.module('BizContainer').service('bizContainerService', bizContainerService);
bizContainerService.$inject = ["$rootScope", "$http", "$mdDialog", "bizContainerUrls", "bizContainerSettings"];
function bizContainerService($rootScope, $http, $mdDialog, bizContainerUrls, bizContainerSettings) {
return {
GetAdminSettings: GetAdminSettings,
SaveAdminSettings: SaveAdminSettings,
MakeGetRequest: MakeGetRequest,
MakeGetRequestWithUrl: MakeGetRequestWithUrl,
MakeDeleteRequest: MakeDeleteRequest,
MakePostRequestWithUrl: MakePostRequestWithUrl,
MakePostRequest: MakePostRequest,
SaveContainerVersion: SaveContainerVersion,
GetContainerVersionWContainer: GetContainerVersionWContainer,
GetContainerVersions: GetContainerVersions,
DeleteContainerVersion: DeleteContainerVersion,
SaveContainerTemplate: SaveContainerTemplate,
GetContainerTemplates: GetContainerTemplates,
GetContainerTemplate: GetContainerTemplate,
DeleteContainerTemplate: DeleteContainerTemplate,
GetAllModuleAbstracts: GetAllModuleAbstracts,
GetModuleAbstracts: GetModuleAbstracts,
LogEvent: LogEvent,
GetModuleInstanceUserEvents: GetModuleInstanceUserEvents,
GetAllBizContainerModuleCategoryPages: GetAllBizContainerModuleCategoryPages,
GetModulesFromCategory: GetModulesFromCategory,
GetContainerStyleLimitations: GetContainerStyleLimitations,
SaveContainerStyleLimitations: SaveContainerStyleLimitations,
SetContainerModuleInstanceFinished: SetContainerModuleInstanceFinished,
GetTabsWModuleInstance: GetTabsWModuleInstance,
DeleteModule: DeleteModule,
DeletePlaceholder: DeletePlaceholder,
GetUserCountByItem: GetUserCountByItem,
ExportContainer: ExportContainer,
ImportContainer: ImportContainer,
GetExportedContainerList: GetExportedContainerList,
CopyModule: CopyModule,
CopyModuleToClipboard: CopyModuleToClipboard,
SaveModuleCombination: SaveModuleCombination,
GetSavedModuleCombinations: GetSavedModuleCombinations
};
function CopyModuleToClipboard(module) {
var newModule = angular.copy(module);
var moduleWrapper = {
type: 'BIZPARTCONTAINERMODULE',
name: newModule.SystemName,
module: newModule,
host: window.location.hostname
}
var jsonModule = JSON.stringify(moduleWrapper);
//changing from clipboard to session storage due to permissions, but keeping the code in case we want it later
//because with session storage we cant copy to another site.
setSessionStorage('SAVEDCONTAINERMODULE', jsonModule);
//var dummy = document.createElement("textarea");
//document.body.appendChild(dummy);
//dummy.value = jsonModule;
//dummy.select();
//document.execCommand("copy");
//document.body.removeChild(dummy);
}
function GetUserCountByItem(key, itemId) {
return MakeGetRequest("Permission", "GetUserCountByItem", { key: key, itemId: itemId});
}
function GetAdminSettings() {
return MakeGetRequest("Container", "GetAdminSettings");
}
function SaveAdminSettings(settings) {
return MakePostRequest("Container", "SaveAdminSettings", {
settings: settings
});
}
function MakeGetRequest(urlKey, methodName, params, config) {
if (!config)
config = { headers: { "IgnoreLoader": true } };
if (!params)
params = {};
var url = siteRootPath + bizContainerUrls[urlKey] + methodName;
if (bizContainerSettings.UseApiController)
params = { params: params };
return bizContainerSettings.UseApiController ? $http.get(url, params, config) : $http.post(url, params, config);
}
function MakeGetRequestWithUrl(url, params, config) {
if (!config)
config = { headers: { IgnoreLoader: true } };
if (!params)
params = {};
if (bizContainerSettings.UseApiController)
params = { params: params };
return bizContainerSettings.UseApiController ? $http.get(url, params, config) : $http.post(url, params, config);
}
function MakeDeleteRequest(urlKey, methodName, params, config) {
if (!config)
config = {};
if (!params)
params = {};
var url = siteRootPath + bizContainerUrls[urlKey] + methodName;
if (bizContainerSettings.UseApiController)
params = { params: params };
return bizContainerSettings.UseApiController ? $http.delete(url, params, config) : $http.post(url, params, config);
}
function MakePostRequestWithUrl(url, params, config) {
if (!config)
config = {};
if (!params)
params = {};
if (bizContainerSettings.UseApiController) {
params = params[Object.keys(params)[0]];
}
return $http.post(url, params, config);
}
function MakePostRequest(urlKey, methodName, params, config) {
if (!config)
config = {};
if (!params)
params = {};
var url = siteRootPath + bizContainerUrls[urlKey] + methodName;
if (bizContainerSettings.UseApiController) {
params = params[Object.keys(params)[0]];
}
return $http.post(url, params, config);
}
function CopyModule(module) {
var newModule = angular.copy(module);
newModule.prepareForBackend();
return MakePostRequest("Container", "CopyModule", { newModule }, { headers: { IgnoreLoader: true } });
}
function SaveModuleCombination(module, saveName) {
var newModule = angular.copy(module);
newModule.prepareForBackend();
var combination = {
Module: newModule,
Name: saveName
};
return MakePostRequest("Container", "SaveModuleCombination", { combination }, { headers: { IgnoreLoader: true } });
}
function GetSavedModuleCombinations() {
return MakeGetRequest("Container", "GetSavedModuleCombinations");
}
function SaveContainerVersion(version) {
return MakePostRequest("Container", "SaveContainerVersion", { version: version });
}
function GetContainerVersionWContainer(versionId) {
return MakeGetRequest("Container", "GetContainerVersionWContainer", { id: versionId });
}
function GetContainerVersions(versionType, containerId) {
return MakeGetRequest("Container", "GetContainerVersions", { versionType: versionType, containerId: containerId });
}
function DeleteContainerVersion(versionId) {
return MakeDeleteRequest("Container", "DeleteContainerVersion", { versionId: versionId });
}
function SaveContainerTemplate(template) {
return MakePostRequest("Container", "SaveContainerTemplate", { template: template });
}
function GetContainerTemplates(type) {
return MakeGetRequest("Container", "GetContainerTemplates?" + $.param({ type: type }));
}
function GetContainerTemplate(id) {
return MakeGetRequest("Container", "GetContainerTemplate?" + $.param({ id: id }));
}
function DeleteContainerTemplate(id) {
return MakeDeleteRequest("Container", "DeleteContainerTemplate", { id: id });
}
function ExportContainer(container, SaveToName) {
return MakePostRequest("Container", "ExportContainer", { data: { Container: container, SaveToName: SaveToName } });
}
function ImportContainer(guid) {
return MakeGetRequest("Container", "ImportContainer?" + $.param({ guid: guid }));
}
function GetExportedContainerList() {
return MakeGetRequest("Container", "GetExportedContainerList");
}
function GetAllModuleAbstracts(customModulesFolders, loadCoreModules) {
if (loadCoreModules === undefined) loadCoreModules = true;
return MakePostRequest("Container", "GetAllModuleAbstracts?" + $.param({ loadCoreModules: loadCoreModules }), { customModulesFolders: customModulesFolders, loadCoreModules: loadCoreModules });
}
function GetModuleAbstracts(customModulesSystemName) {
return MakePostRequest("Container", "GetModuleAbstracts", { customModulesSystemName: customModulesSystemName });
}
function LogEvent(event) {
var moduleEvent = {
Type: event.Type,
Name: event.Name,
UserId: event.UserId,
ModuleInstanceId: event.ModuleInstance.Id
};
var config = {
headers: {
IgnoreLoader: true
}
}
return MakePostRequest("Container", "LogEvent", { moduleEvent: moduleEvent }, config);
}
function GetModuleInstanceUserEvents(moduleInstanceId) {
return MakeGetRequest("Container", "GetModuleInstanceUserEvents", { moduleInstanceId: moduleInstanceId });
}
function GetAllBizContainerModuleCategoryPages() {
return MakeGetRequest("CategoryAdmin", "GetAllBizContainerModuleCategoryPages", {});
}
function GetModulesFromCategory(categoryId) {
var config = {
headers: {
IgnoreLoader: true
}
};
return MakeGetRequest("CategoryAdmin", "GetAllBizContainerModuleCategoryPages", { categoryId: categoryId }, config);
}
function GetContainerStyleLimitations() {
return MakeGetRequest("Container", "GetContainerStyleLimitations", {});
}
function SaveContainerStyleLimitations(limitations) {
return MakeGetRequest("Container", "SaveContainerStyleLimitations", { limitations: limitations });
}
function DeletePlaceholder(placeholderId) {
return MakeDeleteRequest("Container", "DeletePlaceholder", {
id: placeholderId
});
}
function SetContainerModuleInstanceFinished(containerModuleInstanceId) {
var config = {
headers: {
IgnoreLoader: true
}
};
return MakeGetRequest("Container", "SetContainerModuleInstanceFinished", { containerModuleInstanceId: containerModuleInstanceId }, config);
}
function GetTabsWModuleInstance(moduleAbstractName) {
var config = {
headers: {
IgnoreLoader: true
}
};
return $http.post(siteRootPath + "WS/BizPartScriptService.asmx/GetTabsWModuleInstance",
{
moduleAbstractName: moduleAbstractName
}, config);
}
function DeleteModule(module, parent, container, isInvisible, skipConfirm) {
var confirmDialog = $mdDialog.confirm({
parent: angular.element(document.body),
title: "Delete module",
textContent: "You're about to delete a module, are you sure you want that?",
ok: "Ok",
cancel: "Cancel"
});
if (!skipConfirm)
$mdDialog.show(confirmDialog).then(Delete);
else
Delete();
function Delete() {
//MakeDeleteRequest("Container", "DeleteModuleInstance", {
// moduleInstanceGuid: module.Guid
//}).then(DeleteFromArray);
container.removeSaveFunction(module);
container.ModulesToDelete.push(module.Guid);
DeleteFromArray();
function DeleteFromArray() {
$rootScope.$broadcast('MODULE_DELETED', module);
if (isInvisible) {
parent.InvisibleModules.splice(parent.InvisibleModules.indexOf(module), 1);
}
else {
parent.Modules.splice(parent.Modules.indexOf(module), 1);
}
}
$rootScope.$broadcast('PAGE_DIRTY', true);
if (container.SelectedModule == module)
container.SelectedModule = undefined;
}
}
}
})(window.angular);
(function (angular) {
angular.module('BizContainerHelper', ['BizContainer']).run(BizContainerHelperRun);
BizContainerHelperRun.$inject = ["bizContainerUrls", "bizContainerSettings"];
function BizContainerHelperRun(bizContainerUrls, bizContainerSettings) {
bizContainerUrls.Experience = "api/Engage/";
bizContainerUrls.Blog = "api/BlogUser/";
bizContainerUrls.Container = "api/Container/";
bizContainerUrls.CategoryAdmin = "api/Container/";
bizContainerUrls.OnlineEducation = "api/educationadmin/";
bizContainerUrls.OnlineEducationUser = "api/education/";
bizContainerUrls.FormsUser = "api/formsuser/";
bizContainerUrls.Event = "api/Event/";
bizContainerUrls.MissionsUser = "api/missionsuser/";
bizContainerUrls.MissionsAdmin = "api/missionsadmin/";
bizContainerUrls.Forum = "api/Forum/";
bizContainerUrls.TopList = "api/TopList/";
bizContainerUrls.Tag = "api/Tag/";
bizContainerUrls.GenericSend = "api/genericsendcategory/";
bizContainerSettings.UseApiController = true;
bizContainerSettings.UseEngageCore = true;
}
})(window.angular);
/**
* Minified by jsDelivr using Terser v5.3.5.
* Original file: /npm/canvas-confetti@1.4.0/dist/confetti.browser.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(t,e){!function t(e,n,a,i){var o=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL);function r(){}function l(t){var a=n.exports.Promise,i=void 0!==a?a:e.Promise;return"function"==typeof i?new i(t):(t(r,r),null)}var c,s,u,d,f,h,g,m,b=(u=Math.floor(1e3/60),d={},f=0,"function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame?(c=function(t){var e=Math.random();return d[e]=requestAnimationFrame((function n(a){f===a||f+u-1 -1;
if (vm.forceLimit === true) {
vm.module.LimitAccess = true;
}
var permissionFields = ["UserId", "RoleId", "UserDepartmentId", "OnlyNotLoggedIn", "CultureId", "UnitId", "AreaId", "CountryId", "IsPublic", "IpRestriction"];
if (vm.blacklistedPermissions && vm.blacklistedPermissions.length > 0) {
for (var i = 0; i < vm.blacklistedPermissions.length; i++) {
vm.blacklistedPermissions[i].ApplicantLayers = [];
for (var y = 0; y < permissionFields.length; y++) {
if (vm.blacklistedPermissions[i][permissionFields[y]]) {
vm.blacklistedPermissions[i].ApplicantLayers.push(permissionFields[y]);
}
}
}
}
bizItemPermissionService.GetPermissionObjects(vm.accessModuleKey).then(GetPermissionsSuccess);
function GetPermissionsSuccess(response) {
vm.FilteredUnits = GetFilteredUnits();
vm.FilteredRoles = GetFilteredRoles();
}
}
function GetFilteredUnits() {
var blacklistedUnitIds = [];
if (vm.blacklistedPermissions) {
for (var i = 0; i < vm.blacklistedPermissions.length; i++) {
if (vm.blacklistedPermissions[i].ApplicantLayers.length === 1 && vm.blacklistedPermissions[i].ApplicantLayers[0] === "UnitId") {
blacklistedUnitIds.push(vm.blacklistedPermissions[i].UnitId);
}
}
}
var unitsToReturn = [];
for (var i = 0; i < vm.bizItemPermissionCache[vm.accessModuleKey].Units.length; i++) {
var blacklisted = false;
for (var y = 0; y < blacklistedUnitIds.length; y++) {
if (vm.bizItemPermissionCache[vm.accessModuleKey].Units[i].Id === blacklistedUnitIds[y]) {
blacklisted = true;
}
}
if (!blacklisted) {
unitsToReturn.push(vm.bizItemPermissionCache[vm.accessModuleKey].Units[i]);
}
}
return unitsToReturn;
}
function GetFilteredRoles() {
var blacklistedIds = [];
if (vm.blacklistedPermissions) {
for (var i = 0; i < vm.blacklistedPermissions.length; i++) {
if (vm.blacklistedPermissions[i].ApplicantLayers.length === 1 && vm.blacklistedPermissions[i].ApplicantLayers[0] === "RoleId") {
blacklistedIds.push(vm.blacklistedPermissions[i].RoleId);
}
}
}
var itemsToReturn = [];
for (var i = 0; i < vm.bizItemPermissionCache[vm.accessModuleKey].Roles.length; i++) {
var blacklisted = false;
for (var y = 0; y < blacklistedIds.length; y++) {
if (vm.bizItemPermissionCache[vm.accessModuleKey].Roles[i].Id === blacklistedIds[y]) {
blacklisted = true;
}
}
if (!blacklisted) {
itemsToReturn.push(vm.bizItemPermissionCache[vm.accessModuleKey].Roles[i]);
}
}
return itemsToReturn;
}
vm.$onInit = vm.Initialize;
}
return directive;
}
})(window.angular);
(function (angular) {
angular.module('BizContainer').directive('bizContainerUrlHelper', bizContainerUrlHelper);
angular.module('BizContainer').service('bizContainerUrlHelperService', bizContainerUrlHelperService);
bizContainerUrlHelperService.$inject = ["$http"];
bizContainerUrlHelper.$inject = [];
function bizContainerUrlHelper() {
var directive = {
restrict: "E",
scope: {
url: "=",
disabledCms: '=?',
placeholderText: '@?'
},
templateUrl: siteRootPath + 'Js/BizContainer/Directives/bizContainerUrlHelper.html',
controller: bizContainerUrlHelperController,
bindToController: true,
controllerAs: "vm"
};
bizContainerUrlHelperController.$inject = ["$rootScope", "bizCoreService", "bizContainerUrlHelperService", "bizContainerSettings"];
function bizContainerUrlHelperController($rootScope, bizCoreService, bizContainerUrlHelperService, bizContainerSettings) {
var vm = this;
vm.Init = Init;
vm.CMSPages = [];
vm.placeholderText = 'Link';
vm.GetCMSPages = GetCMSPages;
vm.SelectedCMSPage = undefined;
vm.Change = Change;
vm.UseEngageCore = !vm.disabledCms || bizContainerSettings.UseEngageCore; // or fallback to textbox only.
vm.ShowManualLink = false;
function Change() {
if (vm.SelectedCMSPage) {
vm.url = '/page/' + vm.SelectedCMSPage.UrlRewrite;
}
}
function GetCMSPages() {
bizContainerUrlHelperService.GetAllCMSPages().then(GetCmsPagesCallback);
function GetCmsPagesCallback(response) {
vm.CMSPages = response.data;
SetSelectedItem();
}
}
function SetSelectedItem() {
if (vm.url !== undefined && vm.url != '' && vm.url.startsWith('/page/') && vm.CMSPages) {
vm.SelectedCMSPage = vm.CMSPages.GetItemByValue('UrlRewrite', vm.url.replace('/page/', ''));
}
else {
vm.SelectedCMSPage = undefined;
}
}
$rootScope.$watch(function () { return vm.url; }, function () {
if (vm.url !== undefined && vm.url != '') {
SetSelectedItem();
}
});
$rootScope.$watch(function () { return vm.disabledCms; }, function () {
vm.UseEngageCore = !vm.disabledCms;
});
$rootScope.$watch(function () { return vm.placeholderText; }, function () {
vm.placeholderText = (vm.placeholderText != '' ? vm.placeholderText : 'Link');
});
function Init() {
if (vm.UseEngageCore) {
vm.GetCMSPages();
}
}
vm.$onInit = vm.Init;
if (angular.version.major === 1 && angular.version.minor < 5) {
vm.$onInit();
}
}
return directive;
}
function bizContainerUrlHelperService($http) {
this.GetAllCMSPages = function () {
return $http.post(siteRootPath + 'api/CmsAdmin/GetAllCMSPages', {});
}
}
})(window.angular);